Giter VIP home page Giter VIP logo

solariot's Introduction

Solariot

Leverage your IoT enabled Solar PV Inverter to stream your solar energy usage data to a real time dashboard.

Solariot will connect directly to your Inverter using Modbus TCP.

Currently, Solariot is able to talk to a SMA Sunny Boy and Sungrow SH5K & SG5KD inverters. Solariot is designed to allow any Modbus TCP enabled inverter to be queried using a Modbus register map.

Data is collected and can be streamed to destinations like dweet.io, MQTT, InfluxDB or PVOutput. To visualise the telemetry, use a dashboard such as Grafana. For example, this is Meltaxa's Grafana dashboard on solariot.live:

Pre-requisites

  • The Inverter must be accessible on the network using TCP.

  • This Python script should work on most Inverters that talk Modbus TCP. You can customise your own modbus register file.

  • Run on Python 3.5+.

Installation

  1. Download or clone this repository to your local workstation.

    git clone https://github.com/meltaxa/solariot.git
    cd solariot
    
  2. Install the required libraries.

    pip install --upgrade -r requirements.txt
    
  3. Update the config.py with your values, such as the Inverter's IP address, port, inverter model (which corresponds to the modbus register file) and the register addresses Solariot should scan from. Enable optional support for MQTT, PVOutput, InfluxDB and more.

  4. Run the solariot.py script.

    ./solariot.py
    
    • Command line options:
    -c             Python module to load as our config. Default is config.py.
    -v             Level of verbosity 0=ERROR 1=INFO 2=DEBUG.
    --one-shot     Run Solariot just once then exit.
    

Docker

  1. Create a directory for the config file [config.py].

  2. Create a config.py (see config-example.py) and place it in the config directory.

  3. Run the Docker image with the volume switch to mount your config directory as /config in the image

    • docker run -v <localpath>:/config meltaxa/solariot

Note that the container runs as UID/GID 2000, so mounted config files will need to be readable. E.G.

chgrp 2000 $FILE # Set group of file to 2000
chown g+r $FILE # Allow group 2000 to read file

Next Steps

Now that you are collecting the inverter's data, you'll want to ultimately display it in a dashboard as seen above.

There are many methods to stream the data. Here are a few options, which can be enabled in Solariot.

Dweet.io and Freeboard

This is the quickest method and is a good place to start.

Metrics are streamed to dweet.io a free IoT messaging service. No sign up is required. All you need to do is create a unique identifier by updating the dweepy_uuid value in the config.py file.

Data can then be visualised using a free low-cost dashboard service from Freeboard. You'll need to create your own dashboard, using dweet.io as your data source.

MQTT Support

This is a good way to push data to MQTT topics that you might subscribe various tools such as Node-Red or Home Assistant to. Running your own MQTT server will mean you can also retrieve these values when your internet is offline.

All you need to do is to set the mqtt_server, mqtt_port, mqtt_username, mqtt_password and mqtt_topic values in config.py file and you'll be up and running.

InfluxDB and Grafana

Use a time series database such as InfluxDB to store the inverter data as it streams in. You'll need to install this on your own server.

To display the data in real time dashboard, you can use Grafana to pull the metrics from InfluxDB. You can either install your own Grafana server or use their free Grafana hosted solution.

A json export of solarspy.live Grafana dashboard is available under the grafana folder. The file will require editing to match your InfluxDb settings.

Prometheus and Grafana

Prometheus can be enabled in config.py by setting prometheus to true. the data will then be exported on the port specified by prometheus_port (defaults to 8000).

you can configure Prometheus to scrape this by adding a rule like this to your prometheus.yml

scrape_configs:
  - job_name: 'solariot'
    scrape_interval: 30s
    static_configs:
      - targets: ['localhost:8000']

alternatively if your using Kubernetes you can use this helm chart

PVOutput.org

We offer direct integration to publishing metrics to the 'Add Status' API endpoint of PVOutput.

Supported values are v1 through to v6 and an assumption that v1 and v3 are values are incremental and reset every day.

All you need to do is set the pvoutput_api, pvoutput_sid and pvoutput_rate_limit values in config.py file and you'll be publishing in no time!

Integration with PVOutput.org and Grafana

If you are using Grafana as your dashboard, a neat little trick is to then incorporate your Grafana panels with your PVOutput as system photos. From your PV Ladder page, click on your photos to view the real time Grafana images:

alt tag

  1. Obtain your Grafana panel direct link, see their documentation: http://docs.grafana.org/reference/sharing/#direct-link-rendered-image.

  2. In your PVOutput "Edit System" page, add your Grafana panel link in the "Image Link" field. Append "&png" to the link. Note, if the URL is longer than 100 characters, use a URL shortener service instead (such as https://goo.gl). Don't forget to append the "&png" string to your URL.

  3. Now go to your system in the PV Ladder page and click on the photos.

๐Ÿ’ก Tip: You can add any URL image, such as the latest weather radar image ๐Ÿ˜‰

Contributions

If you have created a modbus register map for an inverter, please submit your file as a pull request for Solariot inclusion.

Acknowledgements

  • michael-robbins for Docker support, modbus contrib and other improvements.
  • rpvelloso for the SungrowModbusTcpClient class that enables decryption of comms.
  • shannonpasto for the Sungrow SG3KD modbus map.
  • ShogunQld for the SMA Sunnuyboy modbus map.
  • zyrorl for MQTT support contrib.

solariot's People

Contributors

bohdan-s avatar breed808 avatar chainsawbike avatar meltaxa avatar michael-robbins avatar nmors avatar rark-ha avatar scottah avatar shogunqld avatar slackerlinux85 avatar zyrorl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solariot's Issues

Error loading config.py

I had everything setup and running fine for a few days.

Then it stopped logging, following investigation I found the issue:

pi@homebridge:~/solariot $ python3 --version
Python 3.5.2
pi@homebridge:~/solariot $ python3 ./solariot.py
  File "./solariot.py", line 69
    logging.info(f"Loaded config {config.model}")
                                               ^
SyntaxError: invalid syntax

I am not really familiar with Python but have had a poke around and can't seem to figure out what the issue is, any assistance would be appreciated?

Single run only

Enhancement to run solariot once and exit. Possible use case: could be used by cron to operate (ie. run) solariot during certain hours of the day.

Output to json format

Enhancement to send output to a file in json format. Use case could be for a telegraf process to ingest this as input.

can't get data into influxdb

I am running everything on a single centos 7 build. I have never used influxdb but I am fairly db savvy. I tried with and without authentication (turned it off and on in the /etc/influxdb/influxdb.conf file) I am using a 60k sungrove that has the same registers as your 5k and I am getting data back when I run the script.

[ERROR] 'ModbusIOException' object has no attribute 'registers'
{'5015': 7221, '5016': 25, '5018': 0, '5037': 985, 'pv1_current': 2.1, '5032': 0, '5031': 7373, 'second': 27, 'pv2_voltage': 713.5, 'year': 2019, 'total_pv_power': 7524, 'internal_temp': 38.5, 'day': 3, 'inverter_current': 9.8, '5023': 99, '5003': 5807, '5001': 600, 'grid_voltage': 285.6, '5007': 0, '5006': 8994, '5005': 3, '5004': 16914, '5021': 2848, '5020': 2840, '5009': 65535, 'month': 6, 'grid_frequency': 60.0, 'minute': 33, 'pv1_voltage': 700.0, 'hour': 18, 'pv2_current': 2.5}

I looked into the error but I don't know what address you are referring to. Also it seems to be getting the correct data regardless. Looking in the db shows there is absolutely nothing being recorded. Any thought or tips on what I can look at?

FYI Super awesome stuff. If I can get it going, I will put a bunch of modbus files up here (I have access to quite a few different inverters)

Cumulative flag

Hi.

For some time now I've been seeing an issue where the energy generation (v1) on PV Output was alway 100Wh behind what the API was sending (and telemetry). There was also a period of time from when the first 100W of power generation was sent via the API to when it would register on PV Output. I reached out to PV Output forum and after some investigation it turns out the cumulative flag (c1=1) has been the cause of this. As you'll see in the last post by bankstownbloke the c1=1 flag should only be used when sending lifetime values. As I'm using a modified version of the SG5K-D modbus map for my SG3K-D I would assume that anyone who does the same will be in the same situation as myself, that is v1 is not lifetime, just daily. The only lifetime value I can see is total_power_yield which is not used in the API. Currently I have commented out c1 in the parameters section but I'm hoping you might be able to do something within the script. As I don't have a smart meter (I have one on order) this may change but I think you mentioned somewhere that you did have one so it may be worth looking into a bit more...I will when I have mine installed.

There's more info on the PV Output forum and I'm also happy to share any API data that I captured.

Cheers,
Shannon

Raspberry pi failure

Hi

I have a raspberry pi running raspbian with grafana/influxdb installed and I tried to run the script and I get the following error

root@grafpi:~/sunnyboy/solariot# ./solariot.py
Traceback (most recent call last):
File "./solariot.py", line 40, in
print "Load config %s" % config.model
AttributeError: 'module' object has no attribute 'model'

Some stuff that might help I hope
Requirements were installed as per "pip install -r requirements.txt"
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

Solariot + SMA Inverters xx000TL-20

Hello!
I'm trying to get the whole thing up and running with two SMA inverters.
Have the STP 9000TL-20 and 8000TL-20 here.
I have built myself a suitable py file - linked below - but this doesn't seem to work that way.
When I run it, I get the following message:

root@ctSolariot:/opt/solariot# ./solariot.py -v
INFO:root:Loaded config sma-inverter-xx000tl-20
INFO:root:Creating ModbusTcpClient
INFO:root:Connecting
INFO:root:Connected
INFO:root:No MQTT configuration detected
INFO:root:No Prometheus configuration detected
INFO:root:No InfluxDB configuration detected
INFO:root:No PVOutput configuration detected
Traceback (most recent call last):
  File "/opt/solariot/./solariot.py", line 605, in <module>
    success = scrape_inverter()
  File "/opt/solariot/./solariot.py", line 592, in scrape_inverter
    load_sma_register(modmap.sma_registers)
  File "/opt/solariot/./solariot.py", line 447, in load_sma_register
    message = BinaryPayloadDecoder.fromRegisters(
TypeError: fromRegisters() got an unexpected keyword argument 'endian'

From python I have unfortunately not yet so much ahnung. :(

modbus-sma-inverter-xx000tl-20.zip

Home Assistant - MQTT Broker - Socket Error

Hi There,

I'm helping a mate connect his Solar Invertor to HA via MQTT, I've setup Solariot via Docker and can confirm it's connected and can see in the logs it's pulling data from the invertor etc.

However it's pushing to MQTT broker however it's claiming there is a socket error

1621386684: New client connected from 192.168.1.111 as pv_data (p2, c1, k60, u'xxxxxx').
1621386695: Socket error on client pv_data, disconnecting

googling it looks like it's an error within the solariot code but I'm not really clear if this is correct? something about a unique ID.

Any advice would be appreciated.

SG5K-D No data extracted

nmap -p- 172.16.50.116

PORT    STATE SERVICE
80/tcp  open  http
502/tcp open  mbap

cat config.py

inverter_ip = "172.16.50.116"
inverter_port = 502
# Slave Defaults
# Sungrow: 0x01
# SMA: 3
slave = 0x01
model = "sungrow-sh5k"
timeout = 5
scan_interval = 30
# Optional:
dweepy_uuid = "random-uuid"
# Optional:
influxdb_ip = "192.168.1.128"
influxdb_port = 8086
influxdb_user = "user"
influxdb_password = "password"
influxdb_database = "inverter"
influxdb_ssl = True
influxdb_verify_ssl = False
# Optional
mqtt_server = "192.168.1.128"
mqtt_port = 1883
mqtt_topic = "inverter/stats"
mqtt_username = "user"
mqtt_password = "password"

Returns:

./solariot.py                 
Load config sungrow-sh5k
Load SungrowModbusTcpClient
Connect
[WARN] No data. Try increasing the timeout or scan interval.
[WARN] No data. Try increasing the timeout or scan interval.
[WARN] No data. Try increasing the timeout or scan interval.

I have tried to increase timeout and scan_interval but is gives same output...

I am happy to help investigate but not sure where to start...

Not working with InfluxDB 2.0

Hi, when I try to use this with influxDB 2.0 with solariot hosted in docker, the problem I run into is it can't write to the DB as it keeps saying it is unauthorised. This is the error I get: "influxdb.exceptions.InfluxDBClientError: 401: {"code":"unauthorized","message":"Unauthorized"}"

How should I update the config.py to be able to authenticate with influxdb 2.0?

RPi4 HA Docker - MQTT No sensor/intergration - modbus proxy?

Hi guys. great project, this is the only option I could find that will work with my SG5KD, as there is no useable lan port (is there one inside the unit??) I have the smart meter connected to my other port which reads my grid data (SG Smart Meter_002_001)

I'm not very code friendly. but I have managed to create my docker file and integrate to HA Core on my Rpi4. with my following command.

sudo docker run -v -d --name solariot --restart=unless-stopped -v /home/xxx/solariot:/config --network=host meltaxa/solariot:latest

inverter_ip = "192.168.xx.xxx" inverter_port = 502 slave = 0x01 model = "sungrow-sg5kd" timeout =5 scan_interval =30

It takes a lot of effort to get connected. I have to keep restarting my container and maybe once an hour (retrying to connect 50 times or more) I can connect. but if I restart my rpi or the container I have to spend forever to connect again. what is causing this? but when it does connect its great! could we look into something like a proxy -- https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/wiki/FAQ:-My-Modbus-connection-always-cuts-out

WARNING:root:Modbus connection failed WARNING:root:Failed to scrape inverter, sleeping until next scan

anyway..

I can read the logs from inside Portainer interface which is working great!

INFO:root:{'daily_power_yield': 2900.0, 'total_power_yield': 447.73, 'internal_temp': 41.9, 'pv1_voltage': 301.1, 'pv1_current': 3.7, 'pv2_voltage': 305.9, 'pv2_current': 3.7, 'total_pv_power': 2262, 'grid_voltage': 244.8, 'inverter_current': 9.5, 'total_active_power': 2262, 'grid_frequency': 50.0, 'export_power': -325, 'export_power_indicator': 65535, 'power_meter': 1936, 'daily_purchased_energy': 9.1, 'daily_energy_consumption': 2600.0, 'total_energy_consumption': 779.2, 'year': 2024, 'month': 1, 'day': 31, 'hour': 8, 'minute': 48, 'second': 31, 'timestamp': '31/1/2024 8:48:31'} INFO:root:Published to MQTT INFO:root:{'daily_power_yield': 2900.0, 'total_power_yield': 447.73, 'internal_temp': 41.8, 'pv1_voltage': 301.2, 'pv1_current': 3.6, 'pv2_voltage': 304.0, 'pv2_current': 3.6, 'total_pv_power': 2216, 'grid_voltage': 244.6, 'inverter_current': 9.3, 'total_active_power': 2216, 'grid_frequency': 50.0, 'export_power': -274, 'export_power_indicator': 65535, 'power_meter': 1941, 'daily_purchased_energy': 9.1, 'daily_energy_consumption': 2600.0, 'total_energy_consumption': 779.2, 'year': 2024, 'month': 1, 'day': 31, 'hour': 8, 'minute': 48, 'second': 38, 'timestamp': '31/1/2024 8:48:38'} INFO:root:Published to MQTT

I can also receive the MQTT messages within HA Core MQTT Listen setting:

{ "daily_power_yield": 3300, "total_power_yield": 447.73, "internal_temp": 44, "pv1_voltage": 300.9, "pv1_current": 4.1, "pv2_voltage": 305.4, "pv2_current": 4.1, "total_pv_power": 2500, "grid_voltage": 243.9, "inverter_current": 10.4, "total_active_power": 2420, "grid_frequency": 50, "export_power": 825, "export_power_indicator": 0, "power_meter": 3245, "daily_purchased_energy": 9.1, "daily_energy_consumption": 2900, "total_energy_consumption": 779.5, "year": 2024, "month": 1, "day": 31, "hour": 8, "minute": 55, "second": 41, "timestamp": "31/1/2024 8:55:41" }

I'm just really stuck on the next part to add this data to HA in a useful way within the energy tab. could anyone shed some light. (reminder I do not have the add-on page as core)

other that that this is fantastic! thanks very much for all your time and effort.

p.s is there also a way to link and change the requirements.txt to my /home/xxx/solariot/ directory to be able to edit that and build with different versions. ex pymodbus==2.4.0 (this is as I am using docker image on rpi4. or is this not an issue anymore?

Use SungrowModbusTcpClient to read encrypted comms

These are my findings from my inverter. Sorry, it is not an issue but more information.

Sungrow SH5K-20 ย 
ย  "5001",
ย  "5003",
ย  "5004",
ย  "5005",
ย  "5006",
ย  "5007",
ย  "internal_temp_10",
ย  "5009",
ย  "pv1_voltage_10",
ย  "pv1_current_10",
ย  "pv2_voltage_10",
ย  "pv2_current_10",
ย  "5015",
ย  "5016",
13011 "total_pv_power",
ย  "5018",
ย  "grid_voltage_10",
ย  "5020",
ย  "5021",
13030 "inverter_current_10",
ย  "5023",
ย  "5031",
ย  "5032",
ย  "grid_frequency_10",
ย  "5037",
ย  "running_state",
13001 "daily_pv_energy_10",
ย  "total_pv_energy_10",
ย  "13004",
ย  "daily_export_energy_10",
13005 "total_export_energy_10",
ย  "13007",
13007 "load_power",
ย  "13009",
13008 "export_power",
ย  "grid_import_or_export",
13039 "daily_charge_energy_10",
ย  "total_charge_energy_10",
ย  "13014",
ย  "co2_emission_reduction",
ย  "13016",
ย  "daily_use_energy_10",
ย  "total_use_energy_10",
ย  "13019",
13019 "battery_voltage_10",
13020 "battery current_10",
13021 "battery_power",
13022 "battery_level_10",
13023 "battery_health_10",
13024 "battery_temp_10",
ย  "daily_discharge_energy_10",
ย  "total_discharge_energy_10",
ย  "13028",
ย  "use_power",
ย  "13030",
ย  "inverter_current_10",
ย  "13032",
ย  "13033",
13033 "pv_power"

Github Actions integration

If I was to PR a Github Actions file that built and published a docker image... how would that sound?

We can publish either to githubs docker image registry or to docker hub as well (or both!)

python 3.9.2 issues?

Hi.

I recently setup a new debian 11 server and I've been having issues with running this. On my old server (pi4/python 3.7.2) it executes successfully first time, every time. Running the same version (and even a new clone of the repor) on debian 11 it takes 1 or 2 scrapes before it successfully runs. I get the following error...

WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan
ERROR:pymodbus.factory:Unable to decode response Modbus Error: Unknown response 0
ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pymodbus/transaction.py", line 190, in execute
self.client.framer.processIncomingPacket(response,
File "/usr/local/lib/python3.9/dist-packages/pymodbus/framer/socket_framer.py", line 165, in processIncomingPacket
self._process(callback, error=True)
File "/usr/local/lib/python3.9/dist-packages/pymodbus/framer/socket_framer.py", line 175, in _process
raise ModbusIOException("Unable to decode request")
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan

The pi does have pymodbus 2.5.1 installed. I tried this version and v2.4.0 with a clean git pull and the issue continues. Ultimately it does successfully scrape but as I run the project as --one-shot in cron it generates an email at every execution.

The only difference so far is the version of python. Any thoughts?

Cheers

ValueError: AES key must be either, 24, or 32 bytes lon 16g

Environment: Sungrow Inverter SG8K-D with Wifi Adaptor. Raspi8 with Python 3.8.
Port 502 accessible by scanning.
Error: ValueError: AES key must be either, 24, or 32 bytes lon 16g

I have attempted to re-install and update all dependencies with no errors.

./solariot.py
Load config sungrow-sh5k
Load SungrowModbusTcpClient
Connect
Traceback (most recent call last):
File "./solariot.py", line 77, in
client.connect()
File "/solariot/SungrowModbusTcpClient.py", line 32, in connect
self._getkey()
File "/solariot/SungrowModbusTcpClient.py", line 22, in _getkey
self._aes_ecb = AES.new(self._key, AES.MODE_ECB)
File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/AES.py", line 94, in new
return AESCipher(key, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/AES.py", line 59, in init
blockalgo.BlockAlgo.init(self, _AES, key, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py", line 141, in init
self._cipher = factory.new(key, *args, **kwargs)
ValueError: AES key must be either, 24, or 32 bytes lon 16g

`inverter_ip = "10.1.1.7"
inverter_port = 502

Slave Defaults

Sungrow: 0x01

SMA: 3

slave = 0x01
model = "sungrow-sh5k"
timeout = 3
scan_interval = 10

Optional:

dweepy_uuid = "random_solar_thing"

Optional:

influxdb_ip = "192.168.1.128"
influxdb_port = 8086
influxdb_user = "user"
influxdb_password = "password"
influxdb_database = "inverter"
influxdb_ssl = True
influxdb_verify_ssl = False

Optional

mqtt_server = "192.168.1.128"
mqtt_port = 1883
mqtt_topic = "inverter/stats"
mqtt_username = "user"
mqtt_password = "password"
`

WiFi vs Ethernet

I had my inverter connected via Wi-Fi until I had time to run an ethernet cable to it. Switched it over to an ethernet connection and iCloudsolar etc continued to work without issue.

But solaroit.py kept reporting 'Modbus connection failed' and 'Failed to scrape inverter, sleeping until next scan' in the log file.

I'd updated the config.py to the ethernet ip address but it didn't work still. I could run a Modbus poll from another machine without any issue.

Also tried;

  • Restarting the docker container
  • Resetting and starting again with the docker container
  • Turning off WiFi via the local web interface for the inverter
  • Moving the ethernet IP back to the original WiFi one (and update config.py)
  • I could ping and telnet into the ip/port from the docker machine
  • If I changed IP (without updating the config.py) the log would give me 'Connection to (192.168.20.42, 502) failed: [Errno 111] Connection refused' so it was connecting to the ip address previously

I turned wifi back on (and ethernet still on), pointed config.py to the wifi ip, and it started working again.

Why the issue with ethernet?

pv_power & total_pv_power dont seem mapped correctly

Hi

Just got your script working and was studying the data locally coming through and comparing with whats on screen. As a reference I have a battery attached to a Sungrow SH5K.

When looking at the data being pulled, its after 9pm so battery draining, I can see the values for pv_power is the same as the battery power value, and the total_pv_power is 0.

I've changed the mapping for myself for now so that pv_power is called inverter_power.

No big deal if you don't have a battery hooked up but just thought others might find this info handy.

BTW: Thanks for the script this is brilliant. I'm going to use this as the basis for a Home_assistant plugin if that's ok.

Cheers
Mark

Support for SB3.0-1AV-41 224

Hi Meltaxa,

I have a SMA SB3.0-1AV-41 and am trying to get your solution to work.
Configuration towards influb works great but i need some help with the modbus config for my inverter.

do have any idea of the SB3.0-1AV-41 224 could work?

Modbus mappings for S100 power meter 'history'

So for my Sungrow SG5K-D + S100 energy meter when the solar is low enough, the inverter shuts off and the modbus cannot be scraped anymore (Wifi dongle shuts off with it).

But when the inverter turns back on every morning when the sun rises the iSolarcloud app magically has all the history of the overnight power usage of the house.

So that means (most likely?) that there's possibly more modbus read registers that contain this? Or would this be some other sort of proprietary storage/replay of the overnight data?

Wondering if there's some sort of way to read this data out and 'replay' it to any of our other external integrations (mqtt/pvoutput/etc)

WARNING:root:Failed to scrape inverter, sleeping until next scan

Hi.

I've started seeing the following error after upgrading the repo.

INFO:root:Loaded config sungrow-sg5kd
INFO:root:Creating SungrowModbusTcpClient
INFO:root:Connecting
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 40441)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 48495)
INFO:root:Connected
INFO:root:No MQTT configuration detected
INFO:root:No Prometheus configuration detected
INFO:root:No InfluxDB configuration detected
INFO:root:Configured PVOutput Client
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 59731)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 44457)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 33161)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 60073)
DEBUG:pymodbus.transaction:Current transaction state - IDLE
DEBUG:pymodbus.transaction:Running transaction 1
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 43245)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 46709)
DEBUG:pymodbus.transaction:SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Transaction failed. ([Errno 104] Connection reset by peer)
DEBUG:pymodbus.framer.socket_framer:Processing:
DEBUG:pymodbus.transaction:Getting transaction 1
DEBUG:pymodbus.transaction:Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 48387)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 36045)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 50981)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 36889)
DEBUG:pymodbus.transaction:Current transaction state - TRANSACTION_COMPLETE
DEBUG:pymodbus.transaction:Running transaction 2
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 58809)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 55761)
DEBUG:pymodbus.transaction:SEND: 0x0 0x2 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
DEBUG:pymodbus.transaction:RECV: 0x0
DEBUG:pymodbus.framer.socket_framer:Processing: 0x0
DEBUG:pymodbus.factory:Factory Response[0]
ERROR:pymodbus.factory:Unable to decode response Modbus Error: Unknown response 0
ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request
Traceback (most recent call last):
File "/usr/local/.venv/lib/python3.11/site-packages/pymodbus/transaction.py", line 208, in execute
self.client.framer.processIncomingPacket(response,
File "/usr/local/.venv/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 165, in processIncomingPacket
self._process(callback, error=True)
File "/usr/local/.venv/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process
raise ModbusIOException("Unable to decode request")
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan
^CTraceback (most recent call last):
File "/root/solariot/./solariot.py", line 612, in
time.sleep(config.scan_interval)

I can confirm that the inverter is available...

root@debone:~/solariot# telnet 172.16.100.77 502
Trying 172.16.100.77...
Connected to 172.16.100.77.
Escape character is '^]'.

I suspect this has something to do with the version of SungrowModbusTcpClient but I am unable to downgrade due to issues with pycrypto.

I'm running this on Debian 12

Any ideas what might be causing this?

Thanks

ERROR:pymodbus.factory:unpack requires a buffer of 4 bytes

Hello! I use the solariot with Sungrow SH6-0RT inverter and mqtt. Inverter and raspberry are in the same LAN, mqtt server ist remote.

Works fine for some time, I can get messages from mqtt. Then the script is stuck in the following error loop:

ERROR:pymodbus.factory:unpack requires a buffer of 4 bytes
ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pymodbus/transaction.py", line 207, in execute
    self.client.framer.processIncomingPacket(response,
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pymodbus/framer/socket_framer.py", line 165, in processIncomingPacket
    self._process(callback, error=True)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process
    raise ModbusIOException("Unable to decode request")
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan

My config.py:

inverter_ip = "192.168.178.125"
inverter_port = 502
# Slave Defaults
# Sungrow: 0x01
# SMA: 3
slave = 0x01
model = "sungrow-sh5k"
timeout = 3
scan_interval = 10

# Optional:
dweepy_uuid = "random-uuid"

# Optional
mqtt_server = "mqtt.domain.tld"
mqtt_port = 1883
mqtt_topic = "inverter/stats"
mqtt_username = "xxx"
mqtt_password = "xxx"

Compatibility with SG6K-D inverter

Hi,

I have a sungrow inverter (model SG6K-D) and I want to know if I can use this script (with modbus-sungrow-sh5k.py values).
I don't know if I could explain, but how do I use this script with SG6K-D inverter ? Can I use the config.py with model = "sungrow-sh5k" ?

Thanks

unable to decode modbus response

DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 54241)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 56349)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 42925)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 48907)
DEBUG:pymodbus.transaction:Current transaction state - IDLE
DEBUG:pymodbus.transaction:Running transaction 1
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 53489)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 41505)
DEBUG:pymodbus.transaction:SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Transaction failed. ([Errno 104] Connection reset by peer)
DEBUG:pymodbus.framer.socket_framer:Processing:
DEBUG:pymodbus.transaction:Getting transaction 1
DEBUG:pymodbus.transaction:Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 54319)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 40039)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 37303)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 59533)
DEBUG:pymodbus.transaction:Current transaction state - TRANSACTION_COMPLETE
DEBUG:pymodbus.transaction:Running transaction 2
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 50211)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.250', 46091)
DEBUG:pymodbus.transaction:SEND: 0x0 0x2 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
DEBUG:pymodbus.transaction:RECV: 0x0
DEBUG:pymodbus.framer.socket_framer:Processing: 0x0
DEBUG:pymodbus.factory:Factory Response[0]
ERROR:pymodbus.factory:Unable to decode response Modbus Error: Unknown response 0
ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request

WARNING:Modbus connection failed WARNING:Failed to scrape inverter, sleeping until next scan

Hi,

I have seen the previous questions/answers relating to the discussuions #34 and #48, and although I downgraded pymodbus, I still get the warnings for more than half the attempts to connect to the inverter and it normally occurs in sequences of say 5-6 failed attempts in a row.

One thing I found that may provide a reason is that it only occurs when I'm running my code in Debian Linux on my Laptop (which doubles as my Plex server).

When I run the same code in parallel on my Windows 11 PC through PYCharm, I'm lucky to get 1 in 30 attempts produce a warning.

Linux
45714.653348
WARNING:Modbus connection failed
WARNING:Failed to scrape inverter, sleeping until next scan
45773.712014
WARNING:Modbus connection failed
WARNING:Failed to scrape inverter, sleeping until next scan
45832.740916
WARNING:Modbus connection failed
WARNING:Failed to scrape inverter, sleeping until next scan
45891.819905
WARNING:Modbus connection failed
WARNING:Failed to scrape inverter, sleeping until next scan
45958.880418
WARNING:Modbus connection failed
WARNING:Failed to scrape inverter, sleeping until next scan

Windows
48417.061711
now.minute 26
48476.695655
now.minute 27
48536.333087
now.minute 28
48596.128118
now.minute 29
48655.688589
now.minute 30

The 'now.minute' is a print statement in both the Linux and Windows codes, but because the Linux one failed to connect, it restarts it's main loop and doesn't get to my 'now.minute' print statement.

I think this is quite significant and seems to point at an underlying Linux related issue.

Understanding the lower level communication methods/libraries of Linux or Windows is beyond my knowledge, but if someone has any ideas of why the same code is failing (50% of the time) on a Linux machine compared to never on a Windows machine, I'd be keen to understand why and it may resolve some others issues as as well.

Thanks,

KISA

Failed to scrape inverter: sg8kd

I think it is connecting correctly to the inverter. Here is my config.py:

inverter_ip = "192.168.4.45"
inverter_port = 8082
slave = 0x01
model = "sungrow-sg8kd"
timeout = 10
scan_interval = 30

Log:

INFO:root:Loaded config sungrow-sg8kd
INFO:root:Creating SungrowModbusWebClient
INFO:root:Connecting
INFO:root:Connected
INFO:root:No MQTT configuration detected
INFO:root:No Prometheus configuration detected
INFO:root:Configured InfluxDB Client
INFO:root:No PVOutput configuration detected
WARNING:root:No data. Try increasing the timeout or scan interval.
WARNING:root:Failed to scrape inverter, sleeping until next scan

Command errored out with exit status 1

Hi, Sorry - I have next to no idea what I'm doing.

I've attempted to install this on a Linux Virtual Machine. Is that possible?
I got to this point...

image

How to create a new device from template

Hi,

I've seen that in the config example an inverter model is expected. As the inverter I have is not in the list I supose I have to create my own inverter_model.py with the configuration.

However, looking at the configuration on the SMA and Sungrow inverters I can see that there's not a pattern to be followed in terms of variables necessary and its structure.

So the question is, do you have a more specific template on how to create a new inverter?

'ModbusIOException' object has no attribute 'registers'

Hello! Thanks for a publishing your great script. It's very helpful.

I noticed a few things and have a question:

  1. Grafana dashboard and script is hardcoded with "location=Gabba". I added a variable and all good. (I'm in Herston!).
  2. I got a [ERROR] 'grid_import_or_export' as (sometimes) the inverter object doesn't contain it. I just added a check (2nd line):
  if config.model == "sungrow-sh5k" and \
        'grid_import_or_export' in inverter and \
        inverter['grid_import_or_export'] == 65535:

My question is how to fix the remaining errors I get (copied below).Note that sometimes it works (in that I get a non-empty "inverter" object and a write to InfluxDB). Sometimes it aborts with:

[ERROR] 'ModbusIOException' object has no attribute 'registers'
[ERROR] 'ModbusIOException' object has no attribute 'registers'
[ERROR] 'ModbusIOException' object has no attribute 'registers'
{}
Exception in thread Thread-10:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "./solariot.py", line 172, in publish_influx
target=flux_client.write_points([metrics])
File "/home/bbeeson/.local/lib/python2.7/site-packages/influxdb/client.py", line 490, in write_points
tags=tags, protocol=protocol)
File "/home/bbeeson/.local/lib/python2.7/site-packages/influxdb/client.py", line 551, in _write_points
protocol=protocol
File "/home/bbeeson/.local/lib/python2.7/site-packages/influxdb/client.py", line 327, in write
headers=headers
File "/home/bbeeson/.local/lib/python2.7/site-packages/influxdb/client.py", line 286, in request
raise InfluxDBClientError(response.content, response.status_code)
InfluxDBClientError: 400: {"error":"unable to parse 'Sungrow,location=Gabba ': invalid field format"}

UTF-8 error

SMA SB3.6-1AV-41 Firmware 3.0.7R + Python 2.7/3.7 (Debian 10 Buster)

Error:

Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "solariot.py", line 177, in publish_influx
target=flux_client.write_points([metrics])
File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 530, in write_points
consistency=consistency)
File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 598, in _write_points
protocol=protocol
File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 331, in write
data = make_lines(data, precision).encode('utf-8')
File "/usr/local/lib/python2.7/dist-packages/influxdb/line_protocol.py", line 158, in make_lines
value = _escape_value(field_value)
File "/usr/local/lib/python2.7/dist-packages/influxdb/line_protocol.py", line 94, in _escape_value
value = _get_unicode(value)
File "/usr/local/lib/python2.7/dist-packages/influxdb/line_protocol.py", line 109, in _get_unicode
return data.decode('utf-8')
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 24: invalid start byte

my config:

inverter_ip = "192.168.178.21"
inverter_port = 502

slave = 3
model = "sma-SBn_n-1AV-40"
timeout = 3
scan_interval = 10

influxdb_ip = ""
influxdb_port = 8086
influxdb_user = "
"
influxdb_password = "
***"
influxdb_database = "inverter3"
influxdb_ssl = False
influxdb_verify_ssl = False

MQTT Broker Authentication

Great work with incorporating the modbus decryption in to your script. Note that you just need to add an extra line in for MQTT broker authentication to work.

try:
mqtt_client = mqtt.Client('pv_data')
mqtt.username_pw_set(config.mqtt_username,config.mqtt_password)
mqtt_client.connect(config.mqtt_server, port=config.mqtt_port)
except:
mqtt_client = None

Error during required libraries install

Sorry I'm not experienced with Python so not sure what else to add but this is the full output

C:\Users\Administrator\Documents\Solariot>pip install -r requirements.txt
WARNING: Value for scheme.headers does not match. Please report this to pypa/pip#9617
distutils: c:\users\administrator\appdata\local\programs\python\python39\Include\UNKNOWN
sysconfig: c:\users\administrator\appdata\local\programs\python\python39\Include
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Collecting paho-mqtt>=1.4.0
Using cached paho-mqtt-1.5.1.tar.gz (101 kB)
Requirement already satisfied: pymodbus>=1.3.2 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (line 2)) (2.5.1)
Collecting dweepy>=0.3.0
Using cached dweepy-0.3.0.tar.gz (8.1 kB)
Collecting influxdb>=2.17.0
Using cached influxdb-5.3.1-py2.py3-none-any.whl (77 kB)
Requirement already satisfied: python_dateutil>=2.6.1 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (line 5)) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (line 6)) (2021.1)
Collecting pycrypto>=2.6.1
Using cached pycrypto-2.6.1.tar.gz (446 kB)
Collecting SungrowModbusTcpClient>=0.1.2
Using cached SungrowModbusTcpClient-0.1.5-py3-none-any.whl (3.6 kB)
Requirement already satisfied: six>=1.15.0 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from pymodbus>=1.3.2->-r requirements.txt (line 2)) (1.15.0)
Requirement already satisfied: pyserial>=3.4 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from pymodbus>=1.3.2->-r requirements.txt (line 2)) (3.5)
Requirement already satisfied: requests<3,>=2 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from dweepy>=0.3.0->-r requirements.txt (line 3)) (2.25.1)
Collecting msgpack
Using cached msgpack-1.0.2-cp39-cp39-win_amd64.whl (68 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->dweepy>=0.3.0->-r requirements.txt (line 3)) (1.26.4)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->dweepy>=0.3.0->-r requirements.txt (line 3)) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->dweepy>=0.3.0->-r requirements.txt (line 3)) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->dweepy>=0.3.0->-r requirements.txt (line 3)) (2020.12.5)
Using legacy 'setup.py install' for paho-mqtt, since package 'wheel' is not installed.
Using legacy 'setup.py install' for dweepy, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pycrypto, since package 'wheel' is not installed.
Installing collected packages: pycrypto, msgpack, SungrowModbusTcpClient, paho-mqtt, influxdb, dweepy
Running setup.py install for pycrypto ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\administrator\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Administrator\AppData\Local\Temp\2\pip-install-081hz3m7\pycrypto_eefffd170dfb40a3b7fe2c7484cc70b6\setup.py'"'"'; file='"'"'C:\Users\Administrator\AppData\Local\Temp\2\pip-install-081hz3m7\pycrypto_eefffd170dfb40a3b7fe2c7484cc70b6\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator\AppData\Local\Temp\2\pip-record-dtko60m6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\administrator\appdata\local\programs\python\python39\Include\pycrypto'
cwd: C:\Users\Administrator\AppData\Local\Temp\2\pip-install-081hz3m7\pycrypto_eefffd170dfb40a3b7fe2c7484cc70b6
Complete output (183 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\Crypto
copying lib\Crypto\pct_warnings.py -> build\lib.win-amd64-3.9\Crypto
copying lib\Crypto_init_.py -> build\lib.win-amd64-3.9\Crypto
creating build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\hashalgo.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\HMAC.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\MD2.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\MD4.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\MD5.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\RIPEMD.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\SHA.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\SHA224.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\SHA256.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\SHA384.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash\SHA512.py -> build\lib.win-amd64-3.9\Crypto\Hash
copying lib\Crypto\Hash_init_.py -> build\lib.win-amd64-3.9\Crypto\Hash
creating build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\AES.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\ARC2.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\ARC4.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\blockalgo.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\Blowfish.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\CAST.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\DES.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\DES3.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_OAEP.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_v1_5.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher\XOR.py -> build\lib.win-amd64-3.9\Crypto\Cipher
copying lib\Crypto\Cipher_init_.py -> build\lib.win-amd64-3.9\Crypto\Cipher
creating build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\asn1.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\Counter.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\number.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\py3compat.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\randpool.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\RFC1751.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util\winrandom.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util_number_new.py -> build\lib.win-amd64-3.9\Crypto\Util
copying lib\Crypto\Util_init_.py -> build\lib.win-amd64-3.9\Crypto\Util
creating build\lib.win-amd64-3.9\Crypto\Random
copying lib\Crypto\Random\random.py -> build\lib.win-amd64-3.9\Crypto\Random
copying lib\Crypto\Random_UserFriendlyRNG.py -> build\lib.win-amd64-3.9\Crypto\Random
copying lib\Crypto\Random_init_.py -> build\lib.win-amd64-3.9\Crypto\Random
creating build\lib.win-amd64-3.9\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaAccumulator.py -> build\lib.win-amd64-3.9\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaGenerator.py -> build\lib.win-amd64-3.9\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\SHAd256.py -> build\lib.win-amd64-3.9\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna_init_.py -> build\lib.win-amd64-3.9\Crypto\Random\Fortuna
creating build\lib.win-amd64-3.9\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\fallback.py -> build\lib.win-amd64-3.9\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\nt.py -> build\lib.win-amd64-3.9\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\posix.py -> build\lib.win-amd64-3.9\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\rng_base.py -> build\lib.win-amd64-3.9\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG_init_.py -> build\lib.win-amd64-3.9\Crypto\Random\OSRNG
creating build\lib.win-amd64-3.9\Crypto\SelfTest
copying lib\Crypto\SelfTest\st_common.py -> build\lib.win-amd64-3.9\Crypto\SelfTest
copying lib\Crypto\SelfTest_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\common.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_AES.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC2.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC4.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_Blowfish.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_CAST.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES3.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_15.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_oaep.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_XOR.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Cipher
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\common.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_HMAC.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD2.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD4.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD5.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_RIPEMD.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA224.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA256.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA384.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA512.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Hash
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_AllOrNothing.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_chaffing.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_KDF.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_rfc1751.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Protocol
creating build\lib.win-amd64-3.9\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_DSA.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_ElGamal.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_importKey.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_RSA.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\PublicKey
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_random.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_rpoolcompat.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test__UserFriendlyRNG.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaAccumulator.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaGenerator.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_SHAd256.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\Fortuna copying lib\Crypto\SelfTest\Random\Fortuna_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\Fortuna
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_fallback.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_generic.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_nt.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_posix.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_winrandom.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Random\OSRNG
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_asn1.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_Counter.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_number.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_winrandom.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Util
creating build\lib.win-amd64-3.9\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_15.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_pss.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature_init_.py -> build\lib.win-amd64-3.9\Crypto\SelfTest\Signature
creating build\lib.win-amd64-3.9\Crypto\Protocol
copying lib\Crypto\Protocol\AllOrNothing.py -> build\lib.win-amd64-3.9\Crypto\Protocol
copying lib\Crypto\Protocol\Chaffing.py -> build\lib.win-amd64-3.9\Crypto\Protocol
copying lib\Crypto\Protocol\KDF.py -> build\lib.win-amd64-3.9\Crypto\Protocol
copying lib\Crypto\Protocol_init_.py -> build\lib.win-amd64-3.9\Crypto\Protocol
creating build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey\DSA.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey\ElGamal.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey\pubkey.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey\RSA.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey_DSA.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey_RSA.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey_slowmath.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
copying lib\Crypto\PublicKey_init_.py -> build\lib.win-amd64-3.9\Crypto\PublicKey
creating build\lib.win-amd64-3.9\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_PSS.py -> build\lib.win-amd64-3.9\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_v1_5.py -> build\lib.win-amd64-3.9\Crypto\Signature
copying lib\Crypto\Signature_init_.py -> build\lib.win-amd64-3.9\Crypto\Signature
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -Ic:\users\administrator\appdata\local\programs\python\python39\include -Ic:\users\administrator\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.9\Release\src/winrand.obj
winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(31): error C2061: syntax error: identifier 'intmax_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(32): error C2061: syntax error: identifier 'rem'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(32): error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(33): error C2059: syntax error: '}'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(35): error C2061: syntax error: identifier 'imaxdiv_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(35): error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(45): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2146: syntax error: missing ')' before identifier '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2061: syntax error: identifier '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(47): error C2059: syntax error: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(50): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2146: syntax error: missing ')' before identifier '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2061: syntax error: identifier '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2059: syntax error: ','
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(53): error C2059: syntax error: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(55): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(61): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(68): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(74): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(81): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(87): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(94): error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(100): error C2143: syntax error: missing '{' before '__cdecl'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\administrator\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Administrator\AppData\Local\Temp\2\pip-install-081hz3m7\pycrypto_eefffd170dfb40a3b7fe2c7484cc70b6\setup.py'"'"'; file='"'"'C:\Users\Administrator\AppData\Local\Temp\2\pip-install-081hz3m7\pycrypto_eefffd170dfb40a3b7fe2c7484cc70b6\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator\AppData\Local\Temp\2\pip-record-dtko60m6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\administrator\appdata\local\programs\python\python39\Include\pycrypto' Check the logs for full command output.

Adding in the custom user to the Dockerfile broke existing permissions

Just noticed my solariot image has been crashing in a loop since the introduction of the custom user in the dockerfile:

RUN addgroup -g 2000 solariot && adduser -D -u 2000 -G solariot solariot

Just worth maybe updating the doco/calling out that if the user is 'mounting' in the config file from the Docker host, they'll have to ensure the permissions are correct on the config file.

Sungrow SG10RT inverter modbus

Hi. I've recently installed a SG10RT inverter (3 Phase) and trying to work out the modbus setup.

If I use the model = "sungrow-sg5kd" I can get most of the readings, except "power consumption" and "energy consumption".

(sungrow-sh5k modbus fails to connect at all).

Can someone point me in the right direction to set up a modbus file that collects the power and energy info to?

SMA STP xx000TL support

Hi,

I'm trying to add support for the SMA Tripower inverter, but apparently the Py Modbus library doesn't like it.

I'm getting:

$ python2 ./solariot.py
Load config sma-STP-nn000TL-20-256
Load ModbusTcpClient
Connect
[ERROR] fromRegisters() got an unexpected keyword argument 'endian'
[ERROR] fromRegisters() got an unexpected keyword argument 'endian'

Have you seen this before?

Cheers,
Dominik

Energy Generation on pvoutoput

For some reason Energy Generation (v1) has stopped updating today on pvoutoput. Everything else is updating (power, temp and voltage). The API call looks good so just wondering if anyone has any ideas? I've also posted on the forum.

/service/r2/addstatus.jsp?d=20210503&t=14%3A40&c1=1&v1=3700.0&v2=1047&v5=40.6&v6=249.7 HTTP/1.1" 200 None

Thanks

InfluxDBClientError: 400: {"error":"unable to parse 'Sungrow,location=XXXXX ': invalid field format

Hi,

I've been running this solution for several years now with no issues (or changes), but today I am suddenly greeted with this message.

The config nor python code has been changed in anyway for at least 3 years, and neither have my inverter or network, so I'm very confused. From the output, it seems there's a space being appended to the end of the Location tag, but there's no space in the config and I don't understand how to remove it, if that is indeed the issue. Would really appreciate any guidance, happy to supply the code I'm currently running (as I mentioned, it's quite old compared to what's on here now). I'm also using a slightly modified Inverter config for sungrow-SG5KTL, which doesn't appear to exist on this repo anymore.

Sungrow SH5K

Using the latest version is causing me this issue

Nov 03 13:59:10 raspberrypi python3[14336]: ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request
Nov 03 13:59:10 raspberrypi python3[14336]: Traceback (most recent call last):
Nov 03 13:59:10 raspberrypi python3[14336]:   File "/usr/local/lib/python3.7/dist-packages/pymodbus/transaction.py", line 210, in execute
Nov 03 13:59:10 raspberrypi python3[14336]:     request.unit_id)
Nov 03 13:59:10 raspberrypi python3[14336]:   File "/usr/local/lib/python3.7/dist-packages/pymodbus/framer/socket_framer.py", line 165, in processIncomingPacket
Nov 03 13:59:10 raspberrypi python3[14336]:     self._process(callback, error=True)
Nov 03 13:59:10 raspberrypi python3[14336]:   File "/usr/local/lib/python3.7/dist-packages/pymodbus/framer/socket_framer.py", line 175, in _process
Nov 03 13:59:10 raspberrypi python3[14336]:     raise ModbusIOException("Unable to decode request")
Nov 03 13:59:10 raspberrypi python3[14336]: pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request
Nov 03 13:59:10 raspberrypi python3[14336]: WARNING:root:Modbus connection failed
Nov 03 13:59:10 raspberrypi python3[14336]: WARNING:root:Failed to scrape inverter, sleeping until next scan```

Once it is in this state, I have to stop and start the service

Sungrow SG10RT - "unable to decode request"

Just got a Sungrow SG10RT installed and my config.py looks like this:

inverter_ip = "192.168.1.120"
inverter_port = 502
slave = 0x01
model = "sungrow-sg10rt"
timeout = 3
scan_interval = 10
json_file = "telemetry.json"

Confirmed that port 502 is open on the inverter_ip. Log:

INFO:root:Loaded config sungrow-sg10rt
INFO:root:Creating SungrowModbusTcpClient
INFO:root:Connecting
INFO:root:Connected
INFO:root:No MQTT configuration detected
INFO:root:No InfluxDB configuration detected
INFO:root:No PVOutput configuration detected
DEBUG:pymodbus.transaction:Current transaction state - IDLE
DEBUG:pymodbus.transaction:Running transaction 1
DEBUG:pymodbus.transaction:SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Transaction failed. ([Errno 54] Connection reset by peer)
DEBUG:pymodbus.framer.socket_framer:Processing:
DEBUG:pymodbus.transaction:Getting transaction 1
DEBUG:pymodbus.transaction:Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan

I saw another issue that mentioned using pymodbus version 2.4.0. I'm already on that version as per requirements.txt

Any ideas?

sungrow-sg5kd Modbus connection failed

I can see ports 80 and 502 open and can telnet into port 502 fine to confirm a connection can be made but solariot is giving a connection failed. Connecting via wifi. I've tried slave 0x01 through 0x04.

Wifi dongle v31_001_247:
Device address: 247
Device Model: Wifi V31
Manufacturer: Sungrow

Inverter:
Name: SG5K-D_001_001
Device Address: 1
Device Model: SG5K-D
Manufacturer: Sungrow

cat config.py

inverter_ip = "10.0.0.47"
inverter_port = 502
slave = 0x01
model = "sungrow-sg5kd"
timeout = 3
scan_interval = 10
dweepy_uuid = "random-uuid"

Returns:
./solariot.py -vv

INFO:root:Loaded config sungrow-sg5kd
INFO:root:Creating SungrowModbusTcpClient
INFO:root:Connecting
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53763)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53764)
INFO:root:Connected
INFO:root:No MQTT configuration detected
INFO:root:No InfluxDB configuration detected
INFO:root:No PVOutput configuration detected
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53765)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53766)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53767)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53768)
DEBUG:pymodbus.transaction:Current transaction state - IDLE
DEBUG:pymodbus.transaction:Running transaction 1
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53769)
DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('10.0.0.26', 53770)
DEBUG:pymodbus.transaction:SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Transaction failed. ([Errno 54] Connection reset by peer)
DEBUG:pymodbus.framer.socket_framer:Processing:
DEBUG:pymodbus.transaction:Getting transaction 1
DEBUG:pymodbus.transaction:Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan

InfluxDB and Grafana

So I decided to take a look at setting this up. So far so good, solariot is writing data into the InfluxDB, Grafana is configured to access the database and the Sun and Moon plugin is installed. I uploaded your json file but I'm getting N/A for everything. I read on the project page that "The file will require editing to match your InfluxDb settings". Can you please give me an idea as to what needs to be edited? The only difference between your default config and mine is the database name.

Cheers

Quick update

System:
Ubuntu 22.10, python 3.10.6 is upgraded (arm/rpi4)
Mini fixes found:

  • Requirements now require pyserial-asyncio
  • One line needs to be changed in the source (solariot.py)
    from pymodbus.client.tcp import ModbusTcpClient
    ^-- tcp instead of sync

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.