Though the dashboard is used, it is more the mechanics in which I am stuck.
There are a lot of foreign nodes (extras).
I'll try to include their names.
But here's the problem.
I have a schedule which has 3 states.
I'll call the states: HOME
, AWAY
, and OFF
.
HOME
: Every day at a given time a signal is sent to do things.
Locally a template
node indicates it is running.
After a time, another signal it sent to end things happening.
Likewise Locally the template
node gets another message to say it is .... sleeping (Waiting the next invocation).
AWAY
: Basically the same, but not every day.
OFF
: All things are stopped and the template
node is sent a different symbol indicating that all things are stopped.
The scan frequency is every minute.
Also, when it taken from OFF
to either of the other modes, the template
node gets a message updating its icon from the STOP to the SLEEP icon.
(Phew: Only one foreign node)
node-red-contrib-ui-time-scheduler
This is the basic mechanics of the flow. (From testing phase)
The RBE
nodes are doing weird things.
They were replaced with this one instead.
This also helps show me what is going on with the nodes.
The real flow is a bit more complicated but for now if I can be sure this works, I know I am going in the right direction.
If it doesn't, then it would explain why the bigger flow isn't working.
[{"id":"1203562e.70696a","type":"function","z":"6dd5ca4d.d1958c","name":"RBE","func":"if (msg.reset == true)\n{\n context.set(\"PREVIOUS\",0);\n return;\n}\nvar previous = context.get(\"PREVIOUS\") || 0;\nvar incoming = msg.payload;\n\nif (incoming == previous)\n{\n node.status({fill: \"red\"});\n return;\n} else\ncontext.set(\"PREVIOUS\",msg.payload);\nnode.status({fill: \"gren\"});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1740,"y":4690,"wires":[["be5910a4.a301d8","2f671020.e0ab8","24a824f6.7e1d5c"]]}]
[{"id":"315225bf.0e0a62","type":"file in","z":"bb2e50af.775dd8","name":"Plants","filename":"","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":670,"y":2270,"wires":[["ad43e469.e10b48"]]},{"id":"ad43e469.e10b48","type":"ui_time_scheduler","z":"bb2e50af.775dd8","group":"ecb4a309.eff9c","name":"Plants","refresh":"5","devices":["ScheduleHome","ScheduleNotHome"],"customPayload":false,"eventMode":false,"outputs":3,"order":5,"width":"6","height":"1","x":850,"y":2270,"wires":[[],["1b4144c4.5f2a83","dd599545.0ba668"],["ab4796e3.76a5e8","dd599545.0ba668"]]},{"id":"1b4144c4.5f2a83","type":"function","z":"bb2e50af.775dd8","name":"checkIfHome","func":"// THIS WILL ONLY SEND SOMETHING IF YOU ARE AT HOME\nif (flow.get(\"atHome\") === true) return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1050,"y":2270,"wires":[["3c72089.3472578"]]},{"id":"ab4796e3.76a5e8","type":"function","z":"bb2e50af.775dd8","name":"checkIfHome","func":"// THIS WILL ONLY SEND SOMETHING IF YOU ARE NOT AT HOME\nif (flow.get(\"atHome\") === false) return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1050,"y":2350,"wires":[["7ed31be2.7746b4"]]},{"id":"fee3973b.2df2f8","type":"ui_dropdown","z":"bb2e50af.775dd8","name":"am I at home","label":"","tooltip":"","place":"Select option","group":"ecb4a309.eff9c","order":2,"width":"4","height":"1","passthru":true,"multiple":false,"options":[{"label":"@Home","value":true,"type":"bool"},{"label":"not@Home","value":false,"type":"bool"},{"label":"Off","value":"off","type":"str"}],"payload":"","topic":"","x":690,"y":2110,"wires":[["c9214501.a9cca8"]]},{"id":"c9214501.a9cca8","type":"function","z":"bb2e50af.775dd8","name":"setAtHome","func":"flow.set(\"atHome\", msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","x":870,"y":2110,"wires":[[]]},{"id":"6cdb39f8.06c5b","type":"comment","z":"bb2e50af.775dd8","name":"Set your mode based on this dropdown","info":"","x":510,"y":2070,"wires":[]},{"id":"2834e59e.5f319a","type":"inject","z":"bb2e50af.775dd8","name":"SetValueAfterReboot","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":480,"y":2110,"wires":[["fee3973b.2df2f8"]]},{"id":"6cfe250b.58581c","type":"comment","z":"bb2e50af.775dd8","name":"Scheduler now has \"2 devices\" but we use them as \"home\" and \"not home schedule\"","info":"","x":650,"y":2210,"wires":[]},{"id":"249ffc69.998a8c","type":"inject","z":"bb2e50af.775dd8","name":"loadFileAfterReboot","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":290,"y":2270,"wires":[["ae40d4b2.fc7bc"]]},{"id":"ae40d4b2.fc7bc","type":"function","z":"bb2e50af.775dd8","name":"build message","func":"var path = global.get(\"event_paths\");\nmsg.filename = path + \"test.txt\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":495,"y":2270,"wires":[["315225bf.0e0a62"]]},{"id":"c2ebe9e1.73b57","type":"change","z":"bb2e50af.775dd8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"atHome","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":2530,"wires":[["f29666d8.1fae8"]]},{"id":"13c0a3bc.293c14","type":"switch","z":"bb2e50af.775dd8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":690,"y":2530,"wires":[[],[],["f94c9c1e.dfb07","8db44b08.e8c148"]]},{"id":"8db44b08.e8c148","type":"trigger","z":"bb2e50af.775dd8","name":"OFF","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"900","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1340,"y":2480,"wires":[[]]},{"id":"d0724347.466218","type":"trigger","z":"bb2e50af.775dd8","name":"HOME","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"900","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1340,"y":2270,"wires":[[]]},{"id":"641984a1.1354a4","type":"trigger","z":"bb2e50af.775dd8","name":"AWAY","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"900","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1340,"y":2350,"wires":[[]]},{"id":"3c72089.3472578","type":"rbe","z":"bb2e50af.775dd8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1220,"y":2270,"wires":[["d0724347.466218","673b2d.f14bc4d4"]]},{"id":"7ed31be2.7746b4","type":"rbe","z":"bb2e50af.775dd8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1220,"y":2350,"wires":[["641984a1.1354a4","b8f82aae.078f58"]]},{"id":"f94c9c1e.dfb07","type":"change","z":"bb2e50af.775dd8","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":2440,"wires":[["3c72089.3472578","7ed31be2.7746b4"]]},{"id":"4b13bfcd.886ac8","type":"inject","z":"bb2e50af.775dd8","name":"HOME","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":340,"y":2350,"wires":[["5d95836a.1b91e4"]]},{"id":"5d95836a.1b91e4","type":"change","z":"bb2e50af.775dd8","name":"","rules":[{"t":"set","p":"atHome","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":2400,"wires":[[]]},{"id":"9b229bc4.156228","type":"inject","z":"bb2e50af.775dd8","name":"AWAY","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":340,"y":2400,"wires":[["5d95836a.1b91e4"]]},{"id":"9436244b.5e6a38","type":"inject","z":"bb2e50af.775dd8","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":340,"y":2450,"wires":[["5d95836a.1b91e4"]]},{"id":"673b2d.f14bc4d4","type":"debug","z":"bb2e50af.775dd8","name":"HOME","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1340,"y":2210,"wires":[]},{"id":"b8f82aae.078f58","type":"debug","z":"bb2e50af.775dd8","name":"AWAY","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1340,"y":2410,"wires":[]},{"id":"f29666d8.1fae8","type":"rbe","z":"bb2e50af.775dd8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":510,"y":2530,"wires":[["13c0a3bc.293c14","9c576dbb.129e68"]]},{"id":"9c576dbb.129e68","type":"trigger","z":"bb2e50af.775dd8","name":"CLOCK","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"900","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":520,"y":2570,"wires":[[]]},{"id":"2d37930a.c1bf8c","type":"link in","z":"bb2e50af.775dd8","name":"","links":["dd599545.0ba668","c348ffc7.10c17"],"x":215,"y":2530,"wires":[["c2ebe9e1.73b57","27a38849.419878"]]},{"id":"dd599545.0ba668","type":"link out","z":"bb2e50af.775dd8","name":"","links":["2d37930a.c1bf8c"],"x":995,"y":2400,"wires":[]},{"id":"27a38849.419878","type":"trigger","z":"bb2e50af.775dd8","name":"CLOCK","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"900","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":320,"y":2570,"wires":[[]]},{"id":"ecb4a309.eff9c","type":"ui_group","name":"TempDemo","tab":"2936b813.6cde68","order":4,"disp":true,"width":"8","collapse":false},{"id":"2936b813.6cde68","type":"ui_tab","name":"Scheduler Demo","icon":"dashboard","order":21,"disabled":false,"hidden":false}]