windkh / node-red-contrib-shelly

Shelly control nodes for node red.
MIT License
34 stars 21 forks source link

Fix too many calls due to power updates #146

Closed Solarer closed 8 months ago

Solarer commented 9 months ago

Fixes issue #142 where the call back script would crash on Shelly PLUS 2PM devices because after pressing a button the device reports power and current updates with a high frequency - each triggering a CallNodeRed function call.

windkh commented 9 months ago

Hm... that means that you won't get any updates for that types of events at all. Why do you get so many of em in your device? I would normally expect that this event is only issued every few seconds or minutes (like the temperature or the battery level). Is there any documentation about the update frequency of those events?

Solarer commented 9 months ago

Well, power and current can change multiple times per second. Battery and temperature are slower and need less updates. I guess one could put a rate limiter on that call to only report changes once or twice per second and drop the others or calculate an average since the last transmission and send that instead.

Solarer commented 9 months ago

I have not checked if documentation is available but the rate can certainly be higher than what that function call can handle :/

Solarer commented 9 months ago

I have not checked if documentation is available but the rate can certainly be higher than what that function call can handle :/ Currently the script crashes for me as soon as any button is pressed. So not getting any power information is really no problem for me. I am not familiar with how the script is published but maybe a version with power reading an one without would be a solution

windkh commented 8 months ago

Yes indeed that is exactly what I also thought

windkh commented 8 months ago

thanx alot