alexeyden / openess

Metrics export daemon for PowMr solar invertors (self hosted SmartESS mobile app replacement)
4 stars 1 forks source link

Incorrect value sent over MQTT if the register decoding failed #4

Open naseef opened 1 week ago

naseef commented 1 week ago

If register decoding failed, incorrect values are being sent over MQTT. Please see the below logs.

Mon Nov  4 12:15:25 2024 daemon.err openess[8477]: INFO 2024/11/04 12:15:25 export:mqtt: connected to broker
root@OpenWrt:/tmp# logread -f
Mon Nov  4 12:16:28 2024 daemon.err openess[8477]: INFO 2024/11/04 12:16:28 export:mqtt: publishing connection state: true
Mon Nov  4 12:16:28 2024 daemon.err openess[8477]: INFO 2024/11/04 12:16:28 export:mqtt: publishing connection state: true
Mon Nov  4 12:16:28 2024 daemon.err openess[8477]: INFO 2024/11/04 12:16:28 export:mqtt: publishing register: grid_voltage_a = 236.600
Mon Nov  4 12:16:28 2024 daemon.err openess[8477]: INFO 2024/11/04 12:16:28 export:mqtt: publishing register: output_active_power = 0.000
Mon Nov  4 12:17:31 2024 daemon.err openess[8477]: ERROR        2024/11/04 12:17:31 collector: failed to read register: invalid devaddr or funcNumber in response: 81, 48 (expected 1/3)
Mon Nov  4 12:17:31 2024 daemon.err openess[8477]: INFO 2024/11/04 12:17:31 export:mqtt: publishing connection state: true
Mon Nov  4 12:17:31 2024 daemon.err openess[8477]: INFO 2024/11/04 12:17:31 export:mqtt: publishing register: grid_voltage_a = 236.600
Mon Nov  4 12:17:31 2024 daemon.err openess[8477]: INFO 2024/11/04 12:17:31 export:mqtt: publishing register: output_active_power = 15499501.000
Mon Nov  4 12:18:34 2024 daemon.err openess[8477]: ERROR        2024/11/04 12:18:34 collector: failed to read register: invalid devaddr or funcNumber in response: 81, 48 (expected 1/3)
Mon Nov  4 12:18:34 2024 daemon.err openess[8477]: INFO 2024/11/04 12:18:34 export:mqtt: publishing connection state: true
Mon Nov  4 12:18:34 2024 daemon.err openess[8477]: INFO 2024/11/04 12:18:34 export:mqtt: publishing register: grid_voltage_a = 236.600
Mon Nov  4 12:18:34 2024 daemon.err openess[8477]: INFO 2024/11/04 12:18:34 export:mqtt: publishing register: output_active_power = 15506055.000

the output_active_power = 15499501.000 and output_active_power = 15506055.000 and outliers

naseef commented 1 week ago

Seems like the error is due to the Forwarded Red request and Heartbeat overlap. Any way we can use incremental TID or handle one command at a time?

DEBUG   2024/11/05 07:46:24 msg_forward: read request 01030049000155dc
DEBUG   2024/11/05 07:46:24 proto: setting timeout 5000 ms
DEBUG   2024/11/05 07:46:25 proto: read header {TID:48879 DevCode:258 Size:14 DevAddr:255 FuncCode:1}
DEBUG   2024/11/05 07:46:25 proto: read body 5130303238333731333035343932
ERROR   2024/11/05 07:46:25 collector: failed to read register: invalid devaddr or funcNumber in response: 81, 48 (expected 1/3)
DEBUG   2024/11/05 07:46:25 collector: polling register output_active_power