Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96123

Automation: Turn light off if sensor off and another sensor hasn't been on for the last 5 minutes

$
0
0

@velkrosmaak wrote:

I have a door sensor which turns a light on when the door is opened to a room. There is a PIR sensor in that room.

If the door is opened but the PIR isn’t triggered shortly afterwards, I want the light to go off.

This is what I have so far. I feel like I’m close, but just not quite there.


- alias: Turn off Snug lamp when kitchen door opens and no pir
  trigger:
    platform: state
    entity_id: binary_sensor.kitchen_snug_door
    to: 'off'
    for:
      minutes: 5
  condition: 
  - condition: or  
    conditions:
      - condition: state
        entity_id: binary_sensor.snug_pir
        value_template: "((as_timestamp(now()) - as_timestamp(states.binary_sensor.snug_pir.last_changed)) / 60 )| int < 6)"
  action:
    - service: homeassistant.turn_off
      entity_id: group.snug

I’d be really thankful for any help! Cheers!

Posts: 7

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 96123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>