ALLTERCO / shelly-script-examples

Shelly Scripts for Gen2 Shelly devices
Apache License 2.0
189 stars 55 forks source link

Stop the output after consuming certain amount of power #43

Closed xally-pt closed 4 months ago

xally-pt commented 1 year ago

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

taulfsime commented 1 year ago

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

xally-pt commented 1 year ago

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

taulfsime commented 1 year ago

@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 commented 4 months ago

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