Marijn Koesen debf01e220 Read all registers at once
When you read the registers one-by-one, which is what the solaredge_mobus
library is doing, you run into the issue where the value and the scale
are sometimes out of sync.

This happens mostly when the values go up or down a lot, like at the
beginning and at the end of the day. At these times the SolarEdge
inverter can change the scale of the values it's returning.

When you read the value register, the scale might be -2, but in the
time between that request, and the request for the scale, the inverter
has changed the scale to -3. So in the next register read, you will get
-3 for the scale, but have a value in the scale of -2. Now when you do
the value calculation, you end up with a factor 10 difference.

So it's better, and also _much_ faster to read out all the registers
at once and then parse the values from this bigger read out.

I'm planning to do a MR back to solaredge_modbus with this change, so
for now i've just included that code into this project.
2020-06-06 18:40:00 +02:00
2020-06-04 21:34:54 +02:00
2020-06-04 21:41:08 +02:00
2020-06-04 21:28:38 +02:00
2020-06-04 21:49:53 +02:00

Usage

Installation

The easiest way this is to run the docker container and set it to restart always. This basically makes it a system service that will always run.

To make it safe and avoid passing credentials we're using a configuration file.

mkdir /etc/solaredge_modbus_mqtt
chmod 700 /etc/solaredge_modbus_mqtt
cp config.yaml-dist /etc/solaredge_modbus_mqtt/config.yaml
docker run --name=solaredge_modbus_mqtt --restart=always --volume=/etc/solaredge_modbus_mqtt/config.yaml:/app/config.yaml marijnkoesen/solaredge_modbus_mqtt:latest

Uninstall

docker update --restart=no solaredge_modbus_mqtt
docker stop solaredge_modbus_mqtt

For developers

Building and running the docker image

docker build -t solaredge_modbus_mqtt:latest .
cp config.yaml-dist config.yaml
docker run --volume=$PWD/config.yaml:/app/config.yaml solaredge_modbus_mqtt:latest

Running without docker

pip3 install -r requirements.txt
cp config.yaml-dist config.yaml
python3 solaredge_modbus_mqtt.py

Running tests

pip3 install -r requirements.txt
python3 -m unittest
S
Description
No description provided
Readme MIT
166 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 99.3%
Dockerfile 0.7%