Created
June 14, 2021 14:15
-
-
Save AlexOwl/f32da9a8c1d306f72bb2735c84e8b821 to your computer and use it in GitHub Desktop.
[HA + NodeRed] Bathroom Occupancy Automation Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input_boolean: | |
bathroom_light_manual: | |
name: Bathroom Light Manual | |
icon: mdi:hand | |
automation bathroom_light: | |
- id: bathroom_light_automation | |
alias: Bathroom Light Automation | |
mode: restart | |
variables: | |
light_entity: light.bathroom_lamps | |
occupancy_entity: binary_sensor.bathroom_occupancy | |
trigger: | |
- platform: state | |
entity_id: binary_sensor.bathroom_occupancy | |
- platform: state | |
entity_id: input_boolean.bathroom_light_manual | |
to: "off" | |
condition: | |
- condition: state | |
entity_id: input_boolean.bathroom_light_manual | |
state: "off" | |
action: | |
- service: "light.turn_{{ 'on' if is_state(occupancy_entity, 'on') else 'off' }}" | |
target: | |
entity_id: "{{ light_entity }}" | |
script: | |
bathroom_light_manual_turn_on: | |
alias: Bathroom Light Manual Turn On | |
mode: restart | |
max_exceeded: silent | |
variables: | |
input_boolean_entity: input_boolean.bathroom_light_manual | |
light_entity: light.bathroom_lamps | |
fields: | |
turn: | |
name: Turn Off/On Light | |
example: true | |
selector: | |
boolean: | |
sequence: | |
- service: input_boolean.turn_on | |
target: | |
entity_id: "{{ input_boolean_entity }}" | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ turn is defined }}" | |
sequence: | |
- service: "light.turn_{{ 'on' if turn else 'off' }}" | |
target: | |
entity_id: "{{ light_entity }}" | |
bathroom_light_manual_turn_off: | |
alias: Bathroom Light Manual Turn Off | |
mode: restart | |
max_exceeded: silent | |
variables: | |
input_boolean_entity: input_boolean.bathroom_light_manual | |
sequence: | |
- service: input_boolean.turn_off | |
target: | |
entity_id: "{{ input_boolean_entity }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "80a84cce.ac2308", | |
"type": "tab", | |
"label": "Bathroom Occupancy", | |
"disabled": false, | |
"info": "" | |
}, | |
{ | |
"id": "49336e6d.8a95b8", | |
"type": "group", | |
"z": "80a84cce.ac2308", | |
"name": "custom timer", | |
"style": { | |
"label": true | |
}, | |
"nodes": [ | |
"94969b3a.cd9518", | |
"bd3fd55f.902e7", | |
"62b140c5.030248", | |
"8d43465d.691ba", | |
"742c8156.d91ec", | |
"33d32b3f.aace5c", | |
"14d70b27.fde8fd", | |
"891e8c22.72ded8", | |
"2641e4f8.c21c0c", | |
"628b6c70.32a04c", | |
"fd846cfa.6c63a8", | |
"1791783.6626a08" | |
], | |
"x": 14, | |
"y": 219, | |
"w": 612, | |
"h": 202 | |
}, | |
{ | |
"id": "78bac265.1f0824", | |
"type": "group", | |
"z": "80a84cce.ac2308", | |
"name": "sensor", | |
"style": { | |
"label": true | |
}, | |
"nodes": [ | |
"799b4ce1.c0a234", | |
"27aa508e.bb7eb", | |
"da92275b.f61f6", | |
"843ca913.cd034", | |
"d6a6d95e.5420d8", | |
"bda7e2ce.97ca8", | |
"e0309b23.a3481", | |
"cf8a43e3.a80f4", | |
"8dbf4733.4ed67", | |
"f1342893.756ce8", | |
"dda12c00.8290b8" | |
], | |
"x": 14, | |
"y": 19, | |
"w": 702, | |
"h": 162 | |
}, | |
{ | |
"id": "cf5d0f17.f1d1", | |
"type": "group", | |
"z": "80a84cce.ac2308", | |
"name": "state", | |
"style": { | |
"label": true | |
}, | |
"nodes": [ | |
"6ed86a33.24e94c", | |
"da49c923.b04f98", | |
"1022e89c.8a88a7", | |
"b891f7bc.3556b8", | |
"7ebf52f7.8bea9c", | |
"eddb097a.93beb", | |
"bd199b99.edc39", | |
"311ad84c.6c0838", | |
"8ba55548.5c704", | |
"74508c33.90716c", | |
"fe04e2e4.e32508", | |
"79a330a.3afe25", | |
"28c73e22.f97322", | |
"1929de31.97087a" | |
], | |
"x": 14, | |
"y": 456.5, | |
"w": 802, | |
"h": 244.5 | |
}, | |
{ | |
"id": "6ed86a33.24e94c", | |
"type": "server-state-changed", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "door", | |
"server": "52d88e32.504f7", | |
"version": 1, | |
"exposeToHomeAssistant": false, | |
"haConfig": [ | |
{ | |
"property": "name", | |
"value": "" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
} | |
], | |
"entityidfilter": "binary_sensor.bathroom_door_contact", | |
"entityidfiltertype": "exact", | |
"outputinitially": false, | |
"state_type": "habool", | |
"haltifstate": "true", | |
"halt_if_type": "bool", | |
"halt_if_compare": "is", | |
"outputs": 2, | |
"output_only_on_state_change": true, | |
"for": 0, | |
"forType": "num", | |
"forUnits": "minutes", | |
"ignorePrevStateNull": false, | |
"ignorePrevStateUnknown": false, | |
"ignorePrevStateUnavailable": false, | |
"ignoreCurrentStateUnknown": false, | |
"ignoreCurrentStateUnavailable": false, | |
"x": 90, | |
"y": 560, | |
"wires": [ | |
[ | |
"b891f7bc.3556b8" | |
], | |
[ | |
"7ebf52f7.8bea9c" | |
] | |
] | |
}, | |
{ | |
"id": "da49c923.b04f98", | |
"type": "server-state-changed", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "motion", | |
"server": "52d88e32.504f7", | |
"version": 1, | |
"exposeToHomeAssistant": false, | |
"haConfig": [ | |
{ | |
"property": "name", | |
"value": "" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
} | |
], | |
"entityidfilter": "binary_sensor.bathroom_motion_occupancy", | |
"entityidfiltertype": "exact", | |
"outputinitially": true, | |
"state_type": "habool", | |
"haltifstate": "true", | |
"halt_if_type": "bool", | |
"halt_if_compare": "is", | |
"outputs": 2, | |
"output_only_on_state_change": false, | |
"for": 0, | |
"forType": "num", | |
"forUnits": "minutes", | |
"ignorePrevStateNull": false, | |
"ignorePrevStateUnknown": false, | |
"ignorePrevStateUnavailable": false, | |
"ignoreCurrentStateUnknown": false, | |
"ignoreCurrentStateUnavailable": false, | |
"x": 90, | |
"y": 620, | |
"wires": [ | |
[ | |
"eddb097a.93beb" | |
], | |
[] | |
] | |
}, | |
{ | |
"id": "799b4ce1.c0a234", | |
"type": "ha-entity", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "bathroom_occupancy", | |
"server": "52d88e32.504f7", | |
"version": 1, | |
"debugenabled": true, | |
"outputs": 1, | |
"entityType": "binary_sensor", | |
"config": [ | |
{ | |
"property": "name", | |
"value": "Bathroom Occupancy" | |
}, | |
{ | |
"property": "device_class", | |
"value": "occupancy" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
}, | |
{ | |
"property": "unit_of_measurement", | |
"value": "" | |
} | |
], | |
"state": "payload", | |
"stateType": "msg", | |
"attributes": [], | |
"resend": true, | |
"outputLocation": "", | |
"outputLocationType": "none", | |
"inputOverride": "block", | |
"outputOnStateChange": false, | |
"outputPayload": "$entity().state ? \"on\": \"off\"", | |
"outputPayloadType": "jsonata", | |
"x": 360, | |
"y": 60, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "27aa508e.bb7eb", | |
"type": "inject", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "clear", | |
"props": [], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"x": 570, | |
"y": 60, | |
"wires": [ | |
[ | |
"f1342893.756ce8" | |
] | |
] | |
}, | |
{ | |
"id": "da92275b.f61f6", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "clear", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "false", | |
"tot": "bool" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 150, | |
"y": 60, | |
"wires": [ | |
[ | |
"799b4ce1.c0a234" | |
] | |
] | |
}, | |
{ | |
"id": "843ca913.cd034", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "occupied", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "true", | |
"tot": "bool" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 160, | |
"y": 100, | |
"wires": [ | |
[ | |
"799b4ce1.c0a234" | |
] | |
] | |
}, | |
{ | |
"id": "d6a6d95e.5420d8", | |
"type": "inject", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "occupied", | |
"props": [], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"x": 580, | |
"y": 100, | |
"wires": [ | |
[ | |
"dda12c00.8290b8" | |
] | |
] | |
}, | |
{ | |
"id": "bda7e2ce.97ca8", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "clear", | |
"links": [ | |
"547e05d4.7be634", | |
"ffa9bc4f.573c1", | |
"f1342893.756ce8", | |
"14c2feed.12c9d1", | |
"311ad84c.6c0838" | |
], | |
"x": 55, | |
"y": 60, | |
"wires": [ | |
[ | |
"da92275b.f61f6" | |
] | |
] | |
}, | |
{ | |
"id": "e0309b23.a3481", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "occupied", | |
"links": [ | |
"1c288229.4f4ede", | |
"25c27ef1.0ad47a", | |
"2dbb3b06.8cd80c", | |
"dda12c00.8290b8", | |
"8ba55548.5c704", | |
"74508c33.90716c", | |
"fe04e2e4.e32508" | |
], | |
"x": 55, | |
"y": 100, | |
"wires": [ | |
[ | |
"843ca913.cd034" | |
] | |
] | |
}, | |
{ | |
"id": "cf8a43e3.a80f4", | |
"type": "server-state-changed", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "", | |
"server": "52d88e32.504f7", | |
"version": 1, | |
"exposeToHomeAssistant": false, | |
"haConfig": [ | |
{ | |
"property": "name", | |
"value": "" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
} | |
], | |
"entityidfilter": "binary_sensor.bathroom_occupancy", | |
"entityidfiltertype": "exact", | |
"outputinitially": true, | |
"state_type": "habool", | |
"haltifstate": "", | |
"halt_if_type": "str", | |
"halt_if_compare": "is", | |
"outputs": 1, | |
"output_only_on_state_change": false, | |
"for": 0, | |
"forType": "num", | |
"forUnits": "minutes", | |
"ignorePrevStateNull": false, | |
"ignorePrevStateUnknown": false, | |
"ignorePrevStateUnavailable": false, | |
"ignoreCurrentStateUnknown": false, | |
"ignoreCurrentStateUnavailable": false, | |
"x": 230, | |
"y": 140, | |
"wires": [ | |
[ | |
"8dbf4733.4ed67" | |
] | |
] | |
}, | |
{ | |
"id": "8dbf4733.4ed67", | |
"type": "debug", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "debug", | |
"active": true, | |
"tosidebar": false, | |
"console": false, | |
"tostatus": true, | |
"complete": "payload", | |
"targetType": "msg", | |
"statusVal": "payload", | |
"statusType": "auto", | |
"x": 510, | |
"y": 140, | |
"wires": [] | |
}, | |
{ | |
"id": "1022e89c.8a88a7", | |
"type": "state-machine", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "", | |
"triggerProperty": "payload", | |
"triggerPropertyType": "msg", | |
"stateProperty": "payload", | |
"statePropertyType": "msg", | |
"initialDelay": "", | |
"persistOnReload": false, | |
"outputStateChangeOnly": true, | |
"throwException": false, | |
"states": [ | |
"clear", | |
"temp by door", | |
"temp by motion", | |
"possible", | |
"occupied" | |
], | |
"transitions": [ | |
{ | |
"name": "open", | |
"from": "clear", | |
"to": "temp by door" | |
}, | |
{ | |
"name": "open", | |
"from": "temp by door", | |
"to": "temp by door" | |
}, | |
{ | |
"name": "open", | |
"from": "temp by motion", | |
"to": "temp by door" | |
}, | |
{ | |
"name": "open", | |
"from": "possible", | |
"to": "temp by door" | |
}, | |
{ | |
"name": "open", | |
"from": "occupied", | |
"to": "temp by door" | |
}, | |
{ | |
"name": "motion", | |
"from": "clear", | |
"to": "temp by motion" | |
}, | |
{ | |
"name": "motion", | |
"from": "temp by door", | |
"to": "temp by motion" | |
}, | |
{ | |
"name": "motion", | |
"from": "temp by motion", | |
"to": "temp by motion" | |
}, | |
{ | |
"name": "motion", | |
"from": "possible", | |
"to": "occupied" | |
}, | |
{ | |
"name": "close", | |
"from": "clear", | |
"to": "possible" | |
}, | |
{ | |
"name": "close", | |
"from": "temp by door", | |
"to": "possible" | |
}, | |
{ | |
"name": "close", | |
"from": "temp by motion", | |
"to": "possible" | |
}, | |
{ | |
"name": "clear", | |
"from": "*", | |
"to": "clear" | |
} | |
], | |
"x": 460, | |
"y": 500, | |
"wires": [ | |
[ | |
"bd199b99.edc39" | |
] | |
] | |
}, | |
{ | |
"id": "b891f7bc.3556b8", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "open", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "open", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 250, | |
"y": 540, | |
"wires": [ | |
[ | |
"1022e89c.8a88a7" | |
] | |
] | |
}, | |
{ | |
"id": "7ebf52f7.8bea9c", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "close", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "close", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 250, | |
"y": 580, | |
"wires": [ | |
[ | |
"1022e89c.8a88a7" | |
] | |
] | |
}, | |
{ | |
"id": "eddb097a.93beb", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "motion", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "motion", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 250, | |
"y": 620, | |
"wires": [ | |
[ | |
"1022e89c.8a88a7" | |
] | |
] | |
}, | |
{ | |
"id": "94969b3a.cd9518", | |
"type": "delay", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "delay", | |
"pauseType": "delayv", | |
"timeout": "0", | |
"timeoutUnits": "seconds", | |
"rate": "1", | |
"nbRateUnits": "1", | |
"rateUnits": "second", | |
"randomFirst": "1", | |
"randomLast": "5", | |
"randomUnits": "seconds", | |
"drop": false, | |
"x": 550, | |
"y": 260, | |
"wires": [ | |
[ | |
"b2423f28.362b9" | |
] | |
] | |
}, | |
{ | |
"id": "bd3fd55f.902e7", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "send reset", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "reset", | |
"pt": "msg", | |
"to": "true", | |
"tot": "bool" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 350, | |
"y": 260, | |
"wires": [ | |
[ | |
"94969b3a.cd9518", | |
"33d32b3f.aace5c" | |
] | |
] | |
}, | |
{ | |
"id": "62b140c5.030248", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "2 min", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "delay", | |
"pt": "msg", | |
"to": "120000", | |
"tot": "num" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 150, | |
"y": 300, | |
"wires": [ | |
[ | |
"bd3fd55f.902e7" | |
] | |
] | |
}, | |
{ | |
"id": "8d43465d.691ba", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "15 min", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "delay", | |
"pt": "msg", | |
"to": "900000", | |
"tot": "num" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 150, | |
"y": 340, | |
"wires": [ | |
[ | |
"bd3fd55f.902e7" | |
] | |
] | |
}, | |
{ | |
"id": "742c8156.d91ec", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "set timer", | |
"rules": [ | |
{ | |
"t": "delete", | |
"p": "reset", | |
"pt": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 360, | |
"y": 340, | |
"wires": [ | |
[ | |
"94969b3a.cd9518" | |
] | |
] | |
}, | |
{ | |
"id": "33d32b3f.aace5c", | |
"type": "switch", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "not reset?", | |
"property": "delay", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 1, | |
"x": 360, | |
"y": 300, | |
"wires": [ | |
[ | |
"742c8156.d91ec" | |
] | |
] | |
}, | |
{ | |
"id": "14d70b27.fde8fd", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "timer: reset", | |
"links": [ | |
"79a330a.3afe25", | |
"311ad84c.6c0838" | |
], | |
"x": 55, | |
"y": 260, | |
"wires": [ | |
[ | |
"1791783.6626a08" | |
] | |
] | |
}, | |
{ | |
"id": "891e8c22.72ded8", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "timer: 3 min", | |
"links": [ | |
"8ba55548.5c704", | |
"74508c33.90716c" | |
], | |
"x": 55, | |
"y": 300, | |
"wires": [ | |
[ | |
"62b140c5.030248" | |
] | |
] | |
}, | |
{ | |
"id": "2641e4f8.c21c0c", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "timer: 15 min", | |
"links": [ | |
"fe04e2e4.e32508" | |
], | |
"x": 55, | |
"y": 340, | |
"wires": [ | |
[ | |
"8d43465d.691ba" | |
] | |
] | |
}, | |
{ | |
"id": "ebd4e4ae.905fc8", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"name": "", | |
"links": [ | |
"1929de31.97087a" | |
], | |
"x": 795, | |
"y": 260, | |
"wires": [] | |
}, | |
{ | |
"id": "bd199b99.edc39", | |
"type": "switch", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "state?", | |
"property": "payload", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "clear", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "temp by door", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "temp by motion", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "possible", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "occupied", | |
"vt": "str" | |
} | |
], | |
"checkall": "false", | |
"repair": false, | |
"outputs": 5, | |
"x": 630, | |
"y": 520, | |
"wires": [ | |
[ | |
"311ad84c.6c0838" | |
], | |
[ | |
"8ba55548.5c704" | |
], | |
[ | |
"74508c33.90716c" | |
], | |
[ | |
"fe04e2e4.e32508" | |
], | |
[ | |
"79a330a.3afe25" | |
] | |
] | |
}, | |
{ | |
"id": "311ad84c.6c0838", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "", | |
"links": [ | |
"14d70b27.fde8fd", | |
"bda7e2ce.97ca8" | |
], | |
"x": 775, | |
"y": 500, | |
"wires": [] | |
}, | |
{ | |
"id": "f1342893.756ce8", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "", | |
"links": [ | |
"bda7e2ce.97ca8" | |
], | |
"x": 675, | |
"y": 60, | |
"wires": [] | |
}, | |
{ | |
"id": "dda12c00.8290b8", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "78bac265.1f0824", | |
"name": "", | |
"links": [ | |
"e0309b23.a3481" | |
], | |
"x": 675, | |
"y": 100, | |
"wires": [] | |
}, | |
{ | |
"id": "8ba55548.5c704", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "", | |
"links": [ | |
"891e8c22.72ded8", | |
"e0309b23.a3481" | |
], | |
"x": 775, | |
"y": 540, | |
"wires": [] | |
}, | |
{ | |
"id": "74508c33.90716c", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "", | |
"links": [ | |
"891e8c22.72ded8", | |
"e0309b23.a3481" | |
], | |
"x": 775, | |
"y": 580, | |
"wires": [] | |
}, | |
{ | |
"id": "fe04e2e4.e32508", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "", | |
"links": [ | |
"2641e4f8.c21c0c", | |
"e0309b23.a3481" | |
], | |
"x": 775, | |
"y": 620, | |
"wires": [] | |
}, | |
{ | |
"id": "79a330a.3afe25", | |
"type": "link out", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "", | |
"links": [ | |
"14d70b27.fde8fd" | |
], | |
"x": 775, | |
"y": 660, | |
"wires": [] | |
}, | |
{ | |
"id": "28c73e22.f97322", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "clear", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "clear", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 250, | |
"y": 500, | |
"wires": [ | |
[ | |
"1022e89c.8a88a7" | |
] | |
] | |
}, | |
{ | |
"id": "1929de31.97087a", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "cf5d0f17.f1d1", | |
"name": "state: clear", | |
"links": [ | |
"ebd4e4ae.905fc8", | |
"481d6225.b8e0c4" | |
], | |
"x": 55, | |
"y": 500, | |
"wires": [ | |
[ | |
"28c73e22.f97322" | |
] | |
] | |
}, | |
{ | |
"id": "628b6c70.32a04c", | |
"type": "function", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "~", | |
"func": "if(!isNaN(msg.payload)) return { delay: msg.payload * 1000 }", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"x": 150, | |
"y": 380, | |
"wires": [ | |
[ | |
"bd3fd55f.902e7" | |
] | |
] | |
}, | |
{ | |
"id": "fd846cfa.6c63a8", | |
"type": "link in", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "timer: {payload} seconds", | |
"links": [], | |
"x": 55, | |
"y": 380, | |
"wires": [ | |
[ | |
"628b6c70.32a04c" | |
] | |
] | |
}, | |
{ | |
"id": "1791783.6626a08", | |
"type": "change", | |
"z": "80a84cce.ac2308", | |
"g": "49336e6d.8a95b8", | |
"name": "reset", | |
"rules": [ | |
{ | |
"t": "delete", | |
"p": "delay", | |
"pt": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 150, | |
"y": 260, | |
"wires": [ | |
[ | |
"bd3fd55f.902e7" | |
] | |
] | |
}, | |
{ | |
"id": "b2423f28.362b9", | |
"type": "function", | |
"z": "80a84cce.ac2308", | |
"name": "~", | |
"func": "return {}", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"x": 690, | |
"y": 260, | |
"wires": [ | |
[ | |
"ebd4e4ae.905fc8" | |
] | |
] | |
}, | |
{ | |
"id": "52d88e32.504f7", | |
"type": "server", | |
"name": "Home Assistant", | |
"addon": true | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
automation light_manual_mode: | |
- id: light_manual_mode_change | |
alias: Light Manual Mode Change | |
mode: restart | |
variables: | |
input_boolean_to_room_name: | |
input_boolean.bathroom_light_manual: в ванной | |
input_boolean.hall_light_manual: в коридоре | |
input_boolean.kitchen_light_manual: на кухне | |
trigger: | |
- platform: state | |
entity_id: | |
- input_boolean.bathroom_light_manual | |
- input_boolean.hall_light_manual | |
- input_boolean.kitchen_light_manual | |
- platform: state | |
entity_id: | |
- input_boolean.bathroom_light_manual | |
- input_boolean.hall_light_manual | |
- input_boolean.kitchen_light_manual | |
to: "on" | |
for: "00:10:00" | |
- platform: state | |
entity_id: | |
- input_boolean.bathroom_light_manual | |
- input_boolean.hall_light_manual | |
- input_boolean.kitchen_light_manual | |
to: "on" | |
for: "01:00:00" | |
action: | |
- variables: | |
room_name: "{{ input_boolean_to_room_name[trigger.entity_id]|d('где-то') }}" | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'on' }}" | |
sequence: | |
- service: script.notify_yandex_station | |
data: | |
message: "Свет {{ room_name }} сейчас управляется выключателем. Сделать по движению?" | |
ask: true | |
tag: "turn-off-{{ trigger.entity_id }}" | |
default: | |
- service: script.notify_yandex_station | |
data: | |
message: "Свет {{ room_name }} сейчас управляется автоматически" | |
- id: light_manual_mode_response | |
alias: Light Manual Mode Response | |
mode: restart | |
variables: | |
accept_intents: | |
- Да | |
- Давай | |
tag_to_script: | |
"turn-off-input_boolean.bathroom_light_manual": "script.bathroom_light_manual_turn_off" | |
"turn-off-input_boolean.hall_light_manual": "script.hall_light_manual_turn_off" | |
"turn-off-input_boolean.kitchen_light_manual": "script.kitchen_light_manual_turn_off" | |
trigger: | |
- platform: event | |
event_type: yandex_station_custom | |
action: | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.event.data.tag|d('') is in (tag_to_script|list) }}" | |
- condition: template | |
value_template: "{{ trigger.event.data.text|d('') is in accept_intents }}" | |
sequence: | |
- service: "{{ tag_to_script[trigger.event.data.tag] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment