39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
---
|
|
- alias: 'Trip Wire #01 > AB'
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.tripwire_10521c66d2e8_direction
|
|
to: "AB"
|
|
action:
|
|
- service: input_number.set_value
|
|
data_template:
|
|
entity_id: input_number.occupants_kitchen
|
|
value: '{{ (states.input_number.occupants_kitchen.state | int ) + 1 }}'
|
|
|
|
- alias: 'Trip Wire #01 > BA'
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.tripwire_10521c66d2e8_direction
|
|
to: "BA"
|
|
action:
|
|
- service: input_number.set_value
|
|
data_template:
|
|
entity_id: input_number.occupants_kitchen
|
|
value: '{{ (states.input_number.occupants_kitchen.state | int ) - 1 }}'
|
|
|
|
- alias: "Set Kitchen Occupancy to True"
|
|
trigger:
|
|
platform: template
|
|
value_template: '{{ (states.input_number.occupants_kitchen.state | int ) > 0 }}'
|
|
action:
|
|
- service: input_boolean.turn_on
|
|
entity_id: input_boolean.occupancy_kitchen
|
|
|
|
- alias: "Set Kitchen Occupancy to False"
|
|
trigger:
|
|
platform: template
|
|
value_template: '{{ (states.input_number.occupants_kitchen.state | int ) == 0 }}'
|
|
action:
|
|
- service: input_boolean.turn_off
|
|
entity_id: input_boolean.occupancy_kitchen
|