Code Monkey home page Code Monkey logo

solarmaxcom's Introduction

solarmaxcom

solarmaxcom reads out data from your SolarMax device (in particular solar inverters) and optionally sends it via MQTT. It uses the serial port interface and implements the protocol described in https://www.solarmax.com/Downloads/MaxComm_Protocol_Description_EN.pdf .

Getting started

Your SolarMax device should be connected to your computer with a serial cable. A Raspberry Pi with a cheap CH340C USB-to-serial adapter works fine.

The available data depends on the SolarMax device. If you do not specify which data keys to read out, solarmaxcom tries all keys it knows about. For a Solarmax 2500SP inverter, this is the result:

pi@raspi:~ $ java -jar solarmaxcom.jar /dev/ttyUSB2
13:55:49.217 [main] INFO solarmaxcom.SolarMaxCom - Testing all known data keys...
13:55:49.280 [main] INFO solarmaxcom.SolarMaxCom - Requesting keys...
13:55:49.424 [main] WARN solarmaxcom.SolarMaxCom - Could not parse packet: solarmaxcom.protocol.Packet$ParseException: Invalid message: Key '' unknown.
13:55:49.614 [main] WARN solarmaxcom.SolarMaxCom - Could not parse packet: solarmaxcom.protocol.Packet$ParseException: Invalid message: Key '' unknown.
[...]
13:55:52.153 [main] INFO solarmaxcom.SolarMaxCom - PAC AC output: 138.0 W
13:55:52.154 [main] INFO solarmaxcom.SolarMaxCom - IDC Current DC: 0.51 A
13:55:52.155 [main] INFO solarmaxcom.SolarMaxCom - KMT Energy month: 3 kWh
13:55:52.155 [main] INFO solarmaxcom.SolarMaxCom - SWV Software version: 11200 
13:55:52.157 [main] INFO solarmaxcom.SolarMaxCom - TIME Time: 13:55:31 
13:55:52.158 [main] INFO solarmaxcom.SolarMaxCom - KYR Energy year: 10 kWh
13:55:52.158 [main] INFO solarmaxcom.SolarMaxCom - PRL Relative output: 5 %
13:55:52.159 [main] INFO solarmaxcom.SolarMaxCom - UL1 Voltage phase 1: 227.2 V
13:55:52.160 [main] INFO solarmaxcom.SolarMaxCom - IL1 Current phase 1: 0.85 A
13:55:52.160 [main] INFO solarmaxcom.SolarMaxCom - PDC DC input: 137.5 W
13:55:52.161 [main] INFO solarmaxcom.SolarMaxCom - UDC Voltage DC: 276.7 V
13:55:52.162 [main] INFO solarmaxcom.SolarMaxCom - TYP Type: SolarMax 2500SP 
13:55:52.162 [main] INFO solarmaxcom.SolarMaxCom - UD02 String 2 voltage: 0.0 V
13:55:52.163 [main] INFO solarmaxcom.SolarMaxCom - ID02 String 2 current: 0.00 A
13:55:52.163 [main] INFO solarmaxcom.SolarMaxCom - ADR Network address: 1 
13:55:52.163 [main] INFO solarmaxcom.SolarMaxCom - TKK Temperature power unit 1: 26 °C
13:55:52.165 [main] INFO solarmaxcom.SolarMaxCom - DATE Date: 2021-12-04 
13:55:52.166 [main] INFO solarmaxcom.SolarMaxCom - KHR Operating hours: 83 
13:55:52.167 [main] INFO solarmaxcom.SolarMaxCom - KDY Energy day: 0.7 kWh
13:55:52.167 [main] INFO solarmaxcom.SolarMaxCom - KT0 Energy total: 10 kWh
13:55:52.167 [main] INFO solarmaxcom.SolarMaxCom - ID01 String 1 current: 0.51 A
13:55:52.168 [main] INFO solarmaxcom.SolarMaxCom - UD01 String 1 voltage: 276.7 V
13:55:52.169 [main] INFO solarmaxcom.SolarMaxCom - PIN Installed capacity: 0.0 W
13:55:52.169 [main] INFO solarmaxcom.SolarMaxCom - Closing serial interface...

Now you can choose which data keys (PAC, IDC, KMT, ...) to read out. In order to read out AC output power and energy produced today / in total, use PAC, KDY and KT0. You can also set a MQTT broker to send this data to (localhost in this case) and repeat the readout every 5 seconds:

pi@raspi:~ $ java -jar solarmaxcom.jar -m localhost -r 5000 /dev/ttyUSB2 PAC,KT0,KDY
13:57:07.422 [main] INFO solarmaxcom.SolarMaxCom - Requesting keys; press Enter to break request loop.
13:57:07.715 [main] INFO solarmaxcom.SolarMaxCom - PAC AC output: 135.0 W
13:57:07.753 [main] INFO solarmaxcom.SolarMaxCom - KT0 Energy total: 10 kWh
13:57:07.761 [main] INFO solarmaxcom.SolarMaxCom - KDY Energy day: 0.7 kWh
13:57:12.764 [main] INFO solarmaxcom.SolarMaxCom - Requesting keys; press Enter to break request loop.
13:57:12.873 [main] INFO solarmaxcom.SolarMaxCom - PAC AC output: 133.0 W
13:57:12.877 [main] INFO solarmaxcom.SolarMaxCom - KT0 Energy total: 10 kWh
13:57:12.883 [main] INFO solarmaxcom.SolarMaxCom - KDY Energy day: 0.7 kWh
[...]

MQTT messages are sent with the topic solarmax/[device number]/[key]. In addition, the online status (whether the device answered at all) is sent as solarmax/[device number]/online:

pi@raspi:~ $ mosquitto_sub -v -t "solarmax/#"
solarmax/1/online 1
solarmax/1/PAC 135.0
solarmax/1/KT0 10
solarmax/1/KDY 0.7
solarmax/1/online 1
solarmax/1/PAC 133.0
solarmax/1/KT0 10
solarmax/1/KDY 0.7
[...]

Ethernet connection

Some SolarMax devices have an Ethernet port. This software currently cannot connect to these devices. As they use the same protocol, it should be easy to implement support for Ethernet-connected devices.

License

This project is licensed under the GNU General Public License, version 3 or later. For details see LICENSE.txt.

solarmaxcom's People

Contributors

t-pa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.