kbialek / deye-inverter-mqtt

Reads Deye solar inverter metrics and posts them over mqtt
Apache License 2.0
215 stars 50 forks source link

day_energy and total_energy reports 0 #189

Open CarstenGrohmann opened 1 month ago

CarstenGrohmann commented 1 month ago

I use your software for a few months and it runs stable.

Unfortunatelly it reports unexpected 0s in the morning and the evening e.g. for day_enery and total_energy.

Both zeros are illogical for the total_energy, as the total_energy is a steadily increasing value that should not be 0 except at the very beginning.

The situation is similar with day_energy. Zero values are only expected in the morning after the time reset. In the evening, after the values have risen steadily throughout the day, a 0 value is illogical and unexpected.

I prefer to send no values rather than a series of zeros.

In addition, the 0 for day_energy in the evening breaks the calculation of my self-used solar energy as provided by Home Assistant.

What do you think about this behaviour?

Expected behavior Continuous line that is interrupted overnight because the inverter and logger are offline overnight. The line does not go down to 0 either in the morning or in the evening.

Screenshots image

image

Hardware (please complete the following information):

Software (please complete the following information):

Logs

Logger is online for the first time this day:

2024-07-20 03:28:00,909 - DeyeDaemon - DEBUG - Invoking action
2024-07-20 03:28:00,910 - DeyeInverterState - INFO - Reading start
2024-07-20 03:28:00,910 - DeyeInverterState - INFO - Reading registers [metrics group: {'micro'}, range: 003c-0074]
2024-07-20 03:28:00,939 - DeyeTcpConnector - INFO - Re-connected to socket on IP 192.168.178.42
2024-07-20 03:28:00,939 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf60200000000000000000000000000000103003c003945d4b615
2024-07-20 03:28:01,114 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a585001015000129acebf60201c07a2f012d0000000000000001037200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078ab9415
2024-07-20 03:28:01,116 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings_micro', 'settings'}, range: 0028-0028]
2024-07-20 03:28:01,120 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf602000000000000000000000000000001030028000104025715
2024-07-20 03:28:01,175 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a515001015000229acebf60201c07a2f012d000000000000000103020064b9af5e15
2024-07-20 03:28:01,177 - DeyeInverterState - DEBUG - Production today: 0.0
2024-07-20 03:28:01,177 - DeyeInverterState - DEBUG - Production Total: 0.0
2024-07-20 03:28:01,178 - DeyeInverterState - DEBUG - Phase1 Voltage: 0.0
2024-07-20 03:28:01,179 - DeyeInverterState - DEBUG - Phase1 Current: 0.0
2024-07-20 03:28:01,180 - DeyeInverterState - DEBUG - Phase1 Power: 0.0
2024-07-20 03:28:01,181 - DeyeInverterState - DEBUG - AC Freq: 0.0
2024-07-20 03:28:01,181 - DeyeInverterState - DEBUG - Uptime: 0.0
2024-07-20 03:28:01,181 - DeyeInverterState - DEBUG - PV1 Voltage: 0.0
2024-07-20 03:28:01,182 - DeyeInverterState - DEBUG - PV1 Current: 0.0
2024-07-20 03:28:01,182 - DeyeInverterState - DEBUG - PV1 Power: 0.0
2024-07-20 03:28:01,183 - DeyeInverterState - DEBUG - PV1 Production today: 0.0
2024-07-20 03:28:01,183 - DeyeInverterState - DEBUG - PV1 Total: 0.0
2024-07-20 03:28:01,183 - DeyeInverterState - DEBUG - PV2 Voltage: 0.0
2024-07-20 03:28:01,184 - DeyeInverterState - DEBUG - PV2 Current: 0.0
2024-07-20 03:28:01,184 - DeyeInverterState - DEBUG - PV2 Power: 0.0
2024-07-20 03:28:01,185 - DeyeInverterState - DEBUG - PV2 Production today: 0.0
2024-07-20 03:28:01,185 - DeyeInverterState - DEBUG - PV2 Total: 0.0
2024-07-20 03:28:01,185 - DeyeInverterState - DEBUG - PV3 Voltage: 0.0
2024-07-20 03:28:01,186 - DeyeInverterState - DEBUG - PV3 Current: 0.0
2024-07-20 03:28:01,186 - DeyeInverterState - DEBUG - PV3 Power: 0.0
2024-07-20 03:28:01,186 - DeyeInverterState - DEBUG - PV3 Production today: 0.0
2024-07-20 03:28:01,187 - DeyeInverterState - DEBUG - PV3 Total: 0.0
2024-07-20 03:28:01,187 - DeyeInverterState - DEBUG - PV4 Voltage: 0.0
2024-07-20 03:28:01,187 - DeyeInverterState - DEBUG - PV4 Current: 0.0
2024-07-20 03:28:01,188 - DeyeInverterState - DEBUG - PV4 Power: 0.0
2024-07-20 03:28:01,188 - DeyeInverterState - DEBUG - PV4 Production today: 0.0
2024-07-20 03:28:01,189 - DeyeInverterState - DEBUG - PV4 Total: 0.0
2024-07-20 03:28:01,189 - DeyeInverterState - DEBUG - DC Total Power: 0.0
2024-07-20 03:28:01,190 - DeyeInverterState - DEBUG - Operating Power: 0.0
2024-07-20 03:28:01,190 - DeyeInverterState - DEBUG - AC Active Power: 0.0
2024-07-20 03:28:01,190 - DeyeInverterState - DEBUG - Radiator temperature: -10.0
2024-07-20 03:28:01,191 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/logger_status', value: 'online'
2024-07-20 03:28:01,192 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17636), 'b'deyemqtt/logger_status'', ... (6 bytes)
2024-07-20 03:28:01,195 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17636)
2024-07-20 03:28:01,197 - DeyeMqttClient - INFO - Logger is online
2024-07-20 03:28:01,197 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/day_energy', value: '0.0'
2024-07-20 03:28:01,198 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17637), 'b'deyemqtt/day_energy'', ... (3 bytes)
2024-07-20 03:28:01,199 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17637)
2024-07-20 03:28:01,201 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/total_energy', value: '0.0'
2024-07-20 03:28:01,201 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17638), 'b'deyemqtt/total_energy'', ... (3 bytes)
2024-07-20 03:28:01,203 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17638)

First zero value in the morning:

2024-07-20 03:33:00,910 - DeyeDaemon - DEBUG - Invoking action
2024-07-20 03:33:00,911 - DeyeInverterState - INFO - Reading start
2024-07-20 03:33:00,911 - DeyeInverterState - INFO - Reading registers [metrics group: {'micro'}, range: 003c-0074]
2024-07-20 03:33:00,917 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf60200000000000000000000000000000103003c003945d4b615
2024-07-20 03:33:01,097 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a585001015000929acebf602019f7b2f010c0100000000000001037200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078ab5c15
2024-07-20 03:33:01,098 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings_micro', 'settings'}, range: 0028-0028]
2024-07-20 03:33:01,101 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf602000000000000000000000000000001030028000104025715
2024-07-20 03:33:01,158 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a515001015000a29acebf602019f7b2f010c010000000000000103020064b9af2615
2024-07-20 03:33:01,159 - DeyeInverterState - DEBUG - Production today: 0.0
2024-07-20 03:33:01,160 - DeyeInverterState - DEBUG - Production Total: 0.0
2024-07-20 03:33:01,160 - DeyeInverterState - DEBUG - Phase1 Voltage: 0.0
2024-07-20 03:33:01,161 - DeyeInverterState - DEBUG - Phase1 Current: 0.0
2024-07-20 03:33:01,161 - DeyeInverterState - DEBUG - Phase1 Power: 0.0
2024-07-20 03:33:01,162 - DeyeInverterState - DEBUG - AC Freq: 0.0
2024-07-20 03:33:01,163 - DeyeInverterState - DEBUG - Uptime: 0.0
2024-07-20 03:33:01,164 - DeyeInverterState - DEBUG - PV1 Voltage: 0.0
2024-07-20 03:33:01,164 - DeyeInverterState - DEBUG - PV1 Current: 0.0
2024-07-20 03:33:01,164 - DeyeInverterState - DEBUG - PV1 Power: 0.0
2024-07-20 03:33:01,165 - DeyeInverterState - DEBUG - PV1 Production today: 0.0
2024-07-20 03:33:01,165 - DeyeInverterState - DEBUG - PV1 Total: 0.0
2024-07-20 03:33:01,165 - DeyeInverterState - DEBUG - PV2 Voltage: 0.0
2024-07-20 03:33:01,166 - DeyeInverterState - DEBUG - PV2 Current: 0.0
2024-07-20 03:33:01,166 - DeyeInverterState - DEBUG - PV2 Power: 0.0
2024-07-20 03:33:01,166 - DeyeInverterState - DEBUG - PV2 Production today: 0.0
2024-07-20 03:33:01,167 - DeyeInverterState - DEBUG - PV2 Total: 0.0
2024-07-20 03:33:01,167 - DeyeInverterState - DEBUG - PV3 Voltage: 0.0
2024-07-20 03:33:01,167 - DeyeInverterState - DEBUG - PV3 Current: 0.0
2024-07-20 03:33:01,168 - DeyeInverterState - DEBUG - PV3 Power: 0.0
2024-07-20 03:33:01,168 - DeyeInverterState - DEBUG - PV3 Production today: 0.0
2024-07-20 03:33:01,168 - DeyeInverterState - DEBUG - PV3 Total: 0.0
2024-07-20 03:33:01,169 - DeyeInverterState - DEBUG - PV4 Voltage: 0.0
2024-07-20 03:33:01,169 - DeyeInverterState - DEBUG - PV4 Current: 0.0
2024-07-20 03:33:01,169 - DeyeInverterState - DEBUG - PV4 Power: 0.0
2024-07-20 03:33:01,170 - DeyeInverterState - DEBUG - PV4 Production today: 0.0
2024-07-20 03:33:01,170 - DeyeInverterState - DEBUG - PV4 Total: 0.0
2024-07-20 03:33:01,170 - DeyeInverterState - DEBUG - DC Total Power: 0.0
2024-07-20 03:33:01,171 - DeyeInverterState - DEBUG - Operating Power: 0.0
2024-07-20 03:33:01,171 - DeyeInverterState - DEBUG - AC Active Power: 0.0
2024-07-20 03:33:01,171 - DeyeInverterState - DEBUG - Radiator temperature: -10.0
2024-07-20 03:33:01,172 - DeyeInverterState - DEBUG - Active power regulation: 100.0
2024-07-20 03:33:01,172 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/logger_status', value: 'online'
2024-07-20 03:33:01,172 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17886), 'b'deyemqtt/logger_status'', ... (6 bytes)
2024-07-20 03:33:01,174 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17886)
2024-07-20 03:33:01,177 - DeyeMqttClient - INFO - Logger is online
2024-07-20 03:33:01,178 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/day_energy', value: '0.0'
2024-07-20 03:33:01,178 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17887), 'b'deyemqtt/day_energy'', ... (3 bytes)
2024-07-20 03:33:01,180 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17887)
2024-07-20 03:33:01,182 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/total_energy', value: '0.0'
2024-07-20 03:33:01,182 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17888), 'b'deyemqtt/total_energy'', ... (3 bytes)
2024-07-20 03:33:01,184 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17888)

First non-zero value in the morning:

2024-07-20 03:34:00,911 - DeyeDaemon - DEBUG - Invoking action
2024-07-20 03:34:00,911 - DeyeInverterState - INFO - Reading start
2024-07-20 03:34:00,912 - DeyeInverterState - INFO - Reading registers [metrics group: {'micro'}, range: 003c-0074]
2024-07-20 03:34:00,915 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf60200000000000000000000000000000103003c003945d4b615
2024-07-20 03:34:01,273 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a585001015000b29acebf60201db7b2f014801000000000000010372001300000000105700000013000000000000105700000000000009600000000000000000000013880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000001320000000000000000000000000000e0723415
2024-07-20 03:34:01,275 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings_micro', 'settings'}, range: 0028-0028]
2024-07-20 03:34:01,279 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf602000000000000000000000000000001030028000104025715
2024-07-20 03:34:01,587 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a515001015000c29acebf60201db7b2f0148010000000000000103020064b9afa015
2024-07-20 03:34:01,588 - DeyeInverterState - DEBUG - Production today: 1.9
2024-07-20 03:34:01,589 - DeyeInverterState - DEBUG - Production Total: 418.3
2024-07-20 03:34:01,589 - DeyeInverterState - DEBUG - Phase1 Voltage: 240.0
2024-07-20 03:34:01,590 - DeyeInverterState - DEBUG - Phase1 Current: 0.0
2024-07-20 03:34:01,590 - DeyeInverterState - DEBUG - Phase1 Power: 0.0
2024-07-20 03:34:01,590 - DeyeInverterState - DEBUG - AC Freq: 50.0
2024-07-20 03:34:01,591 - DeyeInverterState - DEBUG - Uptime: 0.0
2024-07-20 03:34:01,591 - DeyeInverterState - DEBUG - PV1 Voltage: 30.6
2024-07-20 03:34:01,591 - DeyeInverterState - DEBUG - PV1 Current: 0.0
2024-07-20 03:34:01,592 - DeyeInverterState - DEBUG - PV1 Power: 0.0
2024-07-20 03:34:01,593 - DeyeInverterState - DEBUG - PV1 Production today: 1.9
2024-07-20 03:34:01,593 - DeyeInverterState - DEBUG - PV1 Total: 418.3
2024-07-20 03:34:01,594 - DeyeInverterState - DEBUG - PV2 Voltage: 0.0
2024-07-20 03:34:01,594 - DeyeInverterState - DEBUG - PV2 Current: 0.0
2024-07-20 03:34:01,595 - DeyeInverterState - DEBUG - PV2 Power: 0.0
2024-07-20 03:34:01,596 - DeyeInverterState - DEBUG - PV2 Production today: 0.0
2024-07-20 03:34:01,597 - DeyeInverterState - DEBUG - PV2 Total: 0.0
2024-07-20 03:34:01,597 - DeyeInverterState - DEBUG - PV3 Voltage: 0.0
2024-07-20 03:34:01,598 - DeyeInverterState - DEBUG - PV3 Current: 0.0
2024-07-20 03:34:01,598 - DeyeInverterState - DEBUG - PV3 Power: 0.0
2024-07-20 03:34:01,599 - DeyeInverterState - DEBUG - PV3 Production today: 0.0
2024-07-20 03:34:01,600 - DeyeInverterState - DEBUG - PV3 Total: 0.0
2024-07-20 03:34:01,600 - DeyeInverterState - DEBUG - PV4 Voltage: 0.0
2024-07-20 03:34:01,601 - DeyeInverterState - DEBUG - PV4 Current: 0.0
2024-07-20 03:34:01,601 - DeyeInverterState - DEBUG - PV4 Power: 0.0
2024-07-20 03:34:01,601 - DeyeInverterState - DEBUG - PV4 Production today: 0.0
2024-07-20 03:34:01,602 - DeyeInverterState - DEBUG - PV4 Total: 0.0
2024-07-20 03:34:01,602 - DeyeInverterState - DEBUG - DC Total Power: 0.0
2024-07-20 03:34:01,603 - DeyeInverterState - DEBUG - Operating Power: 0.0
2024-07-20 03:34:01,603 - DeyeInverterState - DEBUG - AC Active Power: 0.0
2024-07-20 03:34:01,604 - DeyeInverterState - DEBUG - Radiator temperature: -10.0
2024-07-20 03:34:01,604 - DeyeInverterState - DEBUG - Active power regulation: 100.0
2024-07-20 03:34:01,605 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/logger_status', value: 'online'
2024-07-20 03:34:01,605 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17936), 'b'deyemqtt/logger_status'', ... (6 bytes)
2024-07-20 03:34:01,608 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17936)
2024-07-20 03:34:01,609 - DeyeMqttClient - INFO - Logger is online
2024-07-20 03:34:01,609 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/day_energy', value: '1.9'
2024-07-20 03:34:01,610 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17937), 'b'deyemqtt/day_energy'', ... (3 bytes)
2024-07-20 03:34:01,612 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17937)
2024-07-20 03:34:01,613 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/total_energy', value: '418.3'
2024-07-20 03:34:01,614 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m17938), 'b'deyemqtt/total_energy'', ... (5 bytes)
2024-07-20 03:34:01,617 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 17938)

Last non-zero value in the evening:

2024-07-20 18:48:01,108 - DeyeDaemon - DEBUG - Invoking action
2024-07-20 18:48:01,109 - DeyeInverterState - INFO - Reading start
2024-07-20 18:48:01,109 - DeyeInverterState - INFO - Reading registers [metrics group: {'micro'}, range: 003c-0074]
2024-07-20 18:48:01,186 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf60200000000000000000000000000000103003c003945d4b615
2024-07-20 18:48:01,363 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a585001015001029acebf60201c34e3001c00100000000000001037200110000000010680000001100000000000010680000000000000938000000000000000000001388000000000000000000000000000a0000000000000fd200000000000000000000000000000000000000000000000000040000000000000000000000b500000000000000000000000000006e210d15
2024-07-20 18:48:01,365 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings_micro', 'settings'}, range: 0028-0028]
2024-07-20 18:48:01,369 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf602000000000000000000000000000001030028000104025715
2024-07-20 18:48:01,423 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a515001015001129acebf60201c34e3001c0010000000000000103020064b9afd915
2024-07-20 18:48:01,424 - DeyeInverterState - DEBUG - Production today: 1.7
2024-07-20 18:48:01,424 - DeyeInverterState - DEBUG - Production Total: 420.0
2024-07-20 18:48:01,425 - DeyeInverterState - DEBUG - Phase1 Voltage: 236.0
2024-07-20 18:48:01,425 - DeyeInverterState - DEBUG - Phase1 Current: 0.0
2024-07-20 18:48:01,426 - DeyeInverterState - DEBUG - Phase1 Power: 0.0
2024-07-20 18:48:01,426 - DeyeInverterState - DEBUG - AC Freq: 50.0
2024-07-20 18:48:01,426 - DeyeInverterState - DEBUG - Uptime: 0.0
2024-07-20 18:48:01,427 - DeyeInverterState - DEBUG - PV1 Voltage: 18.1
2024-07-20 18:48:01,427 - DeyeInverterState - DEBUG - PV1 Current: 0.0
2024-07-20 18:48:01,428 - DeyeInverterState - DEBUG - PV1 Power: 0.0
2024-07-20 18:48:01,428 - DeyeInverterState - DEBUG - PV1 Production today: 1.7
2024-07-20 18:48:01,429 - DeyeInverterState - DEBUG - PV1 Total: 420.0
2024-07-20 18:48:01,429 - DeyeInverterState - DEBUG - PV2 Voltage: 0.0
2024-07-20 18:48:01,430 - DeyeInverterState - DEBUG - PV2 Current: 0.0
2024-07-20 18:48:01,430 - DeyeInverterState - DEBUG - PV2 Power: 0.0
2024-07-20 18:48:01,431 - DeyeInverterState - DEBUG - PV2 Production today: 0.0
2024-07-20 18:48:01,432 - DeyeInverterState - DEBUG - PV2 Total: 0.0
2024-07-20 18:48:01,433 - DeyeInverterState - DEBUG - PV3 Voltage: 0.0
2024-07-20 18:48:01,433 - DeyeInverterState - DEBUG - PV3 Current: 0.0
2024-07-20 18:48:01,433 - DeyeInverterState - DEBUG - PV3 Power: 0.0
2024-07-20 18:48:01,434 - DeyeInverterState - DEBUG - PV3 Production today: 0.0
2024-07-20 18:48:01,435 - DeyeInverterState - DEBUG - PV3 Total: 0.0
2024-07-20 18:48:01,435 - DeyeInverterState - DEBUG - PV4 Voltage: 0.0
2024-07-20 18:48:01,436 - DeyeInverterState - DEBUG - PV4 Current: 0.0
2024-07-20 18:48:01,436 - DeyeInverterState - DEBUG - PV4 Power: 0.0
2024-07-20 18:48:01,437 - DeyeInverterState - DEBUG - PV4 Production today: 0.0
2024-07-20 18:48:01,437 - DeyeInverterState - DEBUG - PV4 Total: 0.0
2024-07-20 18:48:01,438 - DeyeInverterState - DEBUG - DC Total Power: 0.0
2024-07-20 18:48:01,438 - DeyeInverterState - DEBUG - Operating Power: 0.0
2024-07-20 18:48:01,439 - DeyeInverterState - DEBUG - AC Active Power: 1.0
2024-07-20 18:48:01,439 - DeyeInverterState - DEBUG - Radiator temperature: 30.5
2024-07-20 18:48:01,440 - DeyeInverterState - DEBUG - Active power regulation: 100.0
2024-07-20 18:48:01,440 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/logger_status', value: 'online'
2024-07-20 18:48:01,441 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m63071), 'b'deyemqtt/logger_status'', ... (6 bytes)
2024-07-20 18:48:01,443 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 63071)
2024-07-20 18:48:01,446 - DeyeMqttClient - INFO - Logger is online
2024-07-20 18:48:01,446 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/day_energy', value: '1.7'
2024-07-20 18:48:01,447 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m63072), 'b'deyemqtt/day_energy'', ... (3 bytes)
2024-07-20 18:48:01,449 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 63072)
2024-07-20 18:48:01,450 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/total_energy', value: '420.0'
2024-07-20 18:48:01,451 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m63073), 'b'deyemqtt/total_energy'', ... (5 bytes)
2024-07-20 18:48:01,453 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 63073)

First zero value in the evening:

2024-07-20 18:50:01,109 - DeyeDaemon - DEBUG - Invoking action
2024-07-20 18:50:01,109 - DeyeInverterState - INFO - Reading start
2024-07-20 18:50:01,110 - DeyeInverterState - INFO - Reading registers [metrics group: {'micro'}, range: 003c-0074]
2024-07-20 18:50:01,118 - DeyeTcpConnector - INFO - Re-connected to socket on IP 192.168.178.42
2024-07-20 18:50:01,119 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf60200000000000000000000000000000103003c003945d4b615
2024-07-20 18:50:01,300 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a585001015000129acebf602019c4e3001310000000000000001037200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078ab4915
2024-07-20 18:50:01,302 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings_micro', 'settings'}, range: 0028-0028]
2024-07-20 18:50:01,311 - DeyeTcpConnector - DEBUG - Request frame: a517001045000029acebf602000000000000000000000000000001030028000104025715
2024-07-20 18:50:01,523 - DeyeTcpConnector - DEBUG - Received response frame in 1. attempt: a515001015000229acebf602019c4e300131000000000000000103020064b9af1315
2024-07-20 18:50:01,524 - DeyeInverterState - DEBUG - Production today: 0.0
2024-07-20 18:50:01,525 - DeyeInverterState - DEBUG - Production Total: 0.0
2024-07-20 18:50:01,525 - DeyeInverterState - DEBUG - Phase1 Voltage: 0.0
2024-07-20 18:50:01,525 - DeyeInverterState - DEBUG - Phase1 Current: 0.0
2024-07-20 18:50:01,526 - DeyeInverterState - DEBUG - Phase1 Power: 0.0
2024-07-20 18:50:01,527 - DeyeInverterState - DEBUG - AC Freq: 0.0
2024-07-20 18:50:01,527 - DeyeInverterState - DEBUG - Uptime: 0.0
2024-07-20 18:50:01,527 - DeyeInverterState - DEBUG - PV1 Voltage: 0.0
2024-07-20 18:50:01,528 - DeyeInverterState - DEBUG - PV1 Current: 0.0
2024-07-20 18:50:01,528 - DeyeInverterState - DEBUG - PV1 Power: 0.0
2024-07-20 18:50:01,528 - DeyeInverterState - DEBUG - PV1 Production today: 0.0
2024-07-20 18:50:01,529 - DeyeInverterState - DEBUG - PV1 Total: 0.0
2024-07-20 18:50:01,529 - DeyeInverterState - DEBUG - PV2 Voltage: 0.0
2024-07-20 18:50:01,529 - DeyeInverterState - DEBUG - PV2 Current: 0.0
2024-07-20 18:50:01,530 - DeyeInverterState - DEBUG - PV2 Power: 0.0
2024-07-20 18:50:01,530 - DeyeInverterState - DEBUG - PV2 Production today: 0.0
2024-07-20 18:50:01,530 - DeyeInverterState - DEBUG - PV2 Total: 0.0
2024-07-20 18:50:01,531 - DeyeInverterState - DEBUG - PV3 Voltage: 0.0
2024-07-20 18:50:01,531 - DeyeInverterState - DEBUG - PV3 Current: 0.0
2024-07-20 18:50:01,531 - DeyeInverterState - DEBUG - PV3 Power: 0.0
2024-07-20 18:50:01,532 - DeyeInverterState - DEBUG - PV3 Production today: 0.0
2024-07-20 18:50:01,532 - DeyeInverterState - DEBUG - PV3 Total: 0.0
2024-07-20 18:50:01,532 - DeyeInverterState - DEBUG - PV4 Voltage: 0.0
2024-07-20 18:50:01,533 - DeyeInverterState - DEBUG - PV4 Current: 0.0
2024-07-20 18:50:01,533 - DeyeInverterState - DEBUG - PV4 Power: 0.0
2024-07-20 18:50:01,533 - DeyeInverterState - DEBUG - PV4 Production today: 0.0
2024-07-20 18:50:01,533 - DeyeInverterState - DEBUG - PV4 Total: 0.0
2024-07-20 18:50:01,534 - DeyeInverterState - DEBUG - DC Total Power: 0.0
2024-07-20 18:50:01,534 - DeyeInverterState - DEBUG - Operating Power: 0.0
2024-07-20 18:50:01,534 - DeyeInverterState - DEBUG - AC Active Power: 0.0
2024-07-20 18:50:01,535 - DeyeInverterState - DEBUG - Radiator temperature: -10.0
2024-07-20 18:50:01,535 - DeyeInverterState - DEBUG - Active power regulation: 100.0
2024-07-20 18:50:01,536 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/logger_status', value: 'online'
2024-07-20 18:50:01,536 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m63124), 'b'deyemqtt/logger_status'', ... (6 bytes)
2024-07-20 18:50:01,538 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 63124)
2024-07-20 18:50:01,541 - DeyeMqttClient - INFO - Logger is online
2024-07-20 18:50:01,541 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/day_energy', value: '0.0'
2024-07-20 18:50:01,542 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m63125), 'b'deyemqtt/day_energy'', ... (3 bytes)
2024-07-20 18:50:01,544 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 63125)
2024-07-20 18:50:01,547 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deyemqtt/total_energy', value: '0.0'
2024-07-20 18:50:01,549 - paho.mqtt.client - DEBUG - Sending PUBLISH (d0, q1, r0, m63126), 'b'deyemqtt/total_energy'', ... (3 bytes)
2024-07-20 18:50:01,551 - paho.mqtt.client - DEBUG - Received PUBACK (Mid: 63126)
kbialek commented 1 month ago

@CarstenGrohmann hi! This software only publishes the values read from the inverter. Your inverter returns zeros, and that is what is published.

Let's look at this response frame:

a585001015000929acebf602019f7b2f010c0100000000000001037200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078ab5c15

It contains this ModbusRTU frame inside:

01037200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078ab

Even without decoding, it is obvious that it contains zeros only. It's worth noting that the CRC is valid, which indicates, that the communication is working correctly.

EDIT: Two questions:

  1. Is your inverter connected to the internet?
  2. Do you have automatic time setting enabled? (DEYE_FEATURE_SET_TIME config variable)
CarstenGrohmann commented 1 month ago

My converter has no connection to the internet and DEYE_FEATURE_SET_TIME is set to true.

I'll update the firmware to the newest 2.32 releae and check, if this solves this issue.

nifoc commented 1 month ago

I'm sorry for what is essentially a +1, but I'm noticing the same behavior.

At some point during the day day_energy suddenly becomes 0 and then returns to the previous (correct) measurement during the next poll.

Maybe this can be handled so that it simply sends nothing instead of 0 in cases where 0 doesn't make any sense?

CarstenGrohmann commented 1 month ago

@nifoc: Which inverter and which firmware are you using?

kbialek commented 1 month ago

Maybe this can be handled so that it simply sends nothing instead of 0 in cases where 0 doesn't make any sense?

The question is how to define "where 0 doesn't make any sense"?

Options:

Ignore Modbus response frames having zeros only

What do you think? Or maybe you have other proposal?

This feature would have to be put behind a feature flag, and be disabled by default.

CarstenGrohmann commented 4 weeks ago

I had trouble with the newest firmware and rolled back to MW3_16U_5406_1.63. The firmware 1.63 reports the same zero frames as reported above.

Therefore, I would prefer the first option as it prevents data from being pushed like in the "Logger is online for the first time this day" and "First zero value in the evening" sections.

@nifoc: In such a case, are all your values 0 or only day_energy?

CarstenGrohmann commented 1 week ago

Short update as I tested a small hack to filter 0 frames based on our discussion.

I added this temporary workaround to my docker container:

diff --git a/src/deye_modbus.py b/src/deye_modbus.py
index 1178712..13666d4 100644
--- a/src/deye_modbus.py
+++ b/src/deye_modbus.py
@@ -47,6 +47,9 @@ class DeyeModbus:
         modbus_crc.reverse()

         modbus_resp_frame = self.connector.send_request(modbus_frame + modbus_crc)
+        if "0" * 80 in modbus_resp_frame.hex():
+            self.__log.debug("Ignore empty frame: %s", modbus_resp_frame.hex())
+            return {}
         if modbus_resp_frame is None:
             return {}
         return self.__parse_modbus_read_holding_registers_response(modbus_resp_frame, first_reg, last_reg)
2024-08-31 04:45:50,980 - DeyeModbus - DEBUG - Ignore empty frame: 0103720000000000001292000000000000000000001292000000000000094200000000000000000000138800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000012a00000000000000000000000000001517
2024-08-31 04:46:51,252 - DeyeModbus - DEBUG - Ignore empty frame: 0103720000000000001292000000000000000000001292000000000000094200000000000000000000138800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000012a00000000000000000000000000001517

and in combination with a Utility Meter:

utility_meter:
  energy:
    name: "Production today (daily reset)"
    source: sensor.deye_inverter_mqtt_production_today
    cycle: daily

Home Assistent generates diagrams without any outliers in the morning or in the afternoon:

image

kbialek commented 1 week ago

As there is no consensus about the best strategy here, my proposal is to implement them one-by-one, as needed, so the end-user can choose the one that suits him best. Yours will be added first @CarstenGrohmann

kosl commented 1 week ago

Let me note that I am experiencing similar sporadic "spikes" readings from Deye SUN12k SG04LP3 in my fork, where I observe regular +ok=... response with valid CRC. I do not use block reads but single parameter and the reads are not zero but usually close to. I thought that some delay (1 second) between AT+INVDATA=... send and +ok=... recv would solve the problem of getting correct value(s) to the logger. So, there is some bug in the firmware that deyecloud.com is resolving somewhat better that us with AT+ protocol and I am looking for a root cause of such behaviour.

Bhoft commented 3 days ago

@CarstenGrohmann Hi can you add the HA sensor settings of this sensor?

sensor.deye_inverter_mqtt_production_today

I have trouble with my daily sensor values which my small inverter see https://github.com/kbialek/deye-inverter-mqtt/issues/197

CarstenGrohmann commented 3 days ago

I have no special/manual settings for the sensor.deye_inverter_mqtt_production_today sensor as I use my plugin Deye MQTT HA Plugin to announce the MQTT values to HA. In addition, I use several UtilityMeter sensor is used to reset most values at midnight.

Bhoft commented 2 days ago

Hi Carsten I saw that you use a Utility Meter for the daily sensor. But i guess that doesn't solve my issue that my inverter sends it's last known value (before it got offline) for day_energy or your production_today via mqtt when it goes back online, He resets to 0 when the time is set, but sadly he first sends sensor data via mqqt before that.

I just installed your plugin, but that wouldn't change the issue as it only changes the mqtt topics and auto creates the mqtt sensors (which i have done manually before). Nevertheless a plugin to automatically create the sensors is a great benefit.

But as i said an additional utility meter wouldn't change a thing if the sensor which is used has wrong values. But I will see this tomorrow when the inverter comes back online. I also have to say that we all might have different logger firmware versions. Sadly mine has auto updated to MW3_SSL_5408_1.0B so i can't use the AT Commands any more and have to use the tcp mode. Which might also cause the issue, but i can't downgrade.

The sensor has wrong values from 0:00 - 7:20 which would be then used for the utility meter as well. (image of my day_energy sensor) grafik

Btw do you plan to enable the active_power_regulation via mqtt as well? Btw2 why are you using state_class:total and not total_increasing for your total / daily sensors?

@CarstenGrohmann in this forum post they mentioned exactly your issue from your first post and there they had changed the state_class of the mqqt sensor from total to total_increasing as i also asked in my post why you use total. https://www.photovoltaikforum.com/thread/226131-deye-sun-m80-g4-eu-erfahrungen/?postID=3761075#post3761075

kbialek commented 2 days ago

@Bhoft My microinverters behave in the same way. I will think how to solve this in a systemic way. image

Bhoft commented 2 days ago

@kbialek good that i am not the only one 👍 I just checked your code and if you aggregrate over multiple inverters you are already checking if now isn't the last aggregation date. https://github.com/kbialek/deye-inverter-mqtt/blob/8a56a28eee905bff2e3b5e0cf9d54b80db76df88/src/deye_multi_inverter_data_aggregator.py#L43-L46

Maybe something like this would also work for single inverter usage?

CarstenGrohmann commented 2 days ago

But as i said an additional utility meter wouldn't change a thing if the sensor which is used has wrong values.

The utility meter cannot change the values of the origin sensor. The utility meter creates a new sensor with changed values and you can use the new sensor instead of the original sensor.

image

From my perspective the utility meter is a feasible workaround.

CarstenGrohmann commented 2 days ago

Btw do you plan to enable the active_power_regulation via mqtt as well?

Yes, I'll do after I added support for another set of topics.

kosl commented 1 day ago

With 3 Utility meters (battery and production) I have been able to correctly restart the sensors at midnight for the Energy card.

Further, I needed to add several sensor templates to correctly recompute for Sunsynk-Power-Flow-Card

image

where some missing sensors (e.g. frequency) are taken from another inverter (Solaredge).

Btw, I would love to see R/W registers such as peak shaving (191), limit_control (142), (off) grid state, battery limits, ... to be implemented for automated (timed) control of the inverter such as https://github.com/klatremis/esphome-for-deye is!

Bhoft commented 1 day ago

@CarstenGrohmann

But as i said an additional utility meter wouldn't change a thing if the sensor which is used has wrong values.

The utility meter cannot change the values of the origin sensor. The utility meter creates a new sensor with changed values and you can use the new sensor instead of the original sensor. From my perspective the utility meter is a feasible workaround.

What I meant was if your original sensor sends wrong values in the morning when the inverter comes online the utility sensor will also use these wrong values. But it`s strange that your chart of your utility sensor doesn't show wrong values. Does your daily sensor have wrong values as posts of kbialek and me are showing?

kbialek commented 1 day ago

hi!

I'm currently testing this beta image ghcr.io/kbialek/deye-inverter-mqtt:2024.09.1-beta-2 It contains these PRs

I encourage you to give it try

@CarstenGrohmann You will need to add DEYE_DATA_FILTERS=ignore_zeroed_frames to the config to activate this functionality

CarstenGrohmann commented 1 day ago

Thank you for providing this feature. I've updated the my docker container and share the results during the next days.

What do you think about adding an initial status message like:

DeyeProcessorFactory - INFO - Feature "ignore_zeroed_frames": enabled
Bhoft commented 19 hours ago

I'm currently testing this beta image ghcr.io/kbialek/deye-inverter-mqtt:2024.09.1-beta-2 It contains these PRs

I have installed the beta version yesterday and have an error in the log (multiple times) but thats now an issue with the Plugin from Carsten with this beta. As now no sensors information is sent to Homeassistent besides application_status and logger_status. So the autocreation of sensors via plugin currently isn't working as the plugin needs some code changes. @CarstenGrohmann

2024-09-13 05:59:04,549 - DeyeDaemon - ERROR - Unexpected error during runner execution
Traceback (most recent call last):
  File "/opt/deye_inverter_mqtt/deye_daemon.py", line 53, in __invoke_action
    self.__action()
  File "/opt/deye_inverter_mqtt/deye_inverter_state.py", line 60, in read_from_logger
    processor.process(events)
  File "/opt/deye_inverter_mqtt/plugins/deye_plugin_ha_discovery.py", line 237, in process
    self.publish_sensor_information(topic, event.observation)
  File "/opt/deye_inverter_mqtt/plugins/deye_plugin_ha_discovery.py", line 167, in publish_sensor_information
    "unit_of_measurement": observation.sensor.unit,
AttributeError: 'DailyResetSensor' object has no attribute 'unit'

@kbialek Besides that the day energy value is now 0 when the inverter comes online and the first value send is now correct. 👍

2024-09-13 05:10:04,354 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deye/day_energy', value: '0.0'

Same for the PV1-PVx values

2024-09-13 05:10:04,407 - DeyeMqttClient - DEBUG - Publishing message. topic: 'deye/dc/pv1/day_energy', value: '0.0'

Sadly Home Assistant still have the issue with the statistics it saves an value 5 minutes before the mqqt publish changed the value to 0. Just for information the timestamp in the portainer log doesn't have the correct Timezone of Format so 5:10 is 7:10. grafik grafik

Home assistant really saves periodically the current value in the statistics even if no new value is received via MQTT. So through the whole night when the inverter is offline the value isn't changed but saved in the logs.

I guess with "expire_after": 300, to the mqtt sensor this would be possible to solve. Which i now have added to my manually created mqqt sensors. I will write something tomorrow if that helped.

CarstenGrohmann commented 17 hours ago

The AttributeError exception is raised from my code. It looks like the unit attribute is missing from DailyResetSensor even if the class is derived from Sensor class.

2024-09-13 11:08:31,622 - DeyeDaemon - ERROR - Unexpected error during runner execution
Traceback (most recent call last):
  File "/opt/deye_inverter_mqtt/deye_daemon.py", line 53, in __invoke_action
    self.__action()
  File "/opt/deye_inverter_mqtt/deye_inverter_state.py", line 60, in read_from_logger
    processor.process(events)
  File "/opt/deye_inverter_mqtt/plugins/deye_plugin_ha_discovery.py", line 320, in process
    self.publish_sensor_information(topic, event.observation)
  File "/opt/deye_inverter_mqtt/plugins/deye_plugin_ha_discovery.py", line 242, in publish_sensor_information
    "unit_of_measurement": observation.sensor.unit,
AttributeError: 'DailyResetSensor' object has no attribute 'unit'

@kbialek: What do you think about this issue?

kbialek commented 10 hours ago

A new beta image 2024.09.1-beta-3 is there

  1. I fixed the error reported by @CarstenGrohmann I was actually expecting some errors to appear. The first implementation was quite dirty.
  2. I've added a log message DeyeDaemon - INFO - Active data filters: ignore_zeroed_frames
CarstenGrohmann commented 9 hours ago

I've updated my docker image and published a development branch with new metric and total_increasing state class for day_energy in https://github.com/CarstenGrohmann/deye-mqtt-ha-plugin/tree/more_inverters.

Today it was raining. I'll monitor all changes during the days next week with more sun.

Thank you for this fast update.