Created
August 29, 2023 02:16
-
-
Save viroid/a918df99b89c950c5ea57da44c6e4509 to your computer and use it in GitHub Desktop.
HomeAssistant Room Occupancy
This file contains hidden or 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
| Hybrid Wasp-in-a-Box 20230828 | |
| alias: Occupancy / Room / Bathroom - 1.0 Occupant Detected | |
| description: "" | |
| trigger: | |
| - platform: state | |
| entity_id: | |
| - sensor.mo_bathroom | |
| to: Violated | |
| - platform: state | |
| entity_id: | |
| - light.bathroom_light | |
| to: "on" | |
| condition: | |
| - condition: state | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| state: "off" | |
| action: | |
| - service: input_boolean.turn_on | |
| data: {} | |
| target: | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| mode: single | |
| alias: Occupancy / Room / Bathroom - 2.0 Occupant in the Box | |
| description: "" | |
| trigger: | |
| - platform: state | |
| entity_id: | |
| - sensor.mo_bathroom | |
| to: Violated | |
| condition: | |
| - condition: or | |
| conditions: | |
| - condition: and | |
| conditions: | |
| - condition: state | |
| entity_id: sensor.mo_hallway | |
| state: Normal | |
| - condition: state | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| state: "on" | |
| - condition: state | |
| entity_id: counter.bathroom_occupancy_wiab | |
| state: "0" | |
| - condition: and | |
| conditions: | |
| - condition: state | |
| entity_id: sensor.idr_bathroom | |
| state: Normal | |
| - condition: state | |
| entity_id: counter.bathroom_occupancy_wiab | |
| state: "0" | |
| action: | |
| - service: counter.increment | |
| data: {} | |
| target: | |
| entity_id: counter.bathroom_occupancy_wiab | |
| mode: single | |
| alias: Occupancy / Room / Bathroom - 2.1 Occupant may have escaped - Door | |
| description: "" | |
| trigger: | |
| - platform: state | |
| entity_id: | |
| - sensor.idr_bathroom | |
| to: Violated | |
| condition: | |
| - condition: state | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| state: "on" | |
| action: | |
| - service: counter.reset | |
| data: {} | |
| target: | |
| entity_id: counter.bathroom_occupancy_wiab | |
| mode: single | |
| alias: Occupancy / Room / Bathroom - 2.2 Occupant may have escaped - Motion Barrier | |
| description: "" | |
| trigger: | |
| - platform: state | |
| entity_id: | |
| - sensor.mo_hallway | |
| to: Violated | |
| condition: | |
| - condition: state | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| state: "on" | |
| - condition: state | |
| entity_id: sensor.idr_bathroom | |
| state: Violated | |
| action: | |
| - service: counter.reset | |
| data: {} | |
| target: | |
| entity_id: counter.bathroom_occupancy_wiab | |
| mode: single | |
| alias: Occupancy / Room / Bathroom - 3.0 Unknown | |
| description: "" | |
| trigger: | |
| - platform: time_pattern | |
| seconds: /10 | |
| condition: | |
| - condition: state | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| state: "on" | |
| for: | |
| hours: 0 | |
| minutes: 1 | |
| seconds: 0 | |
| - condition: state | |
| entity_id: counter.bathroom_occupancy_wiab | |
| state: "0" | |
| - condition: state | |
| entity_id: sensor.mo_bathroom | |
| state: Normal | |
| for: | |
| hours: 0 | |
| minutes: 1 | |
| seconds: 0 | |
| action: | |
| - service: input_boolean.turn_off | |
| data: {} | |
| target: | |
| entity_id: input_boolean.bathroom_occupancy_status | |
| - service: counter.reset | |
| data: {} | |
| target: | |
| entity_id: counter.bathroom_occupancy_wiab | |
| mode: single |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sensor.mo_bathroom is a motion sensor (normal/violated)
sensor.idr_bathroom is a door contact (normal/violated)