What is the easiest/best way to switch a device on/off based on how long a device has been on (running) for during the current day (since 00 hours) or the last 7 days?
I have been the time at which the device is turned on and off in SQLite. I have had great difficulties determining the required queries to find the required information. I figure this must be something that many people want to do, so hopefully there is a node or example I can work from.
Any help would be appreciated.
A bit more detail needed ?? Is the on/off sacrosanct and must survive a restart of Node-red ?
Will the two conditions interact ? i.e. it has run longer during the week than the set point , but not longer than the daily setpoint ?
Essentially the easiest way is to create a countdown timer - and monitor that for when it expires - have a look at Ncherrys mytimeout node - should be able to do what you want
Feed the input with whatever it is that triggers the start of the runtime - feed the output of both into a node to act on the off condition - be it MQTT message sending etc
Craig
Thanks for this. It looks like it might be the way to go.
Excellent thanks for letting us know
Maybe mark it as solved when you confirm it works
Craig