Sure,
not sure how shareable this is
First up to make my flows modular, each room uses a different flow. There are several sub flows that are then shared with these flows.
The flow defines an env var called roominfo which is a json string. This is copied to msg.roominfo before the sub flow is called.
{
"area": "livingroom",
"dimmers": [
{
"name": "button.livingroom_remote_1_identify",
"type": "Hue v2",
"device_ieee": "00:17:88:01:0c:26:5b:0f"
},
{
"name": "button.livingroom_remote_2_identify",
"type": "Hue v2",
"device_ieee": "00:17:88:01:0b:dc:74:4c"
},
{
"name": "button.sunroom_dimmer_identify",
"type": "Hue v1",
"device_ieee": "00:17:88:01:02:0d:86:a5"
}
],
"heating": {
"boost_timer": "timer.livingroom_heating_boost_timer",
"helper": "input_text.livingroom_heating_target",
"switch_off": "switch.livingroom_switch_heat_off",
"switch_set_back": "switch.livingroom_switch_heat_set_back",
"switch_comfort": "switch.livingroom_switch_heat_comfort",
"switch_boost": "switch.livingroom_switch_heat_boost",
"target_set_back": "input_number.livingroom_heating_target_set_back",
"target_comfort": "input_number.livingroom_heating_target_comfort",
"target_boost": "input_number.livingroom_heating_target_boost",
"thermostat": [
{
"entity_id": "climate.livingroom_heating_thermostat"
},
{
"entity_id": "climate.sun_room_heating_thermostat"
}
]
},
"illuminance_sensors": [
{
"name": "sensor.livingroom_sensor_illuminance"
}
],
"light": "light.livingroom",
"occupancy_sensors": [
{
"name": "binary_sensor.livingroom_sensor_occupancy"
}
],
"occupancy_timer": "timer.livingroom_occupancy",
"scene_helper": "input_text.livingroom_last_scene",
"scene_motion_sensor_enabled": "input_boolean.livingroom_motion_sensor_enabled"
}
This is copied to msg.roominfo whenever it is needed.
The flows then call on sub flows to reduce code duplication. This example gets the room info, sets a scene and records the scene in a text helper.
[{"id":"137ed56e0b5015e1","type":"subflow","name":"Set Scene v5","info":"","category":"","in":[{"x":80,"y":140,"wires":[{"id":"e54cee9257edcdaf"}]}],"out":[{"x":1660,"y":820,"wires":[{"id":"bff43720d24f9d66","port":0},{"id":"5d23706cfe0fb043","port":0},{"id":"7f7e6f274a90526d","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"0b890180283dd5c1","type":"api-call-service","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","name":"Start scene off w/ transition","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{payload.scene}}"],"data":"{ \"transition\": 0.5 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":840,"y":620,"wires":[["d09d7d7b8f812c3b","7f7e6f274a90526d","0aeaad46bc62a728"]]},{"id":"394f521d4b3a3f34","type":"api-call-service","z":"137ed56e0b5015e1","g":"87f57958c3cdd168","name":"Record Scene","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["{{roominfo.scene_helper}}"],"data":"{ \"value\": payload.scene }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":400,"y":300,"wires":[["c913c90eb2d292d2","439836154dbadd50","2fdf80784d27261f"]]},{"id":"5f6c4b47b1849d6a","type":"switch","z":"137ed56e0b5015e1","g":"bdcae038ebeb553a","name":"Scene change required?","property":"payload.scene","propertyType":"msg","rules":[{"t":"neq","v":"payload.oldscene","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1030,"y":120,"wires":[["fa7214dcfcff0e28"],["cbc5de61a6780765"]],"outputLabels":["true","false"]},{"id":"f2785b29847a70ce","type":"switch","z":"137ed56e0b5015e1","g":"792a93e3f99f6b13","name":"","property":"payload.scene","propertyType":"msg","rules":[{"t":"regex","v":"(_off)$","vt":"str","case":false},{"t":"regex","v":"(_wake_up)$","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":430,"y":520,"wires":[["43f4e4b4b559f8d9"],["0b81d8a7b27ec6c8"],["cc0f5a900e3f5324"]]},{"id":"217e4a4ad253cbe4","type":"comment","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","name":"Scene off with 2s transition","info":"","x":770,"y":520,"wires":[]},{"id":"456d3062c0dd1cd1","type":"comment","z":"137ed56e0b5015e1","g":"27e329858e567923","name":"Other scenes","info":"","x":730,"y":1020,"wires":[]},{"id":"d01c9f79f338291f","type":"api-call-service","z":"137ed56e0b5015e1","g":"27e329858e567923","name":"Set other scene types ","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{payload.scene}}"],"data":"{ \"transition\": 0.5 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":840,"y":1100,"wires":[["c56347f18bb34632","bff43720d24f9d66"]]},{"id":"0aeaad46bc62a728","type":"api-call-service","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","name":"Disable Motion Sensors","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["{{roominfo.scene_motion_sensor_enabled}}"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":660,"wires":[["0c6ad65519ec71cc","26d4510d57ea190b"]]},{"id":"d6a43b6044a87fd1","type":"api-call-service","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","name":"Re-enable Motion Sensors","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{roominfo.scene_motion_sensor_enabled}}"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":700,"wires":[["47274fc7632c3d2a"]]},{"id":"f9223df401fc3b5f","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"f4120b65f83a5848","name":"Disable motion sensors","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s \")\t& roominfo.area & \" disable motion sensors\"","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\")\t& \" Set scene w/ 2s transition: \"\t& payload.scene","statusType":"auto","x":830,"y":560,"wires":[]},{"id":"7867d7ecdb4d4bc2","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"27e329858e567923","name":"Set scene other","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\")\t& \" Set other scene types: \" \t& payload.scene","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\")\t& \" Set other scene types: \" \t& payload.scene","statusType":"auto","x":820,"y":1060,"wires":[]},{"id":"3571e0243c9f0cfc","type":"api-call-service","z":"137ed56e0b5015e1","g":"7229bbb1472593fd","name":"Start scene 60s transition","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{payload.scene}}"],"data":"{ \"transition\": 60 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":830,"y":900,"wires":[["5d23706cfe0fb043"]]},{"id":"73f3834290341f0c","type":"comment","z":"137ed56e0b5015e1","g":"7229bbb1472593fd","name":"Scene on with 60s transition","info":"","x":780,"y":820,"wires":[]},{"id":"355ee809c9ed1f0b","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"7229bbb1472593fd","name":"Set scene w/ 60s transition","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") & \" Set scene w/ 60s transition\"","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") & \" Set scene w/ 60s transition\"","statusType":"auto","x":840,"y":860,"wires":[]},{"id":"b5cc8749cbc866a1","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"db8c65ba9d3447d6","name":"dimmer check scene?","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000\") & \"s Chg rqd? \" \t& $$.roominfo.scene_helper \t& \" vs. \" & payload.scene ","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000\") & \"s Chg rqd? \" \t& $$.roominfo.scene_helper \t& \" vs. \" & payload.scene ","statusType":"auto","x":440,"y":1240,"wires":[]},{"id":"e42655aafa84eb25","type":"switch","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"scene == .*_off ? ","property":"payload.scene","propertyType":"msg","rules":[{"t":"regex","v":"(_off)$","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":1320,"wires":[["529425ca9a57e2ec","535f857975b17184"],["30967c299f92b442"]]},{"id":"529425ca9a57e2ec","type":"api-current-state","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Continue if lights are not off","server":"2be748d3.da7088","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":860,"y":1260,"wires":[[],["097658f886fd0d33"]]},{"id":"30967c299f92b442","type":"api-current-state","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Continue if lights are not on","server":"2be748d3.da7088","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":860,"y":1300,"wires":[[],["a85c3f3a72d81a81"]]},{"id":"54f1e0390d264951","type":"api-call-service","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Log entry in Logbook","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"logbook","service":"log","areaId":[],"deviceId":[],"entityId":[],"data":"{\"name\":\"W01 Subflow Set Scene warning\",\"message\":\"scene mismatch\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1360,"y":1260,"wires":[[]]},{"id":"097658f886fd0d33","type":"api-call-service","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Retry scene.{room}_off","server":"2be748d3.da7088","version":5,"debugenabled":true,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{payload.scene}}"],"data":"{ \"transition\": 0.1 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1120,"y":1260,"wires":[["54f1e0390d264951"]]},{"id":"a85c3f3a72d81a81","type":"api-call-service","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Retry other scene types ","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{payload.scene}}"],"data":"{ \"transition\": 0.1 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1130,"y":1300,"wires":[["599ead04ff8aa180"]]},{"id":"599ead04ff8aa180","type":"api-call-service","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Log entry in Logbook","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"logbook","service":"log","areaId":[],"deviceId":[],"entityId":[],"data":"{\"name\":\"W02 Subflow Set Scene warning\",\"message\":\"scene mismatch\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1360,"y":1300,"wires":[[]]},{"id":"c913c90eb2d292d2","type":"change","z":"137ed56e0b5015e1","d":true,"g":"87f57958c3cdd168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":340,"wires":[["1b62bc957585dcfe"]]},{"id":"1b62bc957585dcfe","type":"api-call-service","z":"137ed56e0b5015e1","d":true,"g":"87f57958c3cdd168","name":"Log entry in Logbook","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"logbook","service":"log","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"name\":\"Debug perf\",\t \"message\":\"Debug NR rec scene done \" & $fromMillis(payload),\t \"entity_id\":\"binary_sensor.steves_office_sensor_2_occupancy\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":800,"y":400,"wires":[[]]},{"id":"66f6af9c9cccedfa","type":"comment","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"Handle inconsistancies","info":"","x":440,"y":1200,"wires":[]},{"id":"c56347f18bb34632","type":"change","z":"137ed56e0b5015e1","d":true,"g":"27e329858e567923","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":1180,"y":1060,"wires":[["fc8dc9c3c6ca8195"]]},{"id":"fc8dc9c3c6ca8195","type":"api-call-service","z":"137ed56e0b5015e1","g":"27e329858e567923","name":"Log entry in Logbook","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"logbook","service":"log","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"name\":\"Debug perf\",\t \"message\":\"Debug NR set scene done \" & $fromMillis(payload),\t \"entity_id\":\"binary_sensor.steves_office_sensor_2_occupancy\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":1060,"wires":[[]]},{"id":"439836154dbadd50","type":"api-call-service","z":"137ed56e0b5015e1","g":"87f57958c3cdd168","name":"Log entry in Logbook","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"logbook","service":"log","areaId":[],"deviceId":[],"entityId":[],"data":"{\"name\":\"W04 Subflow Set Scene debug payload\",\"message\": payload.scene}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":800,"y":300,"wires":[[]]},{"id":"b3617cce2531d569","type":"catch","z":"137ed56e0b5015e1","g":"6128cca7d51856c2","name":"Record scene failed?","scope":["394f521d4b3a3f34"],"uncaught":false,"x":360,"y":1460,"wires":[["77747a181fd0c07c"]]},{"id":"77747a181fd0c07c","type":"debug","z":"137ed56e0b5015e1","g":"6128cca7d51856c2","name":"Record scene failed (too long)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":630,"y":1460,"wires":[]},{"id":"2fdf80784d27261f","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"87f57958c3cdd168","name":"debug 372","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":360,"wires":[]},{"id":"e54cee9257edcdaf","type":"ha-get-entities","z":"137ed56e0b5015e1","g":"bdcae038ebeb553a","name":"Get old scene from roominfo.scene_helper","server":"2be748d3.da7088","version":0,"rules":[{"property":"entity_id","logic":"is","value":"roominfo.scene_helper","valueType":"msg"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"oldscene","output_results_count":1,"x":410,"y":120,"wires":[["f81d5704c6b45860"]]},{"id":"8ae8db991392096a","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"bdcae038ebeb553a","name":"SetScene","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") \t& \" Set scene: \" & payload.scene","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") \t& \" Set scene: \" & payload.scene","statusType":"auto","x":980,"y":160,"wires":[]},{"id":"f81d5704c6b45860","type":"change","z":"137ed56e0b5015e1","g":"bdcae038ebeb553a","name":"set oldscene","rules":[{"t":"move","p":"oldscene[0].state","pt":"msg","to":"payload.oldscene","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":120,"wires":[["8ae8db991392096a","5f6c4b47b1849d6a"]]},{"id":"0c6ad65519ec71cc","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"f4120b65f83a5848","name":"Disable motion sensors","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s \")\t& roominfo.area & \" disabled motion sensors\"","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") & \" Disable motion sensors\"","statusType":"auto","x":1130,"y":660,"wires":[]},{"id":"d09d7d7b8f812c3b","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"f4120b65f83a5848","name":"scene w/ transition set","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s \")\t& roominfo.area \t& \" - \" \t& payload.scene\t& \" set.\"","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") & \" Set scene w/ 1.5s transition \" & payload.scene","statusType":"auto","x":1120,"y":620,"wires":[]},{"id":"47274fc7632c3d2a","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"f4120b65f83a5848","name":"Re enable motion","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") & \" Re-enable motion\"","targetType":"jsonata","statusVal":"$formatNumber(($millis()-timestamp)/1000,\"#0.000s\") & \" Re-enable motion\"","statusType":"auto","x":1410,"y":700,"wires":[]},{"id":"26d4510d57ea190b","type":"ha-wait-until","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","name":"Delay 5 seconds","server":"2be748d3.da7088","version":2,"outputs":2,"entityId":"light.bedroom","entityIdFilterType":"exact","property":"state","comparator":"is","value":"999","valueType":"str","timeout":"5","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":810,"y":700,"wires":[[],["d6a43b6044a87fd1"]]},{"id":"c4de22ee7980331f","type":"catch","z":"137ed56e0b5015e1","g":"6128cca7d51856c2","name":"General failure","scope":["0b890180283dd5c1","5f6c4b47b1849d6a","f2785b29847a70ce","217e4a4ad253cbe4","456d3062c0dd1cd1","d01c9f79f338291f","0aeaad46bc62a728","d6a43b6044a87fd1","f9223df401fc3b5f","7867d7ecdb4d4bc2","3571e0243c9f0cfc","73f3834290341f0c","355ee809c9ed1f0b","b5cc8749cbc866a1","e42655aafa84eb25","529425ca9a57e2ec","30967c299f92b442","54f1e0390d264951","097658f886fd0d33","a85c3f3a72d81a81","599ead04ff8aa180","c913c90eb2d292d2","1b62bc957585dcfe","66f6af9c9cccedfa","c56347f18bb34632","fc8dc9c3c6ca8195","439836154dbadd50","b3617cce2531d569","77747a181fd0c07c","e54cee9257edcdaf","8ae8db991392096a","f81d5704c6b45860","0c6ad65519ec71cc","d09d7d7b8f812c3b","47274fc7632c3d2a","26d4510d57ea190b","899745db9fe8f088","2fdf80784d27261f"],"uncaught":false,"x":330,"y":1500,"wires":[["899745db9fe8f088"]]},{"id":"899745db9fe8f088","type":"debug","z":"137ed56e0b5015e1","g":"6128cca7d51856c2","name":"general failure","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":1500,"wires":[]},{"id":"53344284c0c3c22e","type":"change","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"set entityId from roominfo.light ","rules":[{"t":"set","p":"payload.entityId","pt":"msg","to":"roominfo.light","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":1280,"wires":[["e42655aafa84eb25","535f857975b17184"]]},{"id":"535f857975b17184","type":"debug","z":"137ed56e0b5015e1","d":true,"g":"db8c65ba9d3447d6","name":"debug 443","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":1340,"wires":[]},{"id":"fa7214dcfcff0e28","type":"link out","z":"137ed56e0b5015e1","g":"bdcae038ebeb553a","name":"link out 94","mode":"link","links":["b6220a5c292e0131","46b449df9122b3ae"],"x":1255,"y":100,"wires":[]},{"id":"b6220a5c292e0131","type":"link in","z":"137ed56e0b5015e1","g":"792a93e3f99f6b13","name":"link in 63","links":["fa7214dcfcff0e28"],"x":265,"y":520,"wires":[["f2785b29847a70ce"]]},{"id":"46b449df9122b3ae","type":"link in","z":"137ed56e0b5015e1","g":"87f57958c3cdd168","name":"link in 64","links":["fa7214dcfcff0e28"],"x":265,"y":300,"wires":[["394f521d4b3a3f34"]]},{"id":"cbc5de61a6780765","type":"link out","z":"137ed56e0b5015e1","g":"bdcae038ebeb553a","name":"link out 95","mode":"link","links":["942bb9d1638646fb"],"x":1255,"y":160,"wires":[]},{"id":"942bb9d1638646fb","type":"link in","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","name":"link in 65","links":["cbc5de61a6780765"],"x":275,"y":1200,"wires":[["b5cf3be53a55af57"]]},{"id":"cc0f5a900e3f5324","type":"junction","z":"137ed56e0b5015e1","g":"27e329858e567923","x":660,"y":1080,"wires":[["d01c9f79f338291f","7867d7ecdb4d4bc2"]]},{"id":"bff43720d24f9d66","type":"junction","z":"137ed56e0b5015e1","g":"27e329858e567923","x":1520,"y":1100,"wires":[[]]},{"id":"5d23706cfe0fb043","type":"junction","z":"137ed56e0b5015e1","g":"7229bbb1472593fd","x":1520,"y":900,"wires":[[]]},{"id":"0b81d8a7b27ec6c8","type":"junction","z":"137ed56e0b5015e1","g":"7229bbb1472593fd","x":660,"y":880,"wires":[["3571e0243c9f0cfc","355ee809c9ed1f0b"]]},{"id":"43f4e4b4b559f8d9","type":"junction","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","x":680,"y":580,"wires":[["f9223df401fc3b5f","0b890180283dd5c1"]]},{"id":"7f7e6f274a90526d","type":"junction","z":"137ed56e0b5015e1","g":"f4120b65f83a5848","x":1520,"y":640,"wires":[[]]},{"id":"b5cf3be53a55af57","type":"junction","z":"137ed56e0b5015e1","g":"db8c65ba9d3447d6","x":320,"y":1260,"wires":[["53344284c0c3c22e","b5cc8749cbc866a1"]]},{"id":"c2f77dfb3eb38305","type":"group","z":"137ed56e0b5015e1","name":"Set scene and record in scene_helper","style":{"label":true,"stroke":"#000000","fill":"#e3f3d3","color":"#000000"},"nodes":["27e329858e567923","7229bbb1472593fd","f4120b65f83a5848","6128cca7d51856c2","db8c65ba9d3447d6","87f57958c3cdd168","792a93e3f99f6b13","bdcae038ebeb553a"],"x":188,"y":33},{"id":"27e329858e567923","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Normal turn on scenes","style":{"label":true,"fill":"#c8e7a7","color":"#000000"},"nodes":["d01c9f79f338291f","7867d7ecdb4d4bc2","c56347f18bb34632","fc8dc9c3c6ca8195","cc0f5a900e3f5324","456d3062c0dd1cd1","bff43720d24f9d66"],"x":634,"y":979},{"id":"7229bbb1472593fd","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Slow turn on scenes","style":{"label":true,"fill":"#c8e7a7","color":"#000000"},"nodes":["3571e0243c9f0cfc","355ee809c9ed1f0b","73f3834290341f0c","0b81d8a7b27ec6c8","5d23706cfe0fb043"],"x":634,"y":779},{"id":"f4120b65f83a5848","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Turn off scenes need to disable motion sensors","style":{"label":true,"fill":"#c8e7a7","color":"#000000"},"nodes":["0aeaad46bc62a728","0b890180283dd5c1","26d4510d57ea190b","d6a43b6044a87fd1","47274fc7632c3d2a","d09d7d7b8f812c3b","0c6ad65519ec71cc","f9223df401fc3b5f","217e4a4ad253cbe4","43f4e4b4b559f8d9","7f7e6f274a90526d"],"x":634,"y":479},{"id":"6128cca7d51856c2","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Record errors in debug","style":{"stroke":"#000000","label":true,"fill":"#ffbfbf","color":"#000000"},"nodes":["b3617cce2531d569","77747a181fd0c07c","c4de22ee7980331f","899745db9fe8f088"],"x":234,"y":1419},{"id":"db8c65ba9d3447d6","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"","style":{"fill":"#ffffbf","label":true,"color":"#000000","stroke":"#000000"},"nodes":["b5cc8749cbc866a1","e42655aafa84eb25","529425ca9a57e2ec","30967c299f92b442","54f1e0390d264951","097658f886fd0d33","a85c3f3a72d81a81","599ead04ff8aa180","66f6af9c9cccedfa","53344284c0c3c22e","535f857975b17184","b5cf3be53a55af57","942bb9d1638646fb"],"x":234,"y":1159},{"id":"87f57958c3cdd168","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Record scene in helper","style":{"label":true,"fill":"#c8e7a7","color":"#000000"},"nodes":["394f521d4b3a3f34","c913c90eb2d292d2","1b62bc957585dcfe","439836154dbadd50","2fdf80784d27261f","46b449df9122b3ae"],"x":224,"y":259},{"id":"792a93e3f99f6b13","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Activate scene","style":{"label":true,"fill":"#c8e7a7","color":"#000000"},"nodes":["f2785b29847a70ce","b6220a5c292e0131"],"x":224,"y":471.5},{"id":"bdcae038ebeb553a","type":"group","z":"137ed56e0b5015e1","g":"c2f77dfb3eb38305","name":"Determine if scene change (or correction)","style":{"label":true,"stroke":"#000000","color":"#000000","fill":"#c8e7a7"},"nodes":["5f6c4b47b1849d6a","e54cee9257edcdaf","8ae8db991392096a","f81d5704c6b45860","fa7214dcfcff0e28","cbc5de61a6780765"],"x":214,"y":59},{"id":"2be748d3.da7088","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":true,"heartbeatInterval":"10","statusSeparator":"","enableGlobalContextStore":false},{"id":"edeb46a5bd917e55","type":"link in","z":"c478a5ca9411e98f","g":"e03f775a6380a8b0","name":"Turn on Sun Room","links":["94ba3d91773e3f7a"],"x":850,"y":1260,"wires":[["353b38701ac679f8"]],"l":true},{"id":"353b38701ac679f8","type":"change","z":"c478a5ca9411e98f","g":"e03f775a6380a8b0","name":"scene=sunroom_on","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"scene\":\"scene.sunroom_on\",\t \"scene_helper\":\"input_text.sunroom_last_scene\",\t \"scene_motion_sensor_enabled\":\"input_boolean.sunroom_motion_sensor_enabled\"\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":1300,"wires":[["3a346633bf2f97b0"]]},{"id":"aa6e970a32643fb9","type":"subflow:137ed56e0b5015e1","z":"c478a5ca9411e98f","g":"e03f775a6380a8b0","name":"","x":1350,"y":1600,"wires":[[]]}]
The sub flow can check if the scene was already set etc.
I have a couple of lights that occasionally don’t come on in a scene, I plan to add a test that could retry setting some of the lights on or off if they failed to react.
What I don’t like:
If I am making major updates, I like to clone a sub flow and link to it from one flow, and if ok, update the other flows to use the new sub flow. This results in a lot of manual editing of flows, so is error prone. I’m looking for a better way to manage versions and releases.
Steve