diff --git a/occupancy_controlled_lights.yaml b/occupancy_controlled_lights.yaml index 0d6b41a..9d65fd2 100644 --- a/occupancy_controlled_lights.yaml +++ b/occupancy_controlled_lights.yaml @@ -80,13 +80,16 @@ variables: {% endif %} trigger: - - trigger: state - domain: binary_sensor - device_class: occupancy + - platform: event + event_type: state_changed + event_data: + domain: binary_sensor condition: - condition: template - value_template: "{{ trigger.entity_id in sensors }}" + value_template: "{{ trigger.event.data.entity_id in sensors }}" + - condition: template + value_template: "{{ state_attr(trigger.event.data.entity_id, 'device_class') == 'occupancy' }}" action: - choose: