Guest User

Untitled

a guest
Sep 12th, 2023
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.72 KB | None | 0 0
  1. [{"id":"824fe4cb22842d7f","type":"group","z":"9e515b8aa75a9cdd","name":"","style":{"label":true},"nodes":["5dbfe54c1c9e0349","57eb4ea18bc4f55b","2080c99162556dc0","21add955f677d2b7","ad814cbe9abc19f5","a87e55e132644e6c","342cb1090e8f530b","0cb211a18508e0ab","e8e8db56dab8adcc","6131a2c1c3af7050","27cd90e7ad99d55c","f0de34106b389b4a","c7f2980adaee37b4","9c396755fe1cb910","1189f4b6f680b126","cf8ff618865df435","d5e2a24c6ce71e38","57b7936054b0b5cc","db1017a7cb93fa99","cb125f4b50582619","e91a19e1d4d03076","deb1c3f277dffa05","bc2e357cd21ccadd","18d49bad3d314fbb","6da1158175acc54a","924efdd72ef016a6","6d38d52715aeb7ef","2ae78b52a82bf9e5","d3c382301395300b","62fcc1a1fce54141","d22cea5a615c3b79","ee596aba36f6626b","33b091aa899cef65","054470e44aa3f1ca","92bb7dc9357b96d3","4be0a0aa026d1431"],"x":194,"y":119,"w":2932,"h":222},{"id":"5dbfe54c1c9e0349","type":"function","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Extract room from motion sensor entity an extract on lights to regex","func":"var motion_entity_id = msg.data.event.new_state.entity_id; // binary_sensor.sensor_bedroom_motion_occupancy\nvar motion_entity_id_split = motion_entity_id.split(\".\");// split on the dot to separate domain and entity\nvar motion_entity_id_wihtout_binary = motion_entity_id_split[1].replace(\"sensor_\", \"\").replace(\"_motion\", \"\").replace(\"_fp1\", \"\").replace(\"_presence\", \"\").replace(\"_occupancy\", \"\").replace(\"_entry\", \"\").replace(\"_exit\", \"\");// remove sensor_ and more substrings\nvar regex = \"^light\\\\.(?!.*?group.*?)(?!.*?lights.*?).*\" + motion_entity_id_wihtout_binary + \".*\"; \nconst rules_object = [{ 'property': 'entity_id' , 'logic': 'is' , 'value': regex , 'valueType': 're' },{ 'property': 'state' , 'logic': 'is' , 'value': \"on\" , 'valueType': 'str' }];// arranges the array \n\nvar msg = {\n \"payload\":{ \"rules\": rules_object},\"room\": motion_entity_id_wihtout_binary\n\n}\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":200,"wires":[["57eb4ea18bc4f55b"]]},{"id":"57eb4ea18bc4f55b","type":"ha-get-entities","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Get entities","server":"7ab5c227.a3ce8c","version":0,"rules":[],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload.results","output_results_count":1,"x":790,"y":200,"wires":[["2080c99162556dc0"]]},{"id":"2080c99162556dc0","type":"change","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"rules","rules":[{"t":"move","p":"payload","pt":"msg","to":"lights","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":200,"wires":[["4be0a0aa026d1431"]]},{"id":"21add955f677d2b7","type":"function","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"prepare Regex to check other motion sensors","func":"var room = msg.room\nvar regex = \"binary_sensor\\.*\" + room + \".*_occupancy$\"; \nconst rules_object = [{ 'property': 'entity_id' , 'logic': 'is' , 'value': regex , 'valueType': 're' },{ 'property': 'state' , 'logic': 'is' , 'value': \"on\" , 'valueType': 'str' }];// arranges the array \n\nvar msg = {\n \"payload\":{ \"rules\": rules_object},\n \"entity\": msg.entity,\n \"room\": room,\n \"lights\": msg.lights\n\n}\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1670,"y":200,"wires":[["ad814cbe9abc19f5"]]},{"id":"ad814cbe9abc19f5","type":"ha-get-entities","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Get entities","server":"7ab5c227.a3ce8c","version":0,"rules":[],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload.results","output_results_count":1,"x":2090,"y":200,"wires":[["a87e55e132644e6c"]]},{"id":"a87e55e132644e6c","type":"switch","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"","property":"payload.results","propertyType":"msg","rules":[{"t":"empty"}],"checkall":"true","repair":false,"outputs":1,"x":2370,"y":200,"wires":[["342cb1090e8f530b"]]},{"id":"342cb1090e8f530b","type":"change","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"rules","rules":[{"t":"move","p":"lights.entity_id","pt":"msg","to":"payload.data.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2590,"y":200,"wires":[["0cb211a18508e0ab"]]},{"id":"0cb211a18508e0ab","type":"api-call-service","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"","server":"7ab5c227.a3ce8c","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{\"transition\": 30}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2810,"y":200,"wires":[[]]},{"id":"e8e8db56dab8adcc","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Generate the regex for the get entity node","info":"","x":500,"y":160,"wires":[]},{"id":"6131a2c1c3af7050","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Get on light entities","info":"","x":770,"y":160,"wires":[]},{"id":"27cd90e7ad99d55c","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Move payload to lights","info":"","x":960,"y":160,"wires":[]},{"id":"f0de34106b389b4a","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Prepare regex to check if another motion sensor is on in the room","info":"","x":1730,"y":160,"wires":[]},{"id":"c7f2980adaee37b4","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Get motion on entities in an array","info":"","x":2110,"y":160,"wires":[]},{"id":"9c396755fe1cb910","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Make sure the array is empty","info":"","x":2380,"y":160,"wires":[]},{"id":"1189f4b6f680b126","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Set entity","info":"","x":2600,"y":160,"wires":[]},{"id":"cf8ff618865df435","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Turn the lights off","info":"","x":2800,"y":160,"wires":[]},{"id":"d5e2a24c6ce71e38","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Up if no party","info":"","x":1370,"y":160,"wires":[]},{"id":"57b7936054b0b5cc","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Send down if events","info":"","x":1230,"y":240,"wires":[]},{"id":"db1017a7cb93fa99","type":"function","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"prepare Regex to check other motion sensors","func":"var room = msg.room\nvar regex = \"binary_sensor\\.*\" + room + \".*_occupancy$\"; \nconst rules_object = [{ 'property': 'entity_id' , 'logic': 'is' , 'value': regex , 'valueType': 're' },{ 'property': 'state' , 'logic': 'is' , 'value': \"on\" , 'valueType': 'str' }];// arranges the array \n\nvar msg = {\n \"payload\":{ \"rules\": rules_object},\n \"entity\": msg.entity,\n \"room\": room,\n \"lights\": msg.lights\n\n}\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1850,"y":300,"wires":[["cb125f4b50582619"]]},{"id":"cb125f4b50582619","type":"ha-get-entities","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Get entities","server":"7ab5c227.a3ce8c","version":0,"rules":[],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload.results","output_results_count":1,"x":2310,"y":300,"wires":[["e91a19e1d4d03076"]]},{"id":"e91a19e1d4d03076","type":"switch","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"","property":"payload.results","propertyType":"msg","rules":[{"t":"empty"}],"checkall":"true","repair":false,"outputs":1,"x":2590,"y":300,"wires":[["deb1c3f277dffa05"]]},{"id":"deb1c3f277dffa05","type":"change","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"rules","rules":[{"t":"move","p":"lights.entity_id","pt":"msg","to":"payload.data.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2810,"y":300,"wires":[["bc2e357cd21ccadd"]]},{"id":"bc2e357cd21ccadd","type":"api-call-service","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"","server":"7ab5c227.a3ce8c","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{\"transition\": 30}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3030,"y":300,"wires":[[]]},{"id":"18d49bad3d314fbb","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Prepare regex to check if another motion sensor is on in the room","info":"","x":1910,"y":260,"wires":[]},{"id":"6da1158175acc54a","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Get motion on entities in an array","info":"","x":2330,"y":260,"wires":[]},{"id":"924efdd72ef016a6","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Make sure the array is empty","info":"","x":2600,"y":260,"wires":[]},{"id":"6d38d52715aeb7ef","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Set entity","info":"","x":2820,"y":260,"wires":[]},{"id":"2ae78b52a82bf9e5","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Turn the lights off","info":"","x":3020,"y":260,"wires":[]},{"id":"d3c382301395300b","type":"ha-wait-until","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"","server":"7ab5c227.a3ce8c","version":2,"outputs":1,"entityId":"binary_sensor.all_present_sleeping","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"x":1600,"y":300,"wires":[["db1017a7cb93fa99"]]},{"id":"62fcc1a1fce54141","type":"comment","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Wait until all asleep","info":"","x":1590,"y":260,"wires":[]},{"id":"d22cea5a615c3b79","type":"junction","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","x":1460,"y":300,"wires":[["d3c382301395300b"]]},{"id":"ee596aba36f6626b","type":"junction","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","x":1460,"y":220,"wires":[["d22cea5a615c3b79"]]},{"id":"33b091aa899cef65","type":"junction","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","x":1460,"y":200,"wires":[["21add955f677d2b7"]]},{"id":"054470e44aa3f1ca","type":"api-current-state","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Acid off?","server":"7ab5c227.a3ce8c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.acid_time","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1220,"y":200,"wires":[["92bb7dc9357b96d3"],["d22cea5a615c3b79"]]},{"id":"92bb7dc9357b96d3","type":"api-current-state","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Party off?","server":"7ab5c227.a3ce8c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.party_mode","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1380,"y":200,"wires":[["33b091aa899cef65"],["ee596aba36f6626b"]]},{"id":"4be0a0aa026d1431","type":"api-current-state","z":"9e515b8aa75a9cdd","g":"824fe4cb22842d7f","name":"Kink Off","server":"7ab5c227.a3ce8c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.kink_party","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1080,"y":200,"wires":[["054470e44aa3f1ca"],["d22cea5a615c3b79"]]},{"id":"7ab5c227.a3ce8c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
Advertisement
Add Comment
Please, Sign In to add comment