shelly-script-examples icon indicating copy to clipboard operation
shelly-script-examples copied to clipboard

Stop the output after consuming certain amount of power

Open xally-pt opened this issue 1 year ago • 4 comments

I've tried this example using a Shelly plus plug, with a threshold of 20mw/h but it didn't work.

xally-pt avatar May 04 '23 22:05 xally-pt

I've tried this example using a Shelly plus plug, with a threshold of 20mw/h but it didn't work.

What value did you enter for "maxEnergy"?

What do you see in the console after the script is started and the load is enabled?

@xally-pt

taulfsime avatar May 05 '23 16:05 taulfsime

I've tried this example using a Shelly plus plug, with a threshold of 20mw/h but it didn't work.

What value did you enter for "maxEnergy"?

What do you see in the console after the script is started and the load is enabled?

@xally-pt

What value did you enter for "maxEnergy"? ---> 20; 120; 1; 500; but the result is always the same, nothing happens. i'm inputing these using the line let maxEnergy = 20; //threshold, in milliwatthours

The consumption I have is 26W.

This is the console output:

{"delta":{"aenergy":{"total":33.466000,"minute_ts":1683313739,"by_minute":[447.124000,0,0]},"id":0},"id":0,"name":"switch","component":"switch:0"} 20:09:01 {"delta":{"aenergy":{"total":33.917000,"minute_ts":1683313799,"by_minute":[451.374000,447.124000,0]},"id":0},"id":0,"name":"switch","component":"switch:0"} 20:10:01 {"delta":{"aenergy":{"total":34.366000,"minute_ts":1683313859,"by_minute":[448.824000,451.374000,447.124000]},"id":0},"id":0,"name":"switch","component":"switch:0"} 20:11:01 {"delta":{"aenergy":{"total":34.815000,"minute_ts":1683313919,"by_minute":[448.824000,448.824000,451.374000]},"id":0},"id":0,"name":"switch","component":"switch:0"} 20:12:01

xally-pt avatar May 05 '23 19:05 xally-pt

@xally-pt Thank you! Please open the script, go at line 29 and 30, and replace the word "output" with "state". Example: event.info.output -> event.info.state

taulfsime avatar May 05 '23 19:05 taulfsime

Updated with https://github.com/ALLTERCO/shelly-script-examples/pull/97

taulfsime avatar May 04 '24 16:05 taulfsime