-
Notifications
You must be signed in to change notification settings - Fork 4
Using globals
cflurin edited this page Jul 23, 2018
·
3 revisions
[{"id":"57146a34.3b9624","type":"schedex","z":"cb099c1f.9ea6b","name":"Cambridge","suspended":false,"lat":"52.0","lon":"0.0","ontime":"sunrise","ontopic":"sunrise","onpayload":"sunrise","onoffset":0,"onrandomoffset":0,"offtime":"sunset","offtopic":"sunset","offpayload":"sunset","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":270,"y":120,"wires":[["c633ff86.9c164"]]},{"id":"fba3b59e.fbd1b8","type":"inject","z":"cb099c1f.9ea6b","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["57146a34.3b9624"]]},{"id":"3874c0cb.f0509","type":"inject","z":"cb099c1f.9ea6b","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":140,"wires":[["57146a34.3b9624"]]},{"id":"c633ff86.9c164","type":"dsm","z":"cb099c1f.9ea6b","name":"sun","sm_config":"{\n \"stateOutput\": \"payload\",\n \"globalOutput\": \"day-state\",\n \"currentState\": \"undefined\",\n \"states\": {\n \"undefined\": {\n \"sunrise\": \"day-time\",\n \"sunset\": \"night-time\"\n },\n \"day-time\": {\n \"sunset\": \"night-time\"\n },\n \"night-time\": {\n \"sunrise\": \"day-time\"\n }\n }\n}","x":610,"y":120,"wires":[[]]},{"id":"faff4404.476058","type":"inject","z":"cb099c1f.9ea6b","name":"motion detected","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":280,"wires":[["fb5fa2ee.f5cf4"]]},{"id":"d45eb7.78e28148","type":"debug","z":"cb099c1f.9ea6b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":570,"y":280,"wires":[]},{"id":"3c7897ce.b91c18","type":"comment","z":"cb099c1f.9ea6b","name":"set day-state","info":"","x":110,"y":40,"wires":[]},{"id":"64973c9.e0c77c4","type":"comment","z":"cb099c1f.9ea6b","name":"use day-state e.g. to turn on the light in the night","info":"","x":220,"y":220,"wires":[]},{"id":"fb5fa2ee.f5cf4","type":"dsm","z":"cb099c1f.9ea6b","name":"day state","sm_config":"{\n \"methods\": {\n \"onTransition\": \"if(global.get('day-state')==='night-time') {msg.payload='on';sta.fill='yellow';output=true;} else {msg.payload='off';sta.fill='grey';}\",\n \"status\": {\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"msg.payload\"\n }\n }\n }\n}","x":370,"y":280,"wires":[["d45eb7.78e28148"]]}]