Publish Smart Meter values every second #23611
Replies: 2 comments 3 replies
-
I don't think that you have to worry about workload and performance of the code, until you have specific issues; only "costly" thing is doing the publish. And using the scripter means that you cannot have rules too. What Berry would give you would be better programming features, not better performance. Are you aware that the meter metrics has a flag in |
Beta Was this translation helpful? Give feedback.
-
Okay, after some experimentation I modified my script like so:
Two key changes: Firstly, I simplified the script, getting rid of many variables. I think making them persistent had a big impact on performance. Second, I set the =so6 option of serial sync time to 500ms (default is 1s). This, if I understand correctly, will now sample the serial connection twice a second and not once. Secondly, I used >F to be sure to have a good granularity, but then determined the 1s interval by looking at whether the current second value reported by the meter has changed. Together, those changes make it report every second exactly (from an empirical test over a couple of minutes). I will close this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an ESP32 running Tasmota and the sensor53 driver that measures data from a smart meter every second.
As I would like to take full advantage of the second-granularity, I would like to receive a JSON MQTT message every second.
I know that teleperiod is limited to >= 10s, so reducing this won't work.
Instead, I wrote a script that should do it:
I am using the >F directive, as the >S directive is supposedly not reliable. However, writing it like this seems too much work, such then every couple seconds, some messages get lost. Is there any better possibility? I specifically do not want to set all metric precisions to 16, as this results in 14 separate messages that ought to be correlated. I am also interested in all metrics, not just power, so PowerDelta is not sufficient either.
I already tried to compute
ts
every >F and compare it with the last value but this is obviously more workload. Could I reduce this with a RULE? Will a Berry script be more performant?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions