Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.36 KB | None | 0 0
  1. [{"id":"434c4d2716d2ae92","type":"ha-device","z":"a787a77.9c16458","name":"Stor sol klick","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_short_press","subtype":"turn_on"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":3820,"wires":[["bb7c74e2c95ca857","c0c2b2d40e1044ea"]]},{"id":"d83c1c5d695edd4a","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":3920,"wires":[[]]},{"id":"75d65fc933c2ecd0","type":"function","z":"a787a77.9c16458","name":"","func":"var col = Math.floor(msg.data.attributes.hs_color[0]/30)*30;\nmsg.col= col\n\nmsg.payload = { data: {\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [(col+32)%360, 100]\n } };\n msg.hs = (col+32)%360\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1060,"y":3920,"wires":[["d83c1c5d695edd4a"]]},{"id":"e335a97875c9cee3","type":"ha-device","z":"a787a77.9c16458","name":"Höger klick","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_short_press","subtype":"right"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":4000,"wires":[["30fbf190a46f433b","315840fce90951ab"]]},{"id":"2f9f40481c53f136","type":"ha-device","z":"a787a77.9c16458","name":"Liten sol hold","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_long_press","subtype":"dim_down"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":4620,"wires":[["510daac1f031f5b1","1d159ca74c236cd6"]]},{"id":"510daac1f031f5b1","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_down_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":4620,"wires":[["e38544f65f83eb6e"]]},{"id":"e38544f65f83eb6e","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":760,"y":4620,"wires":[["32bba910fc13ac09"]]},{"id":"c4405d821b55c4cf","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"{\t \"brightness\": msg.data.attributes.brightness\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":4620,"wires":[["402ae56ef721b24f"]]},{"id":"402ae56ef721b24f","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1450,"y":4620,"wires":[["d4915c6abf18abf2"]]},{"id":"d4915c6abf18abf2","type":"switch","z":"a787a77.9c16458","name":"","property":"hold_down_david","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":4540,"wires":[["e38544f65f83eb6e"]]},{"id":"9f569b3702f5cd5b","type":"ha-device","z":"a787a77.9c16458","name":"Liten sol relese","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_long_release","subtype":"dim_down"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":4560,"wires":[["bf705179ee83d8ec","1d159ca74c236cd6"]]},{"id":"bf705179ee83d8ec","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_down_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":4560,"wires":[[]]},{"id":"3f78c9f4e009fda7","type":"ha-device","z":"a787a77.9c16458","name":"Stor sol hold","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_long_press","subtype":"dim_up"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":4800,"wires":[["1c3ee0743eab4ea6","3d6b35e9800134c3"]]},{"id":"1c3ee0743eab4ea6","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_up_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":4800,"wires":[["a7b290ceafe0042d"]]},{"id":"f2b1c1aa823f3ffa","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1200,"y":4800,"wires":[["427715095adebc40"],[]]},{"id":"573a39c96809d25a","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"{\t \"brightness\": msg.data.attributes.brightness\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1670,"y":4800,"wires":[["f1dc9cd8d4b844fe"]]},{"id":"f1dc9cd8d4b844fe","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1890,"y":4800,"wires":[["ab82adae5124dbf2"]]},{"id":"ab82adae5124dbf2","type":"switch","z":"a787a77.9c16458","name":"","property":"hold_up_david","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1170,"y":4720,"wires":[["f2b1c1aa823f3ffa"]]},{"id":"75019b8cb554e2d2","type":"ha-device","z":"a787a77.9c16458","name":"Stor sol relese","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_long_release","subtype":"dim_up"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":4740,"wires":[["3dc2b574d28b2d83","3d6b35e9800134c3"]]},{"id":"3dc2b574d28b2d83","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_up_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":4740,"wires":[[]]},{"id":"75da3b11a074cc32","type":"comment","z":"a787a77.9c16458","name":"David","info":"","x":250,"y":3500,"wires":[]},{"id":"04ad9c7e1e7ed69c","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":420,"y":3920,"wires":[["b0b065eac2aea2b3"]]},{"id":"d932c247a7a38b85","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":890,"y":3920,"wires":[["75d65fc933c2ecd0"]]},{"id":"f1745f30e99430cd","type":"function","z":"a787a77.9c16458","name":"","func":"\nvar col = Math.floor(msg.data.attributes.hs_color[0]/30)*30;\n\nmsg.col = col\nif( (col-28) > 0){\n msg.payload = { data: {\n\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [(col-28)%360, 100]\n } };\n \n msg.hs = (col-30)%360;\n}else{\n msg.payload = { data: {\n\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [360 - (28 - col), 100]\n } }; \n \n msg.hs = 360 - (28 - col);\n}\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1060,"y":4020,"wires":[["ad4ddb1866d50cfb"]]},{"id":"f648aa7fc49d1365","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":890,"y":4020,"wires":[["f1745f30e99430cd"]]},{"id":"ad4ddb1866d50cfb","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":4020,"wires":[[]]},{"id":"30fbf190a46f433b","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":420,"y":4000,"wires":[["8984fa585b39f59f"]]},{"id":"ad87be2cba93da2e","type":"ha-device","z":"a787a77.9c16458","name":"Vänster klick","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_short_press","subtype":"left"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":3920,"wires":[["04ad9c7e1e7ed69c","bb7c74e2c95ca857"]]},{"id":"67435f82a00074af","type":"ha-device","z":"a787a77.9c16458","name":"Liten sol klick","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_short_press","subtype":"turn_off"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":3600,"wires":[["1dca530c8a167bbe"]]},{"id":"350b447d83b2bba1","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":3480,"wires":[[]]},{"id":"84a2fcd31add7c4b","type":"ha-device","z":"a787a77.9c16458","name":"Vänster hold","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_long_press","subtype":"left"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":4160,"wires":[["1b8dee797342386d","315840fce90951ab"]]},{"id":"7f478936dd79e685","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":800,"y":4160,"wires":[["cb038489c57697e2"]]},{"id":"1b8dee797342386d","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_left_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":4160,"wires":[["7f478936dd79e685"]]},{"id":"f987a40440e85dfd","type":"switch","z":"a787a77.9c16458","name":"","property":"hold_left_david","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":4080,"wires":[["7f478936dd79e685"]]},{"id":"8c3fb71054468b3a","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1470,"y":4160,"wires":[["f987a40440e85dfd"]]},{"id":"cb038489c57697e2","type":"function","z":"a787a77.9c16458","name":"","func":"\n\nmsg.payload = { data: {\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [(msg.data.attributes.hs_color[0]+3)%360, 100]\n } };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1040,"y":4160,"wires":[["9b382f2186ed29fe"]]},{"id":"9b382f2186ed29fe","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":4160,"wires":[["8c3fb71054468b3a"]]},{"id":"c7c707ede9b26237","type":"server-events","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":1,"event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":190,"y":4100,"wires":[["11b84e167866bc1b"]]},{"id":"11b84e167866bc1b","type":"function","z":"a787a77.9c16458","name":"","func":"\nif(msg.payload.event.device_id == \"76af6fdaa2160386fecfe18d1fde51a4\" ){\n if(msg.payload.event.command == \"release\"){\n return msg; \n } \n \n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":4100,"wires":[["242807b7ef79ba02","b791549a71dbf25e"]]},{"id":"242807b7ef79ba02","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_left_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":4060,"wires":[[]]},{"id":"2c0f9025618e4993","type":"ha-device","z":"a787a77.9c16458","name":"Höger hold","server":"4bbca37b.1700ec","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"76af6fdaa2160386fecfe18d1fde51a4","event":{"device_id":"76af6fdaa2160386fecfe18d1fde51a4","domain":"zha","platform":"device","type":"remote_button_long_press","subtype":"right"},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":4360,"wires":[["07cb09c398a25bf2","1d159ca74c236cd6"]]},{"id":"30e6dbee01414f2b","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":800,"y":4360,"wires":[["f56573c3186057aa"]]},{"id":"07cb09c398a25bf2","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_right_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":4360,"wires":[["30e6dbee01414f2b"]]},{"id":"8d115d14a068067d","type":"switch","z":"a787a77.9c16458","name":"","property":"hold_right_david","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":790,"y":4280,"wires":[["30e6dbee01414f2b"]]},{"id":"a8aaea4f4a630270","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1470,"y":4360,"wires":[["8d115d14a068067d"]]},{"id":"f56573c3186057aa","type":"function","z":"a787a77.9c16458","name":"","func":"var col = msg.data.attributes.hs_color[0];\n\nif( (col-3) >= 0){\n msg.payload = { data: {\n\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [col-3, 100]\n } };\n\n}else{\n msg.payload = { data: {\n\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [360 - (3 - col), 100]\n } }; \n \n\n}\n \nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1040,"y":4360,"wires":[["6b91ca280cbfa986"]]},{"id":"6b91ca280cbfa986","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":4360,"wires":[["a8aaea4f4a630270"]]},{"id":"b791549a71dbf25e","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"hold_right_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":4100,"wires":[[]]},{"id":"111809c09ef86738","type":"server-events","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":1,"event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":190,"y":3760,"wires":[["168f16123999b824"]]},{"id":"168f16123999b824","type":"function","z":"a787a77.9c16458","name":"","func":"\nif(msg.payload.event.device_id == \"76af6fdaa2160386fecfe18d1fde51a4\" ){\n if(msg.payload.event.command == \"press\" || msg.payload.event.command == \"release\"){\n return msg; \n } \n \n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":3760,"wires":[["513ddfe0ea3d982e"]]},{"id":"ebf01cfd1da19d74","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":780,"y":3760,"wires":[["eb6508a8facb1512"]]},{"id":"513ddfe0ea3d982e","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"on_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":3760,"wires":[["ebf01cfd1da19d74"]]},{"id":"eb6508a8facb1512","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"on_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":3760,"wires":[[]]},{"id":"d389f67dbb801fe4","type":"switch","z":"a787a77.9c16458","name":"","property":"on_david","propertyType":"flow","rules":[{"t":"true"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":3820,"wires":[["ade3c43d2c81e73a"],["ade3c43d2c81e73a","eb6508a8facb1512"]]},{"id":"b0b065eac2aea2b3","type":"switch","z":"a787a77.9c16458","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":3920,"wires":[["d932c247a7a38b85"],["8faa42448466feda"]]},{"id":"8984fa585b39f59f","type":"switch","z":"a787a77.9c16458","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":4000,"wires":[["8faa42448466feda"],["f648aa7fc49d1365"]]},{"id":"8faa42448466feda","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":3960,"wires":[[]]},{"id":"c8d6e2046f5017d0","type":"join","z":"a787a77.9c16458","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1.5","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":530,"y":3600,"wires":[["7f55fdbe23385524"]]},{"id":"7f55fdbe23385524","type":"function","z":"a787a77.9c16458","name":"","func":"if (msg.payload.length == 1){\n return [msg, null, null];\n}else if (msg.payload.length == 2){\n return [null, msg, null];\n}else{\n return [null, null, msg];\n}","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":3600,"wires":[["b586b518c8f4d5b3","b22e3591da89bb64"],["8cabe05849784fea","edfc51a8634857b4"],["8094e06caf7504b0","55e55a1d7319372d"]]},{"id":"f3d56674b48d434d","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2100,"y":3600,"wires":[["f23d23d7b59f9dc7"]]},{"id":"59d803e748cbb2c3","type":"function","z":"a787a77.9c16458","name":"","func":"sat = msg.data.attributes.hs_color[1]\nnode.warn(sat);\nnode.warn(msg.dir);\n\nif (msg.dir == true){\n if (msg.data.attributes.hs_color[1] > 40){\n sat = msg.data.attributes.hs_color[1]+1;\n }else{\n sat = msg.data.attributes.hs_color[1]+2;\n }\n if (sat > 71) sat = 100;\n msg.dir = true;\n if (sat == 100) msg.dir = false;\n}else{\n if(msg.data.attributes.hs_color[1] > 40){\n sat = msg.data.attributes.hs_color[1]-1;\n }else{\n sat = msg.data.attributes.hs_color[1]-2;\n }\n if (sat < 10) sat = 10;\n msg.dir = false;\n if (sat <= 10) msg.dir = true;\n}\n\nmsg.payload = { data: {\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [(msg.data.attributes.hs_color[0]+3)%360, sat]\n } };\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2340,"y":3600,"wires":[["62401d7a17d53bab"]]},{"id":"62401d7a17d53bab","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2530,"y":3600,"wires":[["92fd8960bd4ebe8e"]]},{"id":"92fd8960bd4ebe8e","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2750,"y":3600,"wires":[["39d11d8f5198b3f1"]]},{"id":"39d11d8f5198b3f1","type":"switch","z":"a787a77.9c16458","name":"","property":"fade_david","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":2430,"y":3540,"wires":[["f3d56674b48d434d"]]},{"id":"55e55a1d7319372d","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"fade_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":3660,"wires":[[]]},{"id":"2c1ecdead88cb71d","type":"link in","z":"a787a77.9c16458","name":"","links":["b22e3591da89bb64","f81723c3b553d2f5","bb7c74e2c95ca857","315840fce90951ab","1d159ca74c236cd6","3d6b35e9800134c3"],"x":255,"y":3680,"wires":[["55e55a1d7319372d","edfc51a8634857b4"]]},{"id":"b22e3591da89bb64","type":"link out","z":"a787a77.9c16458","name":"","mode":"link","links":["2c1ecdead88cb71d"],"x":835,"y":3540,"wires":[]},{"id":"bb7c74e2c95ca857","type":"link out","z":"a787a77.9c16458","name":"","mode":"link","links":["2c1ecdead88cb71d"],"x":295,"y":3880,"wires":[]},{"id":"315840fce90951ab","type":"link out","z":"a787a77.9c16458","name":"","mode":"link","links":["2c1ecdead88cb71d"],"x":355,"y":4060,"wires":[]},{"id":"1d159ca74c236cd6","type":"link out","z":"a787a77.9c16458","name":"","mode":"link","links":["2c1ecdead88cb71d"],"x":315,"y":4480,"wires":[]},{"id":"3d6b35e9800134c3","type":"link out","z":"a787a77.9c16458","name":"","mode":"link","links":["2c1ecdead88cb71d"],"x":315,"y":4700,"wires":[]},{"id":"b586b518c8f4d5b3","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":870,"y":3480,"wires":[["350b447d83b2bba1"]]},{"id":"cdde86e74bd4db4e","type":"function","z":"a787a77.9c16458","name":"","func":"\n\nmsg.payload = { data: {\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [Math.ceil(Math.random() * 360), Math.ceil(Math.random() * (100 - 50) + 50)]\n } };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1740,"y":3720,"wires":[["90f488bddd8ea9af"]]},{"id":"90f488bddd8ea9af","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1930,"y":3720,"wires":[["f99df91b2cae4226"]]},{"id":"f99df91b2cae4226","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2150,"y":3720,"wires":[["ec855fb7f1aa9ac3"]]},{"id":"ec855fb7f1aa9ac3","type":"switch","z":"a787a77.9c16458","name":"","property":"disco_david","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1830,"y":3660,"wires":[["130e023f3ce378b7"]]},{"id":"1dca530c8a167bbe","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":370,"y":3600,"wires":[["c8d6e2046f5017d0"]]},{"id":"40ecf90f247ea0bc","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"fade_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1550,"y":3600,"wires":[["f3d56674b48d434d"]]},{"id":"5fbe07e28102b4da","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"disco_david","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":3700,"wires":[["cdde86e74bd4db4e"]]},{"id":"5d58a7c72c6cb8a3","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1310,"y":3640,"wires":[["40ecf90f247ea0bc"]]},{"id":"dbfb0412f60c87d5","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":3740,"wires":[["5fbe07e28102b4da"]]},{"id":"edfc51a8634857b4","type":"change","z":"a787a77.9c16458","name":"","rules":[{"t":"set","p":"disco_david","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":3700,"wires":[[]]},{"id":"8cabe05849784fea","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1000,"y":3600,"wires":[["40ecf90f247ea0bc"],["5d58a7c72c6cb8a3"]]},{"id":"8094e06caf7504b0","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":940,"y":3700,"wires":[["5fbe07e28102b4da"],["dbfb0412f60c87d5"]]},{"id":"389423a30c038688","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"{\t \"kelvin\": 4200,\t \"brightness\": 255\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1130,"y":3800,"wires":[[]]},{"id":"5af2f083b6bf1309","type":"join","z":"a787a77.9c16458","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"0.75","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":810,"y":3820,"wires":[["bf1fc39788611519"]]},{"id":"bf1fc39788611519","type":"function","z":"a787a77.9c16458","name":"","func":"if (msg.payload.length == 1){\n return [msg, null, null];\n}else if (msg.payload.length == 2){\n return [null, msg, null];\n}else{\n return [null, null, msg];\n}","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":3820,"wires":[["389423a30c038688"],["37ddd6e67655920c"],[]]},{"id":"37ddd6e67655920c","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"{\t \"kelvin\": 4200,\t \"brightness\": 60\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1130,"y":3860,"wires":[[]]},{"id":"ade3c43d2c81e73a","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":650,"y":3820,"wires":[["5af2f083b6bf1309"]]},{"id":"c0c2b2d40e1044ea","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":340,"y":3820,"wires":[["d389f67dbb801fe4"]]},{"id":"78bb9d55f5f6979c","type":"inject","z":"a787a77.9c16458","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1770,"y":3500,"wires":[["f3d56674b48d434d"]]},{"id":"f23d23d7b59f9dc7","type":"function","z":"a787a77.9c16458","name":"","func":"var sat =100;\n\nif (msg.dir == true){\n if (msg.data.attributes.hs_color[1] > 70){\n sat = msg.data.attributes.hs_color[1]+1;\n }else{\n sat = msg.data.attributes.hs_color[1]+2;\n }\n if (sat > 100) sat = 100;\n msg.dir = true;\n if (sat == 100) msg.dir = false;\n}else{\n if(msg.data.attributes.hs_color[1] > 70){\n sat = msg.data.attributes.hs_color[1]-1;\n }else{\n sat = msg.data.attributes.hs_color[1]-2;\n }\n if (sat < 40) sat = 40;\n msg.dir = false;\n if (sat <= 40) msg.dir = true;\n}\n\nmsg.payload = { data: {\n 'entity_id': 'light.davids_lampa',\n 'hs_color': [(msg.data.attributes.hs_color[0]+3)%360, sat]\n } };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2340,"y":3660,"wires":[["62401d7a17d53bab"]]},{"id":"32bba910fc13ac09","type":"function","z":"a787a77.9c16458","name":"","func":"msg.data.attributes.brightness = Math.max(msg.data.attributes.brightness-6, 5); \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1040,"y":4620,"wires":[["c4405d821b55c4cf"]]},{"id":"427715095adebc40","type":"function","z":"a787a77.9c16458","name":"","func":"msg.data.attributes.brightness = Math.min(msg.data.attributes.brightness+6, 255); \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":4800,"wires":[["573a39c96809d25a"]]},{"id":"130e023f3ce378b7","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":2010,"y":3660,"wires":[["cdde86e74bd4db4e"]]},{"id":"a7b290ceafe0042d","type":"api-current-state","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.davids_lampa","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":760,"y":4800,"wires":[["f2b1c1aa823f3ffa"],["9472d034e6a496f0"]]},{"id":"9472d034e6a496f0","type":"api-call-service","z":"a787a77.9c16458","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.davids_lampa","data":"{\t \"brightness\": 5\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1150,"y":4920,"wires":[["596622df1c21044d"]]},{"id":"596622df1c21044d","type":"delay","z":"a787a77.9c16458","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1660,"y":4920,"wires":[["f1dc9cd8d4b844fe"]]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement