[{"id":"de3f81b5.8f7a1","type":"smartswitch","z":"7355e642.932538","name":"","topic":"FAMILY ROOM","timeout":"0","x":1020,"y":40,"wires":[["256d0392.f2548c","6a95b7c5.5901f8"]]},{"id":"256d0392.f2548c","type":"function","z":"7355e642.932538","name":"message","func":"\nmsg.payload = {chatId : 1111111111, type : 'message', content : msg.topic + ' ' + msg.payload}\nreturn msg;","outputs":1,"noerr":0,"x":1220,"y":580,"wires":[["17e458c3.0a9dd7"]]},{"id":"e9e54225.8596","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"FAMILY ROOM","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":580,"y":40,"wires":[["de3f81b5.8f7a1"]]},{"id":"9f1060a7.917e7","type":"telegram command","z":"7355e642.932538","name":"1","command":"/1","bot":"b7d63749.957328","strict":false,"x":430,"y":40,"wires":[["e9e54225.8596"],[]]},{"id":"17e458c3.0a9dd7","type":"telegram sender","z":"7355e642.932538","name":"","bot":"b7d63749.957328","x":1190,"y":620,"wires":[[]]},{"id":"6a95b7c5.5901f8","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"31","set":"","level":"0","freq":"","out":"out","x":1220,"y":40,"wires":[]},{"id":"276f44b5.15badc","type":"smartswitch","z":"7355e642.932538","name":"","topic":"MASTER ROOM","timeout":"0","x":1010,"y":100,"wires":[["256d0392.f2548c","ae5f077f.3ff778"]]},{"id":"2a2882d0.7a860e","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"MASTER ROOM","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":590,"y":100,"wires":[["276f44b5.15badc"]]},{"id":"3b00a66d.53ccca","type":"telegram command","z":"7355e642.932538","name":"2","command":"/2","bot":"b7d63749.957328","strict":false,"x":430,"y":100,"wires":[["2a2882d0.7a860e"],[]]},{"id":"ae5f077f.3ff778","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"35","set":"","level":"0","freq":"","out":"out","x":1220,"y":100,"wires":[]},{"id":"1555e300.febb3d","type":"smartswitch","z":"7355e642.932538","name":"","topic":"SPARE ROOM","timeout":"0","x":1020,"y":160,"wires":[["cf195a42.e37138","256d0392.f2548c"]]},{"id":"428859f3.c337b8","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"SPARE ROOM","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":580,"y":160,"wires":[["1555e300.febb3d"]]},{"id":"acc831f6.7e79c","type":"telegram command","z":"7355e642.932538","name":"3","command":"/3","bot":"b7d63749.957328","strict":false,"x":430,"y":160,"wires":[["428859f3.c337b8"],[]]},{"id":"cf195a42.e37138","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"37","set":"","level":"0","freq":"","out":"out","x":1220,"y":160,"wires":[]},{"id":"d5ae8f6d.29fb7","type":"smartswitch","z":"7355e642.932538","name":"","topic":"BATH ROOM","timeout":"0","x":1020,"y":220,"wires":[["1c52ef1b.564ee1","256d0392.f2548c"]]},{"id":"f29f49d0.5e83d8","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"BATH ROOM","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":580,"y":220,"wires":[["d5ae8f6d.29fb7"]]},{"id":"63f4be8a.26e26","type":"telegram command","z":"7355e642.932538","name":"4","command":"/4","bot":"b7d63749.957328","strict":false,"x":430,"y":220,"wires":[["f29f49d0.5e83d8"],[]]},{"id":"1c52ef1b.564ee1","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"40","set":"","level":"0","freq":"","out":"out","x":1220,"y":220,"wires":[]},{"id":"e960192d.a38eb8","type":"smartswitch","z":"7355e642.932538","name":"","topic":"DINING ROOM","timeout":"0","x":1020,"y":280,"wires":[["6977e098.fc119","256d0392.f2548c"]]},{"id":"73f44d0e.198ee4","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"DINING ROOM","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":580,"y":280,"wires":[["e960192d.a38eb8"]]},{"id":"56b17b98.f41454","type":"telegram command","z":"7355e642.932538","name":"5","command":"/5","bot":"b7d63749.957328","strict":false,"x":430,"y":280,"wires":[["73f44d0e.198ee4"],[]]},{"id":"6977e098.fc119","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"38","set":"","level":"0","freq":"","out":"out","x":1220,"y":280,"wires":[]},{"id":"46d2e0f2.e1f53","type":"smartswitch","z":"7355e642.932538","name":"","topic":"KITCHEN","timeout":"0","x":1040,"y":340,"wires":[["b3179bd2.876b68","256d0392.f2548c"]]},{"id":"82b9415a.b5f4a","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"KITCHEN","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":560,"y":340,"wires":[["46d2e0f2.e1f53"]]},{"id":"d8b3b639.d83748","type":"telegram command","z":"7355e642.932538","name":"6","command":"/6","bot":"b7d63749.957328","strict":false,"x":430,"y":340,"wires":[["82b9415a.b5f4a"],[]]},{"id":"b3179bd2.876b68","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"36","set":"","level":"0","freq":"","out":"out","x":1220,"y":340,"wires":[]},{"id":"7758da3a.822b74","type":"smartswitch","z":"7355e642.932538","name":"","topic":"OFFICE","timeout":"0","x":1040,"y":400,"wires":[["cda27a8c.71f918","256d0392.f2548c"]]},{"id":"68ad4f5a.5c2bc","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"OFFICE","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":560,"y":400,"wires":[["7758da3a.822b74"]]},{"id":"e310bdf9.e73e3","type":"telegram command","z":"7355e642.932538","name":"7","command":"/7","bot":"b7d63749.957328","strict":false,"x":430,"y":400,"wires":[["68ad4f5a.5c2bc"],[]]},{"id":"cda27a8c.71f918","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"33","set":"","level":"0","freq":"","out":"out","x":1220,"y":400,"wires":[]},{"id":"2ebcf200.ed873e","type":"smartswitch","z":"7355e642.932538","name":"","topic":"PATIO","timeout":"0","x":1050,"y":460,"wires":[["7321f9ad.15e358","256d0392.f2548c"]]},{"id":"b3880aa1.7a5f48","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"PATIO","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":550,"y":460,"wires":[["2ebcf200.ed873e"]]},{"id":"16ed2318.9c3cdd","type":"telegram command","z":"7355e642.932538","name":"8","command":"/8","bot":"b7d63749.957328","strict":false,"x":430,"y":460,"wires":[["b3880aa1.7a5f48"],[]]},{"id":"7321f9ad.15e358","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"29","set":"","level":"0","freq":"","out":"out","x":1220,"y":460,"wires":[]},{"id":"399c10b9.6855e","type":"smartswitch","z":"7355e642.932538","name":"","topic":"DRIVEWAY","timeout":"0","x":1030,"y":520,"wires":[["8ab21e46.31aaa","256d0392.f2548c"]]},{"id":"dc42252e.2390a8","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"DRIVEWAY","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"toggle","x":570,"y":520,"wires":[["399c10b9.6855e"]]},{"id":"742e4124.6bde9","type":"telegram command","z":"7355e642.932538","name":"9","command":"/9","bot":"b7d63749.957328","strict":false,"x":430,"y":520,"wires":[["dc42252e.2390a8"],[]]},{"id":"8ab21e46.31aaa","type":"rpi-gpio out","z":"7355e642.932538","name":"","pin":"32","set":"","level":"0","freq":"","out":"out","x":1220,"y":520,"wires":[]},{"id":"aa65196e.2d1228","type":"ui_button","z":"7355e642.932538","name":"","group":"3ac4d831.cb06a8","order":0,"width":0,"height":0,"passthru":true,"label":"SLEEP","tooltip":"","color":"","bgcolor":"","icon":"","payload":"10","payloadType":"str","topic":"timeout","x":800,"y":600,"wires":[["399c10b9.6855e","2ebcf200.ed873e","7758da3a.822b74","46d2e0f2.e1f53","e960192d.a38eb8","d5ae8f6d.29fb7","1555e300.febb3d","276f44b5.15badc","de3f81b5.8f7a1"]]},{"id":"e6efcfd0.acf33","type":"telegram command","z":"7355e642.932538","name":"10","command":"/10","bot":"b7d63749.957328","strict":false,"x":430,"y":580,"wires":[["aa65196e.2d1228"],[]]},{"id":"f19ff37a.38678","type":"ui_switch","z":"7355e642.932538","name":"F R","label":"FAMILY ROOM","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":60,"wires":[["de3f81b5.8f7a1"]]},{"id":"710570cd.798a5","type":"ui_switch","z":"7355e642.932538","name":"M R","label":"MASTER ROOM","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":120,"wires":[["276f44b5.15badc"]]},{"id":"af619060.4745e","type":"ui_switch","z":"7355e642.932538","name":"S R","label":"SPARE ROOM","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":180,"wires":[["1555e300.febb3d"]]},{"id":"63b7cb7c.42d214","type":"ui_switch","z":"7355e642.932538","name":"B R","label":"BATH ROOM","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":240,"wires":[["d5ae8f6d.29fb7"]]},{"id":"804ac699.b9acc8","type":"ui_switch","z":"7355e642.932538","name":"D R","label":"DINING ROOM","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":300,"wires":[["e960192d.a38eb8"]]},{"id":"8dd2d4dc.d17ee8","type":"ui_switch","z":"7355e642.932538","name":"K","label":"KITCHEN","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":360,"wires":[["46d2e0f2.e1f53"]]},{"id":"c1223799.b32428","type":"ui_switch","z":"7355e642.932538","name":"O","label":"OFFICE","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":420,"wires":[["7758da3a.822b74"]]},{"id":"fa44cb6d.6dd7f8","type":"ui_switch","z":"7355e642.932538","name":"P","label":"PATIO","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":480,"wires":[["2ebcf200.ed873e"]]},{"id":"a7768b38.795df8","type":"ui_switch","z":"7355e642.932538","name":"D","label":"DRIVEWAY","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":770,"y":540,"wires":[["399c10b9.6855e"]]},{"id":"38f862cc.5b1fee","type":"ui_button","z":"7355e642.932538","name":"","group":"3a987860.bfdeb8","order":0,"width":0,"height":0,"passthru":true,"label":"sleep","tooltip":"","color":"","bgcolor":"","icon":"","payload":"5","payloadType":"str","topic":"timeout","x":250,"y":340,"wires":[["de3f81b5.8f7a1"]]},{"id":"c29782ba.6fb18","type":"rpi-gpio in","z":"7355e642.932538","name":"","pin":"11","intype":"tri","debounce":"25","read":true,"x":90,"y":260,"wires":[["38f862cc.5b1fee","d6a8dcad.2db35","a2e5e220.61b4b"]]},{"id":"e465983c.2fa4f8","type":"ui_switch","z":"7355e642.932538","name":"all","label":"ALL","tooltip":"","group":"85429dae.9a4b5","order":19,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"set","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":590,"y":580,"wires":[["a7768b38.795df8","fa44cb6d.6dd7f8","c1223799.b32428","8dd2d4dc.d17ee8","804ac699.b9acc8","63b7cb7c.42d214","af619060.4745e","710570cd.798a5","f19ff37a.38678"]]},{"id":"644f2a86.15f754","type":"inject","z":"7355e642.932538","name":"","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":90,"y":340,"wires":[["38f862cc.5b1fee","d6a8dcad.2db35","a2e5e220.61b4b"]]},{"id":"d6a8dcad.2db35","type":"ui_button","z":"7355e642.932538","name":"","group":"3a987860.bfdeb8","order":0,"width":0,"height":0,"passthru":true,"label":"on","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"state","x":250,"y":300,"wires":[["de3f81b5.8f7a1"]]},{"id":"a2e5e220.61b4b","type":"ui_button","z":"7355e642.932538","name":"","group":"3a987860.bfdeb8","order":0,"width":0,"height":0,"passthru":true,"label":"pir","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"set","x":250,"y":260,"wires":[["de3f81b5.8f7a1"]]},{"id":"3ac4d831.cb06a8","type":"ui_group","z":"","name":"light","tab":"ab92a34b.f6f13","disp":true,"width":"6","collapse":false},{"id":"b7d63749.957328","type":"telegram bot","z":"","botname":"LostPi","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","verboselogging":true},{"id":"85429dae.9a4b5","type":"ui_group","z":"","name":"timer","tab":"175d481c.72b628","disp":true,"width":"6","collapse":false},{"id":"3a987860.bfdeb8","type":"ui_group","z":"","name":"pir","tab":"ab92a34b.f6f13","disp":true,"width":"6","collapse":false},{"id":"ab92a34b.f6f13","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false},{"id":"175d481c.72b628","type":"ui_tab","z":"","name":"Home","icon":"home","order":"1"}]
hi guys, this is my first attempt at none-red/coding, and raspberry pi3
as you can see, everything above works pretty well (don't know why, lol) and i am quite happy with
the direction it is going.
the part that i need help with, is the bit (hack) on the left.
at the end of the day, there will be one p.i.r per light, and a switch on the dash and telegram
to enable/disable the function.
so the basics of its operation, is, when enabled, if the pir is activated, the light will go on and
will go off if there is no activity for a set time (simple right? lol)
you can test every scenarios as it is now, and you will see it works 'ok' except, i cant disable it, the pir must be triggered twice, if i switch on a light, it would switch off after pir is triggered and timed out, and then there is the fact of the unnecessary, extra buttons (the sleep one is useful and i will keep that function)
if you can help, i will appreciate it.