Track home occupancy
This commit is contained in:
parent
2959dcdc19
commit
efe0b8849e
|
@ -3,6 +3,9 @@ default_view:
|
|||
icon: mdi:home
|
||||
entities:
|
||||
- group.phones
|
||||
- group.overrides
|
||||
- binary_sensor.occupied
|
||||
- binary_sensor.activity
|
||||
- sun.sun
|
||||
- weather.dark_sky
|
||||
|
||||
|
@ -77,3 +80,8 @@ phones:
|
|||
- device_tracker.homeassistant_pixel
|
||||
- device_tracker.StephaniesIphone
|
||||
- device_tracker.PhilsGalaxyS7Edge
|
||||
|
||||
overrides:
|
||||
name: Overrides
|
||||
entities:
|
||||
- input_boolean.occupied
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
automation:
|
||||
- alias: Turn off lights when everyone leaves
|
||||
action:
|
||||
- service: light.turn_off
|
||||
data:
|
||||
entity_id: group.all_lights
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.occupied
|
||||
to: 'off'
|
||||
- alias: Set occupied
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
data:
|
||||
entity_id: input_boolean.occupied
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.activity
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.phones
|
||||
state: 'not_home'
|
||||
- alias: Unset occupied
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
data:
|
||||
entity_id: input_boolean.occupied
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.activity
|
||||
to: 'off'
|
||||
for:
|
||||
minutes: 10
|
||||
- platform: state
|
||||
entity_id: group.phones
|
||||
to: 'not_home'
|
||||
for:
|
||||
minutes: 10
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.phones
|
||||
state: 'not_home'
|
||||
- condition: state
|
||||
entity_id: binary_sensor.activity
|
||||
state: 'off'
|
||||
|
||||
|
||||
input_boolean:
|
||||
occupied:
|
||||
name: House is occupied
|
||||
icon: mdi:home
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
occupied:
|
||||
friendly_name: Somebody is home
|
||||
device_class: occupancy
|
||||
value_template: >-
|
||||
{{ is_state('group.phones', 'home')
|
||||
or is_state('input_boolean.occupied', 'on')
|
||||
}}
|
||||
activity:
|
||||
friendly_name: House in use
|
||||
device_class: occupancy
|
||||
value_template: >-
|
||||
{{ is_state('group.all_lights', 'on')
|
||||
or is_state('media_player.den', 'playing')
|
||||
}}
|
Loading…
Reference in New Issue