Polling via REST API leads to outliers in MQTT SENSOR data #23342
-
IssueI'm reading my smart meter via an IR reader and publish the metrics every 60 seconds via MQTT. This has been working rock solid for about 2 years now with no outliers in the data. Now I try to integrate with OpenDTU to control my micro inverter. I use the REST-API When I activate the polling (I tested 1s, 2s and 4s) I get outliers in the data published to the MQTT SENSOR topic. In the last 24 hours I got a reading of 0 for the frequency and a reading of 500 mega volts on phase 1 for exactly one reading. Sometimes I also get a current power reading of multiple tera watts for exactly one reading. As soon as I stop polling via REST, no more outliers are observed. Is this a bug or a known issue? I have no idea how to pin point it. I upgraded from 12.3.1 (after 795 days of uptime) to 14.6.0 but with no luck. Another thing I observed is, that for every REST poll an MQTT message is also published. So if I poll every second, I'll also get an MQTT message every second to the STATUS topic. Setup
I'm running the following SML-Script to read my smart meter:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I'm doing massive polling with Matter and I didn't see any outliers. This is maybe due to this specific driver |
Beta Was this translation helpful? Give feedback.
-
sml telegrams may be quite large, so you can increase serial irq buffer e.g. to 512 bytes (your complete sml telegrams should fit here) since the sml telegram is guarded by a crc checksum you may also add the compile option and then add this line to the descriptor: you also may also use script?sml[x] to query one sml data x being the decode line number you want so sml[4] would be "aktuelle Wirkleistung" (shorter result) |
Beta Was this translation helpful? Give feedback.
-
Just for the reference: Here are two PRs: |
Beta Was this translation helpful? Give feedback.
form the docs:
M,=so3 sets serial buffer size, serial IRQ buffer size and serial dump buffer size.
thus up to 3 parameters
is is essential that your irq buffer is large enough to fit your meters sml telegram. some meters have very large ones. so try with 1024 or even 1536
since the ESP8266 has only one core and no multitasking this is necessary. on an ESP32 this would be no issue.
IRQ buffer it is not set by the CRC option.
CRC check is an additional option that ensures data integrity. since sml telegrams have only on crc over the complete telegram your crc buffer has to be large enough
this is the correct polling format:
http:///cm?cmnd=script?sml[4]