Update timers and set relay state accordingly #22663
Unanswered
paolomeraviglia
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
My electric company applies 2 different fairs during the day, with variable "slots".
In short, instead of having static low-high fares periods (eg. from 8 am to 8 pm high fare, from 8pm to 8am low fare) you get at midday the start and end time for the low fares for the next day.
I wrote a python script that when executed return timers configurations accordingly, enabling the relay only during low fares, in that way:
this example reflect the condition:
to explain:
Timers 1
is used to be sure all the timers are enabledTime 0
is used to forcefully sync with NTP when this script is executedBacklog ...
is used to setup all the necessary things (location, timezone, etc.)This script is working fine, and the device update itself properly.
Consider that now the script is executed thanks to a rule that, as soon as the device connects to internet, will download this script and execute the commands inside.
The goal of this post is getting rid of the last line,
Power1 0
, and execute locally a script that, according to the file, will decide the status of the Power1 relay.I can, of course, append everything on the same script, or execute something using the rules.
Any recommendations?
Beta Was this translation helpful? Give feedback.
All reactions