Open bjorne opened 5 years ago
This is a superb idea. I wish there was a timer attached to the "temporary_on" message after which it will automatically send an off message and return to normal auto mode. This scenario is ideal for things like robot vacuum cleaners for which there can be a predefined schedule as well as a temporary_on with a timer to stop cleaning after a certain amount of time 👍
Hello! I need exact the same function. Turn the lights off when I go to bed earlier as expected by the schedule (for example by override "off") but switch back to Auto on the next morning by the schedule. Regards
I am not sure if this helps, but it is something similar I came up with for my use case.
This functionally is possible to achieve using the default nodes. I included the aedes mqtt broker in the flow to ease illustration in the example.
Basically it allows manual overrides for the light with the ability to return to the schedules functionality by storing the Light schedulers output in an mqtt topic. It also has the functionality to "turn off" or ignore the schedules output while "LS OFF" is selected.
You could add an additional flow with a timer to toggle between "LS-OFF" and "AUTO" to set automatic temporary overrides.
Example Flow Below:
[{"id":"f6f2187d.f17ca8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4fe0b93.de8e8c8","type":"aedes broker","z":"f6f2187d.f17ca8","name":"","mqtt_port":1883,"mqtt_ws_port":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":170,"y":60,"wires":[[]]},{"id":"66be8603.8ea388","type":"mqtt out","z":"f6f2187d.f17ca8","name":"","topic":"control/state","qos":"","retain":"","broker":"1995de0d.2153ea","x":590,"y":320,"wires":[]},{"id":"5931ea4e.ca9a5c","type":"inject","z":"f6f2187d.f17ca8","name":"Light ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":340,"y":200,"wires":[["66be8603.8ea388","285c67a0.07abf"]]},{"id":"4e3d1d6d.0e425c","type":"inject","z":"f6f2187d.f17ca8","name":"Light OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":340,"y":240,"wires":[["66be8603.8ea388","285c67a0.07abf"]]},{"id":"2987e4de.29f724","type":"inject","z":"f6f2187d.f17ca8","name":" AUTO","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"AUTO","payloadType":"str","x":330,"y":280,"wires":[["66be8603.8ea388"]]},{"id":"7197fdb0.63694c","type":"mqtt out","z":"f6f2187d.f17ca8","name":"","topic":"LS_output","qos":"","retain":"","broker":"1995de0d.2153ea","x":1010,"y":240,"wires":[]},{"id":"1f29e368.1d6795","type":"inject","z":"f6f2187d.f17ca8","name":"ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":830,"y":200,"wires":[["7197fdb0.63694c"]]},{"id":"14b8964a.56765a","type":"inject","z":"f6f2187d.f17ca8","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":830,"y":240,"wires":[["7197fdb0.63694c"]]},{"id":"8d988fb8.6eaf58","type":"mqtt in","z":"f6f2187d.f17ca8","name":"","topic":"control/state","qos":"2","datatype":"auto","broker":"1995de0d.2153ea","x":350,"y":460,"wires":[["ded5567c.b390e8"]]},{"id":"15a758e.03e76a7","type":"mqtt in","z":"f6f2187d.f17ca8","name":"","topic":"LS_output","qos":"2","datatype":"auto","broker":"1995de0d.2153ea","x":340,"y":400,"wires":[["ded5567c.b390e8"]]},{"id":"ded5567c.b390e8","type":"join","z":"f6f2187d.f17ca8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":510,"y":460,"wires":[["ae7db69a.e7f45"]]},{"id":"b1226254.401f08","type":"debug","z":"f6f2187d.f17ca8","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":460,"wires":[]},{"id":"ae7db69a.e7f45","type":"switch","z":"f6f2187d.f17ca8","name":"IS AUTO","property":"payload[\"control/state\"]","propertyType":"msg","rules":[{"t":"eq","v":"AUTO","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":640,"y":460,"wires":[["aa1124d1.cb8b3"]]},{"id":"aa1124d1.cb8b3","type":"change","z":"f6f2187d.f17ca8","name":"set payload to LS_output","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.LS_output","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":500,"wires":[["c434ccb1.10648"]]},{"id":"5627d001.fb5fe","type":"debug","z":"f6f2187d.f17ca8","name":"LIGHT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1060,"y":500,"wires":[]},{"id":"c5a00492.ded3a","type":"comment","z":"f6f2187d.f17ca8","name":"Put LS scheduler node here","info":"https://flows.nodered.org/node/node-red-contrib-light-scheduler","x":820,"y":160,"wires":[]},{"id":"f6f035b0.38c29","type":"comment","z":"f6f2187d.f17ca8","name":"Override controls","info":"","x":320,"y":140,"wires":[]},{"id":"1b3fcab2.a9f8ad","type":"inject","z":"f6f2187d.f17ca8","name":"LS OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"LS OFF","payloadType":"str","x":330,"y":320,"wires":[["66be8603.8ea388"]]},{"id":"ea312a1d.317fe8","type":"comment","z":"f6f2187d.f17ca8","name":"AUTO","info":"The light will be controlled fully by the LS scheduler node.\n\nSetting to Auto will have the light resume the function of the schedule, if even if the schedule changed the lights state while the schedule output was overrided.","x":170,"y":280,"wires":[]},{"id":"61b21130.d57118","type":"comment","z":"f6f2187d.f17ca8","name":"LS OFF","info":"Turns off the schdule output.\n\nFor example, If you want a snooze button for a light scheduled to come on in the morning.\n\n","x":170,"y":320,"wires":[]},{"id":"eeadd225.6b5708","type":"comment","z":"f6f2187d.f17ca8","name":"Manually force light ON","info":"","x":120,"y":200,"wires":[]},{"id":"ead887f5.3391d8","type":"comment","z":"f6f2187d.f17ca8","name":"Manually force light OFF","info":"","x":130,"y":240,"wires":[]},{"id":"c434ccb1.10648","type":"mqtt out","z":"f6f2187d.f17ca8","name":"","topic":"light","qos":"","retain":"","broker":"1995de0d.2153ea","x":1070,"y":540,"wires":[]},{"id":"285c67a0.07abf","type":"mqtt out","z":"f6f2187d.f17ca8","name":"","topic":"light","qos":"","retain":"","broker":"1995de0d.2153ea","x":570,"y":200,"wires":[]},{"id":"243b0291.a4c376","type":"debug","z":"f6f2187d.f17ca8","name":"light status","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":620,"wires":[]},{"id":"39cbe5e9.481fa2","type":"mqtt in","z":"f6f2187d.f17ca8","name":"","topic":"light","qos":"2","datatype":"auto","broker":"1995de0d.2153ea","x":330,"y":620,"wires":[["243b0291.a4c376"]]},{"id":"1995de0d.2153ea","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
First, thanks for a superb node.
I have a scenario where I have a on/off switch that overrides the schedule, much like the motion detection example in the docs. However, I would like the override to disappear only after the next schedule event change. For example, if I override the schedule and turn the lights off when I go to bed with the switch, I want them to turn on the next evening again like normal. I think that this is how bigtimer works:
I can see that the current override mechanism makes sense for some cases as well. Two reasonable ways of implementing this:
temporary_on
andtemporary_off
What do you think? If you think it makes sense I'd be happy to write some code. What I hope for the most, though, is that I missed something and this is possible already.