-
Notifications
You must be signed in to change notification settings - Fork 0
/
flows_raspberrypi.json
1 lines (1 loc) · 54 KB
/
flows_raspberrypi.json
1
[{"id":"cc2f7188.b9b58","type":"tab","label":"Hal en slaapkamers","disabled":false,"info":""},{"id":"fc876bed.f64e78","type":"tab","label":"Woonkamer en keuken","disabled":false,"info":""},{"id":"1b8d0302.3b99dd","type":"tab","label":"Schuren&Buiten","disabled":false,"info":""},{"id":"1b687fc0.3119a","type":"tab","label":"Tech","disabled":false,"info":""},{"id":"68d20bcc.290744","type":"tab","label":"Meters","disabled":false,"info":""},{"id":"f449dd24.dddea","type":"tab","label":"Boven","disabled":false,"info":""},{"id":"b201b1db.82068","type":"tab","label":"Action lamp","disabled":false,"info":""},{"id":"e612a1ff.325b7","type":"mqtt-broker","z":"","name":"localhost","broker":"192.168.178.9","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"c780d0a9.208f2","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"900b3f55.35083","type":"ui_group","z":"","name":"Tech","tab":"305d987f.3eac58","disp":true,"width":"6","collapse":false},{"id":"305d987f.3eac58","type":"ui_tab","z":"","name":"Tech","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"e77a892c.3ac718","type":"ui_group","z":"","name":"Huis","tab":"8db7349a.6bc248","order":1,"disp":false,"width":"6","collapse":false},{"id":"508c2b07.a17104","type":"mqtt-broker","z":"","name":"","broker":"mqtt.gbridge.io","port":"8883","tls":"d56b111.7045df","clientid":"","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d56b111.7045df","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"mqtt.gbridge.io","verifyservercert":true},{"id":"8c562e4.8d782d","type":"ui_group","z":"","name":"Grafieken","tab":"9e97c34.492814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1736530a.4e7c5d","type":"ui_group","z":"","name":"Keuken","tab":"8db7349a.6bc248","order":7,"disp":true,"width":"6","collapse":false},{"id":"f207d8fc.eed158","type":"ui_group","z":"","name":"Woonkamer","tab":"8db7349a.6bc248","order":5,"disp":true,"width":"6","collapse":false},{"id":"1fff63f6.7d35dc","type":"ui_group","z":"","name":"Hal","tab":"8db7349a.6bc248","order":8,"disp":true,"width":"6","collapse":false},{"id":"69b46b09.2f9984","type":"ui_group","z":"","name":"Slaapkamers","tab":"8db7349a.6bc248","order":3,"disp":true,"width":"6","collapse":false},{"id":"56a6f242.84dc0c","type":"ui_group","z":"","name":"Badkamer","tab":"8db7349a.6bc248","order":6,"disp":true,"width":"6","collapse":false},{"id":"78734a8f.4b2564","type":"ui_group","z":"","name":"Time","tab":"8db7349a.6bc248","order":4,"disp":false,"width":"6","collapse":false},{"id":"9e97c34.492814","type":"ui_tab","z":"","name":"Grafieken","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"8db7349a.6bc248","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"d257b270.33baa","type":"ui_group","z":"","name":"Buiten","tab":"8db7349a.6bc248","order":2,"disp":true,"width":"6","collapse":false},{"id":"e32e35c0.4fc158","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"hal_west","name":"","maxOn":"1800","relaisNo":"","minInterval":1000,"x":300,"y":200,"wires":[["faa63c4e.af42e","c9e666e.6f05698"]]},{"id":"faa63c4e.af42e","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Hal","tooltip":"","group":"1fff63f6.7d35dc","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":290,"y":260,"wires":[["e32e35c0.4fc158"]]},{"id":"bbaf8a38.374ae8","type":"mqtt in","z":"1b687fc0.3119a","name":"","topic":"+/+/STATUS5","qos":"2","datatype":"auto","broker":"e612a1ff.325b7","x":210,"y":200,"wires":[["cdd0b88c.780d68"]]},{"id":"cdd0b88c.780d68","type":"function","z":"1b687fc0.3119a","name":"IPextracter","func":"var knownDevices = context.get('knownDevices') || {}\nvar res = JSON.parse(msg.payload).StatusNET;\nvar {Hostname, ...rest} = res\n\nif (!knownDevices[Hostname]){\n knownDevices[Hostname]=rest\n \n}\ncontext.set('knownDevices', knownDevices)\nreturn {\n topic:Hostname, \n payload: knownDevices\n}","outputs":1,"noerr":0,"x":390,"y":260,"wires":[["d9f4a15f.3d5d3"]]},{"id":"d9f4a15f.3d5d3","type":"ui_template","z":"1b687fc0.3119a","group":"900b3f55.35083","name":"","order":0,"width":"6","height":"9","format":"<div id=\"{{'my_'+$id}}\" >\n \n \n</div>\n<script>\n(function(scope) {\n scope.$watch('msg', function(msg) {\n if (msg) {\n var container = $(\"#my_\"+scope.$id)\n container.children().remove();\n for (var name in msg.payload){\n var elem = msg.payload[name];\n container.append(`<a target=\"_blank\" href=\"http://${elem.IPAddress}\">${name}</a><br/>`)\n }\n }\n });\n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":640,"y":260,"wires":[[]]},{"id":"e3a9bdef.37b27","type":"mqtt in","z":"1b687fc0.3119a","name":"","topic":"#","qos":"2","datatype":"auto","broker":"e612a1ff.325b7","x":270,"y":100,"wires":[["837f1972.c0b288"]]},{"id":"837f1972.c0b288","type":"function","z":"1b687fc0.3119a","name":"discovery","func":"var knownDevices = context.get('knownDevices') || {}\n\nvar topic=msg.topic.split('/')[1]\nif (!knownDevices[topic]){\n knownDevices[topic]={}\n node.send({\n topic:`cmnd/${topic}/Status`,\n payload: '5'\n })\n}\ncontext.set('knownDevices', knownDevices)\nreturn [null,msg]","outputs":2,"noerr":0,"x":460,"y":140,"wires":[["23c07487.0a002c"],[]]},{"id":"23c07487.0a002c","type":"mqtt out","z":"1b687fc0.3119a","name":"","topic":"","qos":"","retain":"","broker":"e612a1ff.325b7","x":676.5,"y":173,"wires":[]},{"id":"c9e666e.6f05698","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"hal_oost","name":"","maxOn":"1800","relaisNo":"","minInterval":1000,"x":300,"y":120,"wires":[["e32e35c0.4fc158","aebce342.de008"]]},{"id":"aebce342.de008","type":"Sonoff RF","z":"cc2f7188.b9b58","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"night","rfType":"pir","lat":"52.668872","lon":"6.297246","start":"goldenHourEnd","startOffset":0,"end":"goldenHour","endOffset":0,"offAfter":300,"offObey":"10","name":"Pir hal","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"EB490E","x":290,"y":60,"wires":[["c9e666e.6f05698"]]},{"id":"467805e7.b134dc","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"WK_stalamp","name":"","maxOn":"18000","minInterval":1000,"x":350,"y":87,"wires":[["5b6b2bf9.5fdf24"]]},{"id":"7f08e9e9.d3e488","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"WK_spots","name":"","maxOn":"18000","minInterval":1000,"x":350,"y":320,"wires":[["7804f7a3.a01e78"]]},{"id":"1ed6cb71.6e1365","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"WK_eettafel","name":"","maxOn":"18000","minInterval":1000,"x":350,"y":220,"wires":[["f59836dc.1b0af8","882810ae.40f79"]]},{"id":"944712a6.7f36","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"WK_spots_haard","name":"","maxOn":"18000","minInterval":1000,"x":370,"y":440,"wires":[["dbf8b2ac.ec715"]]},{"id":"5b6b2bf9.5fdf24","type":"ui_switch","z":"fc876bed.f64e78","name":"","label":"Stalamp","tooltip":"","group":"f207d8fc.eed158","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":340,"y":160,"wires":[["467805e7.b134dc"]]},{"id":"f59836dc.1b0af8","type":"ui_switch","z":"fc876bed.f64e78","name":"","label":"Eettafel","tooltip":"","group":"f207d8fc.eed158","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":340,"y":260,"wires":[["1ed6cb71.6e1365"]]},{"id":"7804f7a3.a01e78","type":"ui_switch","z":"fc876bed.f64e78","name":"","label":"Spots","tooltip":"","group":"f207d8fc.eed158","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":330,"y":380,"wires":[["7f08e9e9.d3e488"]]},{"id":"dbf8b2ac.ec715","type":"ui_switch","z":"fc876bed.f64e78","name":"","label":"Haard","tooltip":"","group":"f207d8fc.eed158","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":330,"y":500,"wires":[["944712a6.7f36"]]},{"id":"882810ae.40f79","type":"Sonoff RF","z":"fc876bed.f64e78","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"0","offObey":"10","name":"Woonkamer","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"3F8CF8,880898","x":130,"y":320,"wires":[["1ed6cb71.6e1365","467805e7.b134dc","7f08e9e9.d3e488","944712a6.7f36"]]},{"id":"28042874.fdd6b8","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"slaapkamer","name":"Master","maxOn":"900","minInterval":1000,"x":570,"y":100,"wires":[["a0f9d858.6d7bd8","e3333c21.d302f","ec597005.d06db"]]},{"id":"a0f9d858.6d7bd8","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Master","tooltip":"","group":"69b46b09.2f9984","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":570,"y":180,"wires":[["28042874.fdd6b8"]]},{"id":"e3333c21.d302f","type":"Sonoff RF","z":"cc2f7188.b9b58","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"0","offObey":"10","name":"Knop bed","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"F18B58,611A68","x":580,"y":40,"wires":[["28042874.fdd6b8"]]},{"id":"ec597005.d06db","type":"Sonoff RF","z":"cc2f7188.b9b58","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"0","offObey":"10","name":"Knop paal","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"B3DC38","x":580,"y":240,"wires":[["28042874.fdd6b8"]]},{"id":"b3ffc358.b2865","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"BK_klein","name":"","maxOn":"900","minInterval":1000,"x":300,"y":440,"wires":[["b0fff328.32711","f35c816b.aa409"]]},{"id":"b0fff328.32711","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Badkamer Guus&Eef","tooltip":"","group":"56a6f242.84dc0c","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":340,"y":500,"wires":[["b3ffc358.b2865"]]},{"id":"f35c816b.aa409","type":"Sonoff RF","z":"cc2f7188.b9b58","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"0","offObey":"10","name":"Knop badkamer","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"A9B958","x":320,"y":380,"wires":[["b3ffc358.b2865"]]},{"id":"eaa0c13f.f85c2","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"guus","name":"","maxOn":"900","minInterval":1000,"x":590,"y":400,"wires":[["a71ae4c8.412348","a947bdca.5235c"]]},{"id":"a71ae4c8.412348","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Guus","tooltip":"","group":"69b46b09.2f9984","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":590,"y":460,"wires":[["eaa0c13f.f85c2"]]},{"id":"a947bdca.5235c","type":"Sonoff RF","z":"cc2f7188.b9b58","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"0","offObey":"10","name":"Knop guus","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"E8B6F8","x":610,"y":340,"wires":[["eaa0c13f.f85c2"]]},{"id":"de45d5bc.7e31b8","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"evy","name":"","maxOn":"900","minInterval":1000,"x":610,"y":580,"wires":[["21991753.935c18"]]},{"id":"21991753.935c18","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Evy","tooltip":"","group":"69b46b09.2f9984","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":610,"y":660,"wires":[["de45d5bc.7e31b8"]]},{"id":"3cedc3d8.ac3dcc","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"achter_peer","name":"","maxOn":"18000","minInterval":1000,"x":210,"y":220,"wires":[["22d8ca2b.e2a0d6","8cbbd31c.45693","ec909cf5.58d75"]]},{"id":"22d8ca2b.e2a0d6","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"achter_tl","name":"","maxOn":"18000","minInterval":1000,"x":380,"y":320,"wires":[[]]},{"id":"ec909cf5.58d75","type":"Sonoff RF","z":"1b8d0302.3b99dd","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"pir","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":300,"offObey":"10","name":"Pir achter","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"EBE2DE","x":200,"y":160,"wires":[["3cedc3d8.ac3dcc"]]},{"id":"8cbbd31c.45693","type":"ui_switch","z":"1b8d0302.3b99dd","name":"","label":"Achter","tooltip":"","group":"d257b270.33baa","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":190,"y":280,"wires":[["3cedc3d8.ac3dcc"]]},{"id":"45df89f2.47a878","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"stal_peer","name":"","maxOn":"18000","minInterval":1000,"x":180,"y":380,"wires":[["b070790f.ceb928","c282a0f9.f2f2f"]]},{"id":"b070790f.ceb928","type":"ui_switch","z":"1b8d0302.3b99dd","name":"","label":"Stallen","tooltip":"","group":"d257b270.33baa","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":170,"y":440,"wires":[["45df89f2.47a878"]]},{"id":"c282a0f9.f2f2f","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"stal_tl","name":"","maxOn":"18000","minInterval":1000,"x":410,"y":460,"wires":[[]]},{"id":"a6b4fa7e.f9e7e8","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"portiek","name":"","maxOn":"14400","relaisNo":"","minInterval":1000,"x":510,"y":160,"wires":[["954b4759.1c2648","2d1bc65f.e290ea","16943404.362f6c","2daf1260.9c462e","4c5a21f.04224e"]]},{"id":"16943404.362f6c","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"zuidgevel","name":"","maxOn":"14400","relaisNo":"","minInterval":1000,"x":720,"y":100,"wires":[[]]},{"id":"2d1bc65f.e290ea","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"westgevel_peer","name":"","maxOn":"14400","relaisNo":"","minInterval":1000,"x":740,"y":160,"wires":[[]]},{"id":"954b4759.1c2648","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"bb2b_buitenlamp","name":"Konijnenlamp","maxOn":"14400","relaisNo":"","minInterval":1000,"x":740,"y":220,"wires":[[]]},{"id":"2daf1260.9c462e","type":"ui_switch","z":"1b8d0302.3b99dd","name":"","label":"Buiten","tooltip":"","group":"d257b270.33baa","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":510,"y":220,"wires":[["a6b4fa7e.f9e7e8"]]},{"id":"4c5a21f.04224e","type":"Sonoff RF","z":"1b8d0302.3b99dd","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"night","rfType":"pir","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"3000","offObey":"10","name":"Pir voordeur","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"EC21EE","x":510,"y":80,"wires":[["a6b4fa7e.f9e7e8"]]},{"id":"82d53ffc.a095f","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"westgevel_flood","name":"","maxOn":"","minInterval":1000,"x":740,"y":300,"wires":[["265511ad.8cac6e"]]},{"id":"265511ad.8cac6e","type":"ui_switch","z":"1b8d0302.3b99dd","name":"","label":"Floodlight","tooltip":"","group":"d257b270.33baa","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":720,"y":360,"wires":[["82d53ffc.a095f"]]},{"id":"bd947893.b16d38","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"keukenkast","name":"","maxOn":"300","minInterval":1000,"x":710,"y":160,"wires":[["e00c29d5.01d308"]]},{"id":"e00c29d5.01d308","type":"Sonoff RF","z":"fc876bed.f64e78","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":0,"end":"sunset","endOffset":0,"offAfter":"30","offObey":"10","name":"Deursensor","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"1911A9","x":710,"y":220,"wires":[["bd947893.b16d38"]]},{"id":"b669a85.64a8d58","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"aanrecht","name":"","maxOn":"7200","minInterval":1000,"x":960,"y":340,"wires":[[]]},{"id":"5f28e097.487bd","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"keuken","name":"","maxOn":"3600","minInterval":1000,"x":700,"y":380,"wires":[["26b92207.d074ee","b669a85.64a8d58","e427d9ca.d6b9d8","c0c1a7a3.8d5348"]]},{"id":"26b92207.d074ee","type":"ui_switch","z":"fc876bed.f64e78","name":"","label":"Keuken","tooltip":"","group":"1736530a.4e7c5d","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":700,"y":320,"wires":[["5f28e097.487bd"]]},{"id":"2fd4a331.3821bc","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"loods","name":"","maxOn":"7200","minInterval":1000,"x":690,"y":440,"wires":[["2f4ebf3a.bfaf1"]]},{"id":"2f4ebf3a.bfaf1","type":"ui_switch","z":"1b8d0302.3b99dd","name":"","label":"Loods","tooltip":"","group":"d257b270.33baa","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":690,"y":500,"wires":[["2fd4a331.3821bc"]]},{"id":"f9007248.4f72c","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"bijkeuken","name":"","maxOn":"900","minInterval":1000,"x":300,"y":580,"wires":[["33717538.3c908a"]]},{"id":"33717538.3c908a","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Bijkeuken","tooltip":"","group":"1fff63f6.7d35dc","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":300,"y":640,"wires":[["f9007248.4f72c"]]},{"id":"be759c3b.1c1a7","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"badkamer","name":"","maxOn":"1800","minInterval":1000,"x":300,"y":720,"wires":[["30a27670.1c695a"]]},{"id":"30a27670.1c695a","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Badkamer","tooltip":"","group":"56a6f242.84dc0c","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":310,"y":780,"wires":[["be759c3b.1c1a7"]]},{"id":"23905ab3.a77ff6","type":"Sonoff basic","z":"1b687fc0.3119a","mode":"0","broker":"e612a1ff.325b7","device":"blitzwolf","name":"","maxOn":"0","minInterval":1000,"x":500,"y":440,"wires":[["cf985903.416b08"]]},{"id":"872115af.83aca8","type":"Sonoff basic","z":"1b8d0302.3b99dd","mode":"0","broker":"e612a1ff.325b7","device":"schrikdraad","name":"","maxOn":"0","minInterval":1000,"x":710,"y":540,"wires":[["c5ac56ff.ab3d28"]]},{"id":"c5ac56ff.ab3d28","type":"ui_switch","z":"1b8d0302.3b99dd","name":"","label":"Schrikdraad","tooltip":"","group":"d257b270.33baa","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":710,"y":600,"wires":[["872115af.83aca8"]]},{"id":"4e6ffcd2.3346c4","type":"timerswitch","z":"1b687fc0.3119a","name":"Server aan/uit","ontopic":"","offtopic":"","onpayload":"ON","offpayload":"OFF","disabled":false,"schedules":[{"on_h":"07","on_m":"00","on_s":"00","off_h":"23","off_m":"10","off_s":"00","valid":true}],"x":260,"y":340,"wires":[[]]},{"id":"cf985903.416b08","type":"ui_switch","z":"1b687fc0.3119a","name":"","label":"Server","tooltip":"","group":"e77a892c.3ac718","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":470,"y":520,"wires":[["23905ab3.a77ff6"]]},{"id":"721281f7.250c2","type":"Sonoff basic","z":"cc2f7188.b9b58","mode":"0","broker":"e612a1ff.325b7","device":"airvent","name":"","maxOn":"900","minInterval":1000,"x":750,"y":720,"wires":[["5788e9a8.7779e8"]]},{"id":"5788e9a8.7779e8","type":"ui_switch","z":"cc2f7188.b9b58","name":"","label":"Airvent","tooltip":"","group":"56a6f242.84dc0c","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":740,"y":780,"wires":[["721281f7.250c2"]]},{"id":"e427d9ca.d6b9d8","type":"Sonoff RF","z":"fc876bed.f64e78","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"night","rfType":"pir","lat":"52.6706437","lon":"6.2900917","start":"goldenHourEnd","startOffset":0,"end":"goldenHour","endOffset":0,"offAfter":"1800","offObey":30,"name":"","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"EC254E","x":690,"y":460,"wires":[["5f28e097.487bd"]]},{"id":"c98a4f99.c435b","type":"mqtt in","z":"1b687fc0.3119a","name":"","topic":"stat/+/POWER","qos":"2","datatype":"auto","broker":"e612a1ff.325b7","x":220,"y":600,"wires":[["30236238.0e156e"]]},{"id":"30236238.0e156e","type":"function","z":"1b687fc0.3119a","name":"AllDownUp","func":"var devices = context.get('devices')||{};\nvar exclude = [\n 'blitzwolf',\n 'westgevel_floodlight',\n 'airvent',\n 'schrikdraad'];\n \n//handle 'all on/off' switching\nvar myTopic = msg.topic || 'pir'\nvar topics= myTopic.split('/');\nvar topic = topics[1]\nvar ignore = exclude.join(',').indexOf(topic)>=0;\n\nif (myTopic=='pir' ){\n for(var item in devices){\n if ((msg.payload && devices[item]=='BULKOFF') ||\n (!msg.payload && devices[item]=='ON')){\n node.send([{\n topic:'cmnd/'+item+'/power',\n payload:msg.payload ? 'ON' : 'OFF'\n }, null])\n if (!msg.payload)\n devices[item]='BULKOFF'\n } else if (!msg.payload && devices[item]=='BULKOFF'){\n devices[item]='OFF' //forget old bulk-offed devices\n }\n }\n}\n\n//this data comes after changing power commands\nif (topics[0]=='stat' && topics[2]=='POWER' && !ignore){\n if (msg.payload=='ON' || devices[topic]!='BULKOFF')\n devices[topic]=msg.payload\n}\n//this data comes after init of sonoff nodes in node-red\n//and gives almost comlete devices list\nif (topics[0]=='stat' && topics[2]=='STATUS' && !ignore){\n var powerOn=JSON.parse(msg.payload).Status.Power;\n if (powerOn || devices[topic]!='BULKOFF')\n devices[topic]=powerOn? 'ON' :'OFF'\n}\n\nvar someThingIsOn=false;\nfor(var item in devices){\n someThingIsOn= someThingIsOn || devices[item]=='ON'\n}\n\ncontext.set('devices',devices );\nnode.send([null, null,{\n topic:'itemList',\n payload:devices\n}])\n\nreturn [null, {payload:someThingIsOn}]//update switch state","outputs":3,"noerr":0,"x":450,"y":680,"wires":[["3fe49d32.14fc12"],["976ddcdd.f1ad7","5f0c8f88.b20d8"],[]]},{"id":"976ddcdd.f1ad7","type":"ui_switch","z":"1b687fc0.3119a","name":"","label":"Alles ","tooltip":"","group":"e77a892c.3ac718","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"switch","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":450,"y":760,"wires":[["30236238.0e156e"]]},{"id":"3fe49d32.14fc12","type":"mqtt out","z":"1b687fc0.3119a","name":"Send state","topic":"","qos":"1","retain":"","broker":"e612a1ff.325b7","x":630,"y":600,"wires":[]},{"id":"a4e0d219.2eaea","type":"mqtt in","z":"1b687fc0.3119a","name":"","topic":"stat/+/STATUS","qos":"2","datatype":"auto","broker":"e612a1ff.325b7","x":220,"y":680,"wires":[["30236238.0e156e"]]},{"id":"5f0c8f88.b20d8","type":"Sonoff RF","z":"1b687fc0.3119a","broker":"e612a1ff.325b7","device":"sonoff","lightDepend":"always","rfType":"button","lat":"52.668872","lon":"6.297246","start":"sunrise","startOffset":"0","end":"sunsetStart","endOffset":"0","offAfter":"0","offObey":"0","name":"AB knop a","cmdPrefix":"cmnd","telePrefix":"tele","keyIds":"F18B54","x":450,"y":820,"wires":[["bc2c7527.5f0978"]]},{"id":"aafc2b8a.160058","type":"mqtt in","z":"fc876bed.f64e78","name":"Googlecmd","topic":"gBridge/u3412/d10961/onoff","qos":"2","datatype":"auto","broker":"508c2b07.a17104","x":130,"y":380,"wires":[["1ed6cb71.6e1365","467805e7.b134dc","7f08e9e9.d3e488","944712a6.7f36"]]},{"id":"dc3d7838.3acf58","type":"mqtt in","z":"fc876bed.f64e78","name":"Googlecmd","topic":"gBridge/u3412/d10967/onoff","qos":"2","datatype":"auto","broker":"508c2b07.a17104","x":130,"y":460,"wires":[["944712a6.7f36"]]},{"id":"428b718e.686ae","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":1,"width":0,"height":0,"label":"Keuken temperatuur","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"72","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":600,"y":340,"wires":[[]]},{"id":"31dcedfe.8fc1d2","type":"mqtt in","z":"68d20bcc.290744","name":"Keuken","topic":"tele/sonoff/SENSOR","qos":"1","datatype":"auto","broker":"e612a1ff.325b7","x":149,"y":257,"wires":[["989f39d7.f898c8"]]},{"id":"989f39d7.f898c8","type":"json","z":"68d20bcc.290744","name":"parse","property":"payload","action":"","pretty":false,"x":312,"y":162,"wires":[["67b9df9e.8d048"]]},{"id":"67b9df9e.8d048","type":"function","z":"68d20bcc.290744","name":"GaugleControl","func":"return [\n {payload: msg.payload.DHT11.Temperature},\n {payload: msg.payload.DHT11.Humidity}\n ]","outputs":2,"noerr":0,"x":350,"y":304,"wires":[["428b718e.686ae","66765133.3b1b9"],["fa8287f6.9f90b8"]]},{"id":"66765133.3b1b9","type":"ui_gauge","z":"68d20bcc.290744","name":"","group":"1736530a.4e7c5d","order":4,"width":0,"height":0,"gtype":"gage","title":"Temperatuur","label":"c","format":"{{value}}","min":0,"max":"30","colors":["#1f00b5","#00ff00","#ca3838"],"seg1":"17","seg2":"23","x":610,"y":220,"wires":[]},{"id":"fa8287f6.9f90b8","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":2,"width":0,"height":0,"label":"Keuken vochtigheid","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":612,"y":419,"wires":[[]]},{"id":"13e3691f.1bffc7","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":3,"width":0,"height":0,"label":"Haard temperatuur","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"72","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":607.5,"y":617,"wires":[[]]},{"id":"da755866.4f0f18","type":"mqtt in","z":"68d20bcc.290744","name":"haard","topic":"tele/WK_spots_haard/SENSOR","qos":"1","datatype":"auto","broker":"e612a1ff.325b7","x":135,"y":539,"wires":[["e93aec41.70389"]]},{"id":"e93aec41.70389","type":"json","z":"68d20bcc.290744","name":"parse","property":"payload","action":"","pretty":false,"x":306,"y":501,"wires":[["881ce577.1e74a8"]]},{"id":"881ce577.1e74a8","type":"function","z":"68d20bcc.290744","name":"GaugleControl","func":"return [\n {payload: msg.payload.DHT11.Temperature},\n {payload: msg.payload.DHT11.Humidity}\n ]","outputs":2,"noerr":0,"x":336,"y":586,"wires":[["13e3691f.1bffc7","adee3599.e229f8","9028a9e.84ba558"],["21a83063.db84f"]]},{"id":"adee3599.e229f8","type":"ui_gauge","z":"68d20bcc.290744","name":"","group":"f207d8fc.eed158","order":2,"width":0,"height":0,"gtype":"gage","title":"Temperatuur","label":"c","format":"{{value}}","min":0,"max":"30","colors":["#1f00b5","#00ff00","#ca3838"],"seg1":"17","seg2":"23","x":602,"y":520,"wires":[]},{"id":"aee38f16.73b6c","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":6,"width":0,"height":0,"label":"Hal temperatuur","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"72","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":606.5,"y":874,"wires":[[]]},{"id":"a3c70341.f1a9c","type":"mqtt in","z":"68d20bcc.290744","name":"Hal west","topic":"tele/hal_west/SENSOR","qos":"1","datatype":"auto","broker":"e612a1ff.325b7","x":145,"y":832,"wires":[["4bf1e48e.5eeadc"]]},{"id":"4bf1e48e.5eeadc","type":"json","z":"68d20bcc.290744","name":"parse","property":"payload","action":"","pretty":false,"x":306,"y":794,"wires":[["f29a4835.671d98"]]},{"id":"f29a4835.671d98","type":"function","z":"68d20bcc.290744","name":"GaugleControl","func":"return [\n {payload: msg.payload.DHT11.Temperature},\n {payload: msg.payload.DHT11.Humidity}\n ]","outputs":2,"noerr":0,"x":336,"y":879,"wires":[["aee38f16.73b6c","df6980cc.25787"],["4855d44b.1dc5bc"]]},{"id":"df6980cc.25787","type":"ui_gauge","z":"68d20bcc.290744","name":"","group":"1fff63f6.7d35dc","order":5,"width":0,"height":0,"gtype":"gage","title":"Temperatuur","label":"c","format":"{{value}}","min":0,"max":"30","colors":["#1f00b5","#00ff00","#ca3838"],"seg1":"17","seg2":"23","x":606,"y":753,"wires":[]},{"id":"513f48fa.47ee48","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":11,"width":0,"height":0,"label":"Slaapkamer temp","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":625.5,"y":1142,"wires":[[]]},{"id":"cf9a8283.c8809","type":"mqtt in","z":"68d20bcc.290744","name":"Slaapkamer","topic":"tele/slaapkamer/SENSOR","qos":"1","datatype":"auto","broker":"e612a1ff.325b7","x":185,"y":1038,"wires":[["fc5388c5.efc828"]]},{"id":"fc5388c5.efc828","type":"json","z":"68d20bcc.290744","name":"parse","property":"payload","action":"","pretty":false,"x":336,"y":1000,"wires":[["e7a485a8.f387d8"]]},{"id":"e7a485a8.f387d8","type":"function","z":"68d20bcc.290744","name":"GaugleControl","func":"return [\n {payload: msg.payload.DHT11.Temperature},\n {payload: msg.payload.DHT11.Humidity}\n ]","outputs":2,"noerr":0,"x":366,"y":1085,"wires":[["513f48fa.47ee48","8e02027.2560f"],["6f4e000d.f8539"]]},{"id":"8e02027.2560f","type":"ui_gauge","z":"68d20bcc.290744","name":"","group":"69b46b09.2f9984","order":5,"width":0,"height":0,"gtype":"gage","title":"Temperatuur","label":"c","format":"{{value}}","min":0,"max":"30","colors":["#1f00b5","#00ff00","#ca3838"],"seg1":"17","seg2":"23","x":632,"y":1019,"wires":[]},{"id":"70db6b3f.ce96b4","type":"mqtt in","z":"68d20bcc.290744","name":"Airvent","topic":"tele/airvent/SENSOR","qos":"1","datatype":"auto","broker":"e612a1ff.325b7","x":910,"y":460,"wires":[["987f85c0.f16628","5f57f7d6.b41d68"]]},{"id":"987f85c0.f16628","type":"json","z":"68d20bcc.290744","name":"parse","property":"payload","action":"","pretty":false,"x":1085,"y":529,"wires":[["691f0304.0e140c"]]},{"id":"691f0304.0e140c","type":"function","z":"68d20bcc.290744","name":"Airfan control","func":"var treshHoldLow = 70;\nvar treshHoldHigh = 101;\nvar maxMinutes = 20;\nvar minMinutes = 5;\nvar waitForMinutes = 60;\nvar windowOpen = \"6:30\"\nvar windowClose= \"22:00\"\n\nvar now =Date.now()\nvar nowdate = new Date(now);\nvar inWindow = \n nowdate.getHours()*60 + nowdate.getMinutes() >= \n parseInt(windowOpen.split(':')[0] *60) + parseInt(windowOpen.split(':')[1]) &&\n nowdate.getHours()*60 + nowdate.getMinutes() <\n parseInt(windowClose.split(':')[0]*60) + parseInt(windowClose.split(':')[1])\n \nvar state = context.get('state') || false;\nvar lastOn = context.get('lastOn') || new Date(now-1000*60*60*24);\n\nif (typeof(msg.payload)=='boolean'){ //state from sonoff power\n context.set('lastOn', now)\n state=msg.payload;\n}\nelse if (typeof(msg.payload)=='object'){ //state from hum\nvar value = msg.payload.DHT11.Humidity\nvar test = [value>=treshHoldHigh , //to wet\n !state ,\n now - lastOn > waitForMinutes*60*1000 , //not just turned off\n inWindow]\nif ( value>=treshHoldHigh && //to wet\n !state && //not on\n now - lastOn > waitForMinutes*60*1000 && //not just turned off\n inWindow //not in the middle of the night\n ){ \n node.send({payload:true}) //turn on\n setTimeout(function(){\n node.send({payload:false}) //turn off after maxMinutes\n }, maxMinutes*(1000*60)) \n } else if ( value<=treshHoldLow && //dry enough\n state && //but still on\n now - lastOn > minMinutes*60*1000 ){ //and ran long enough\n node.send({payload:false})\n }\n}\ncontext.set('state', state);\nvar text = `${state ? '':'niet '} vochtig (lst: \n ${new Date(lastOn).getHours()}:${new Date(lastOn).getMinutes()}, \n ${inWindow?'window on':'window off'}, ${test})`\nif (!state)\n node.status({fill:\"red\",shape:\"ring\",text: text});\nelse\n node.status({fill:\"green\",shape:\"dot\",text: text});","outputs":1,"noerr":0,"x":1087,"y":615,"wires":[["6533af29.416ed"]]},{"id":"6533af29.416ed","type":"Sonoff basic","z":"68d20bcc.290744","mode":"0","broker":"e612a1ff.325b7","device":"airvent","name":"","maxOn":"","minInterval":"0","x":1086,"y":722,"wires":[["691f0304.0e140c","11361e3b.243212","60362d45.3c5ac4"]]},{"id":"11361e3b.243212","type":"ui_switch","z":"68d20bcc.290744","name":"Afzuiging","label":"Afzuiging","tooltip":"","group":"56a6f242.84dc0c","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-shower ","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"fa-shower ","offcolor":"","x":1091,"y":801,"wires":[["6533af29.416ed"]]},{"id":"311d288b.002a08","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":7,"width":0,"height":0,"label":"Badkamer temperatuur","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":681,"y":1361,"wires":[[]]},{"id":"60dfe4d.47a3c1c","type":"mqtt in","z":"68d20bcc.290744","name":"Badkamer","topic":"tele/airvent/SENSOR","qos":"1","datatype":"auto","broker":"e612a1ff.325b7","x":185.5,"y":1279,"wires":[["3ae6da1c.b147c6"]]},{"id":"3ae6da1c.b147c6","type":"json","z":"68d20bcc.290744","name":"parse","property":"payload","action":"","pretty":false,"x":360.5,"y":1281,"wires":[["c344e5ff.9c7ab8"]]},{"id":"c344e5ff.9c7ab8","type":"function","z":"68d20bcc.290744","name":"GaugleControl","func":"return [\n {payload: msg.payload.DHT11.Temperature},\n {payload: msg.payload.DHT11.Humidity}\n ]","outputs":2,"noerr":0,"x":390.5,"y":1366,"wires":[["311d288b.002a08","16103e24.2fcc12"],["cf44966d.fe6638","c8f6458a.236a08"]]},{"id":"cf44966d.fe6638","type":"ui_gauge","z":"68d20bcc.290744","name":"","group":"56a6f242.84dc0c","order":4,"width":0,"height":0,"gtype":"gage","title":"Vochtigheid","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#f9f7ff","#6fcae6","#2220ca"],"seg1":"","seg2":"","x":678.5,"y":1296,"wires":[]},{"id":"c8f6458a.236a08","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":8,"width":0,"height":0,"label":"Badkamer vochtigheid","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":684.5,"y":1403,"wires":[[]]},{"id":"16103e24.2fcc12","type":"ui_gauge","z":"68d20bcc.290744","name":"","group":"56a6f242.84dc0c","order":3,"width":0,"height":0,"gtype":"gage","title":"Temperatuur","label":"c","format":"{{value}}","min":0,"max":"30","colors":["#1f00b5","#00ff00","#ca3838"],"seg1":"17","seg2":"23","x":667,"y":1243,"wires":[]},{"id":"d4683a15.47f558","type":"ui_template","z":"68d20bcc.290744","group":"69b46b09.2f9984","name":"Weather","order":4,"width":"6","height":"6","format":"<a class=\"weatherwidget-io\" href=\"https://forecast7.com/nl/52d676d29/de-wijk/\" data-label_1=\"DE WIJK\" data-label_2=\"Weer\" data-theme=\"dark\" data-basecolor=\"#333333\" >DE WIJK Weer</a>\n<script>\n(function(scope) {\n $('#weatherwidget-io-js').remove();\n !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');\n})(scope);\n\n</script>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1324,"y":668,"wires":[[]]},{"id":"60362d45.3c5ac4","type":"ui_template","z":"68d20bcc.290744","group":"56a6f242.84dc0c","name":"Fan widget","order":1,"width":"6","height":"2","format":"<style>\n @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }\n @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }\n @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }\n.nr-dashboard-theme :not(.fanOn).fan path{\n fill:#fff;\n} \n.wrap {\n overflow:hidden;\n height: 150px;\n width:100%;\n text-align: center;\n margin: auto;\n}\n.fanOn {\n -webkit-animation:spin 4s linear infinite;\n -moz-animation:spin 4s linear infinite;\n animation:spin 4s linear infinite;\n}\n</style>\n<div class=\"wrap\">\n<svg id=\"{{'my_'+$id}}\" class='fan' height=\"75\" viewBox=\"0 0 1025 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M511.999996 0c-282.769178 0-512 229.229798-512 512 0 282.769178 229.229798 512 512 512 282.770202 0 512.001023-229.230822 512.001023-512C1024.001019 229.229798 794.770198 0 511.999996 0zM859.567993 859.56595c-45.148269 45.148269-97.716532 80.59355-156.245554 105.34835-60.585867 25.625634-124.954897 38.618553-191.32142 38.618553-66.3655 0-130.735553-12.992919-191.320397-38.618553-58.529021-24.7548-111.097284-60.20008-156.246577-105.34835-45.148269-45.148269-80.592526-97.716532-105.34835-156.245554-25.625634-60.584843-38.618553-124.953873-38.618553-191.320397s12.992919-130.735553 38.618553-191.32142c24.755824-58.529021 60.20008-111.097284 105.34835-156.245554s97.716532-80.592526 156.246577-105.34835C381.264443 33.459043 445.634496 20.466124 511.999996 20.466124c66.3655 0 130.735553 12.992919 191.32142 38.618553 58.529021 24.755824 111.097284 60.20008 156.245554 105.34835 45.148269 45.148269 80.592526 97.717555 105.34835 156.245554 25.625634 60.585867 38.618553 124.954897 38.618553 191.32142s-12.992919 130.735553-38.618553 191.320397C940.160519 761.849418 904.716262 814.417681 859.567993 859.56595zM482.579943 402.331251c25.312502-7.087419 51.02614-4.941546 73.554226 4.41659 11.450796-43.066865 47.122227-112.518656 64.844867-144.458089 0.473791-0.776689 0.941442-1.560542 1.396813-2.355651 0.688685-1.206478 1.315972-2.436492 1.971911-3.64604 1.867534-3.451612 5.903453-11.307533 5.581112-13.254885 13.69593-41.197284-3.034103-87.685062-42.176588-110.052488-44.618197-25.496697-101.456716-9.994632-126.95239 34.622542-4.102435 7.178493-7.137561 14.675234-9.166777 22.305005-32.360012 90.52269-4.373611 173.708274 16.695241 217.458707C472.902536 405.40117 477.655793 403.709645 482.579943 402.331251zM836.396247 637.303844c-4.164856-7.141654-9.140171-13.517875-14.733563-19.089777-62.234413-73.308633-148.302651-90.653673-196.718337-94.275153-2.77623 23.939225-13.21293 47.174416-31.365358 65.73719-3.786233 3.872191-7.78736 7.404644-11.957333 10.614755 31.573089 31.448246 73.883731 97.069803 92.683912 128.390135 0.435928 0.796132 0.880043 1.595334 1.342578 2.38635 0.698918 1.201361 1.452071 2.358721 2.171456 3.532453 2.054799 3.343141 6.840802 10.765181 8.686846 11.45796 28.830629 32.460296 77.453023 41.215704 116.396987 18.502399C847.293435 738.668463 862.287941 681.69282 836.396247 637.303844zM401.23938 525.588483c-43.015699 11.623735-121.026424 15.45704-157.557432 16.07921-0.909719-0.022513-1.821485-0.035816-2.737344-0.031722-1.390673 0.008186-2.769067 0.079818-4.14439 0.115634-3.922333 0.10847-12.744255 0.541329-14.270005 1.794879-42.526559 8.736988-74.420967 46.469358-74.218352 91.551112 0.228197 51.387367 42.071188 92.860944 93.459578 92.632747 8.267291-0.035816 16.277732-1.156336 23.899316-3.213181 94.610798-17.244756 152.666028-83.117023 180.007747-123.233696-3.988848-2.978844-7.831362-6.249331-11.489682-9.827833C415.403984 573.08831 404.406512 549.763069 401.23938 525.588483zM512.96702 510.871293m-84.869946 0a82.937 82.937 0 1 0 169.739892 0 82.937 82.937 0 1 0-169.739892 0Z\" /></svg>\n</div>\n<script>\n(function(scope) {\n scope.$watch('msg', function(msg) {\n if (msg) {\n $(\"#my_\"+scope.$id).toggleClass('fanOn', msg.payload)\n }\n });\n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1332,"y":750,"wires":[[]]},{"id":"5f57f7d6.b41d68","type":"function","z":"68d20bcc.290744","name":"Airfan control","func":"var upDiv = 1; //5% hum per minute rising\nvar downDiv = -1; //-2% hum per minute falling\nvar states = {\n idle: 'idle',\n humInc: 'humInc',\n humDec: 'humDec'\n}\n\nvar points = context.get('points') || [];\nvar state = context.get('state') || states.idle;\n\nvar removeOld = ()=>{\n var toOld = new Date(Date.now()-120*1000);\n for (var i=0;i<points.length;i++){\n if (points[i].date<toOld){\n points.splice(i);\n break;\n }\n }\n}\nvar addPoint = (points, point) =>{\n\n removeOld();\n \n var avarage = 0.0\n var prevPoint = point\n\n var toOld = new Date(Date.now()-60*1000);\n var i=0;\n for (;i<points.length;i++){\n if (points[i].date>toOld){\n avarage += prevPoint.value - points[i].value\n prevPoint=points[i];\n }else break\n }\n avarage=avarage/i\n var timeSpan = (point.date-prevPoint.date)/(1000.0*60.0)\n points.unshift(point);\n context.set('points', points)\n node.send([null, {payload:{\n points:points.length,\n timeSpan : timeSpan,\n avarage : avarage,\n dd: avarage / timeSpan\n }}])\n return avarage / timeSpan;\n}\nvar payload = JSON.parse(msg.payload);\n\nif (typeof(payload)=='boolean'){\n if (payload) //fan went on beacuse of fas increasing humidity\n context.set('state', states.humInc);\n else //fan ent off because of no longer decreasing humidity\n context.set('state', states.idle);\n}\nelse if (typeof(payload)=='object'){\n var value = payload.DHT11.Humidity\n var avg = addPoint(points, {\n date: Date.now(),\n value: payload.DHT11.Humidity\n })\n switch(state){\n case states.idle:\n if (avg>=upDiv) node.send([{payload:true}]) //enable fan\n break;\n case states.humInc: \n if (avg<0) context.set('state', states.humDec);\n break;\n case states.humDec: \n if (avg>downDiv)node.send([{payload:false}]) //disable fan\n break;\n default:\n break;\n }\n node.send([null, {payload:avg}]);\n \n}\n\nstate = context.get('state') || states.idle;\nnode.send([null,{payload:state}]) //disable fan\nif (state==states.idle)\n node.status({fill:\"green\",shape:\"ring\",text: state});\nelse\n node.status({fill:\"red\",shape:\"dot\",text: state});","outputs":2,"noerr":0,"x":1180,"y":445,"wires":[[],["a66446b.049c6b8"]]},{"id":"a66446b.049c6b8","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":9,"width":0,"height":0,"label":"Delta Hum","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"-10","ymax":"10","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1362.5,"y":354,"wires":[[]]},{"id":"21a83063.db84f","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":2,"width":0,"height":0,"label":"Haard vochtigheid","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":610,"y":698,"wires":[[]]},{"id":"4855d44b.1dc5bc","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":2,"width":0,"height":0,"label":"Hal vochtigheid","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":625,"y":930,"wires":[[]]},{"id":"6f4e000d.f8539","type":"ui_chart","z":"68d20bcc.290744","name":"","group":"8c562e4.8d782d","order":11,"width":0,"height":0,"label":"Slaapkamer vochtigheid","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"10","removeOlderPoints":"1500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":671,"y":1194,"wires":[[]]},{"id":"9028a9e.84ba558","type":"mqtt out","z":"68d20bcc.290744","name":"","topic":"gBridge/u3412/d10969/tempset-ambient/set","qos":"","retain":"","broker":"508c2b07.a17104","x":710,"y":560,"wires":[]},{"id":"bc2c7527.5f0978","type":"debug","z":"1b687fc0.3119a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":660,"y":820,"wires":[]},{"id":"418d38b8.41aa38","type":"Sonoff basic","z":"f449dd24.dddea","mode":"0","broker":"e612a1ff.325b7","device":"Boven","name":"","maxOn":"3600","relaisNo":"1","minInterval":1000,"x":586,"y":46,"wires":[["be7c8200.df1e2"]]},{"id":"be7c8200.df1e2","type":"ui_switch","z":"f449dd24.dddea","name":"","label":"Boven","tooltip":"","group":"69b46b09.2f9984","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":586,"y":126,"wires":[["418d38b8.41aa38"]]},{"id":"8dc360ff.4a224","type":"Sonoff basic","z":"f449dd24.dddea","mode":"0","broker":"e612a1ff.325b7","device":"Boven","name":"Badkamer","maxOn":"3600","relaisNo":"2","minInterval":1000,"x":430,"y":220,"wires":[["e6340ffc.4d5dd"]]},{"id":"e6340ffc.4d5dd","type":"ui_switch","z":"f449dd24.dddea","name":"","label":"Badkamer boven","tooltip":"","group":"56a6f242.84dc0c","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":470,"y":300,"wires":[["8dc360ff.4a224"]]},{"id":"660327ab.f920d8","type":"mqtt in","z":"f449dd24.dddea","name":"Googlecmd","topic":"gBridge/u3412/d11850/onoff","qos":"2","datatype":"auto","broker":"508c2b07.a17104","x":310,"y":100,"wires":[["418d38b8.41aa38"]]},{"id":"16ec7f13.f60301","type":"mqtt in","z":"f449dd24.dddea","name":"Googlecmd","topic":"gBridge/u3412/d11851/onoff","qos":"2","datatype":"auto","broker":"508c2b07.a17104","x":210,"y":240,"wires":[["8dc360ff.4a224"]]},{"id":"9a28575.6d794a8","type":"mqtt out","z":"b201b1db.82068","name":"","topic":"","qos":"","retain":"","broker":"e612a1ff.325b7","x":510,"y":140,"wires":[]},{"id":"a2635001.f656e","type":"ui_slider","z":"b201b1db.82068","name":"","label":"Color","tooltip":"","group":"900b3f55.35083","order":2,"width":0,"height":0,"passthru":true,"outs":"all","topic":"cmnd/action/channel1","min":0,"max":"100","step":"1","x":130,"y":120,"wires":[["9a28575.6d794a8"]]},{"id":"3b08f10a.d9d00e","type":"mqtt out","z":"b201b1db.82068","name":"","topic":"","qos":"","retain":"","broker":"e612a1ff.325b7","x":510,"y":80,"wires":[]},{"id":"29a98dfc.cfd3d2","type":"ui_slider","z":"b201b1db.82068","name":"","label":"Power","tooltip":"","group":"900b3f55.35083","order":2,"width":0,"height":0,"passthru":true,"outs":"end","topic":"cmnd/action/channel2","min":0,"max":"100","step":"1","x":130,"y":80,"wires":[["3b08f10a.d9d00e"]]},{"id":"c0c1a7a3.8d5348","type":"Sonoff basic","z":"fc876bed.f64e78","mode":"0","broker":"e612a1ff.325b7","device":"action","name":"","maxOn":"","relaisNo":"","minInterval":1000,"x":930,"y":440,"wires":[["78dac2ba.8f8a6c"]]},{"id":"78dac2ba.8f8a6c","type":"ui_switch","z":"fc876bed.f64e78","name":"","label":"Actionlamp","tooltip":"","group":"1736530a.4e7c5d","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":930,"y":580,"wires":[["c0c1a7a3.8d5348"]]}]