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

Binary sensor to check automation not working

$
0
0

I have a vibration sensor that gets triggered by the doorbell physically, which triggers an automation

I wanted to add a sensor that checks if the automation has been triggered in the last 60 seconds and if it has, it should not trigger again

I want this to eleminate false trigger from when i turn the lock and open the doorbell and close the door again

I added a template that checks of the automation has been triggered in the last 60 seconds:

binary_sensor.dorrklocka_triggad

{{ now() - state_attr(‘automation.dorrklocka_hemma_borta’, ‘last_triggered’) < timedelta(seconds=60) }}

So I added a condition that checks if the automation.dorrklocka_hemma_borta has been triggered, if off = not recently triggered

But whenever I add that condition, and it shows he value “off”, It wont trigger the automation even though all other conditions match

I’ve tried to add a delay by 1 sec, but no difference:

condition: state
entity_id: binary_sensor.dorrklocka_triggad
state: "off"
enabled: true
for:
  hours: 0
  minutes: 0
  seconds: 1

Thankfull for tips, what is the problem here?

This is the whole yaml:

> alias: Dörrklocka - Hemma & Borta
> description: ""
> triggers:
>   - entity_id: binary_sensor.hall_ytterdorr_vibration_vibration
>     to: "on"
>     trigger: state
> conditions: []
> actions:
>   - delay:
>       hours: 0
>       minutes: 0
>       seconds: 3
>       milliseconds: 0
>   - choose:
>       - conditions:
>           - condition: state
>             entity_id: binary_sensor.hall_ytterdorr_dorrsensor_contact
>             state: "off"
>           - condition: state
>             entity_id: person.jesper_viking
>             state: home
>             for:
>               hours: 0
>               minutes: 0
>               seconds: 0
>           - condition: time
>             after: "07:00:00"
>             before: "23:00:00"
>             enabled: true
>             weekday:
>               - sun
>               - sat
>               - fri
>               - thu
>               - wed
>               - tue
>               - mon
>           - condition: state
>             entity_id: binary_sensor.dorrklocka_triggad
>             state: "off"
>             enabled: true
>         sequence:
>           - metadata: {}
>             data:
>               cache: true
>               media_player_entity_id: media_player.overallt
>               message: Någon knackar på dörren
>               language: sv-SE
>             target:
>               entity_id: tts.home_assistant_cloud
>             enabled: true
>             action: tts.speak
>           - metadata: {}
>             data:
>               message: Någon knackar på dörren!
>             enabled: true
>             action: notify.mobile_app_samsung_s22
>           - metadata: {}
>             target:
>               entity_id:
>                 - scene.hej
>             enabled: true
>             action: scene.turn_on
>             data: {}
>           - delay:
>               hours: 0
>               minutes: 0
>               seconds: 1
>               milliseconds: 300
>             enabled: true
>           - target:
>               entity_id:
>                 - light.dorrklocka
>             data:
>               transition: 1
>             action: light.turn_off
>           - delay:
>               hours: 0
>               minutes: 0
>               seconds: 2
>               milliseconds: 0
>             enabled: true
>           - target:
>               entity_id:
>                 - light.dorrklocka
>             data: {}
>             action: light.turn_on
>           - delay:
>               hours: 0
>               minutes: 0
>               seconds: 1
>               milliseconds: 0
>             enabled: true
>           - target:
>               entity_id:
>                 - light.dorrklocka
>             data:
>               transition: 1
>             action: light.turn_off
>           - delay:
>               hours: 0
>               minutes: 0
>               seconds: 2
>               milliseconds: 0
>             enabled: true
>           - target:
>               entity_id:
>                 - light.dorrklocka
>             data: {}
>             action: light.turn_on
>           - delay:
>               hours: 0
>               minutes: 0
>               seconds: 1
>               milliseconds: 0
>             enabled: true
>           - metadata: {}
>             target:
>               entity_id: scene.hej
>             action: scene.turn_on
>             data: {}
>             enabled: true
>           - delay:
>               hours: 0
>               minutes: 0
>               seconds: 10
>               milliseconds: 0
>       - conditions:
>           - condition: state
>             entity_id: binary_sensor.hall_ytterdorr_dorrsensor_contact
>             state: "off"
>           - condition: state
>             entity_id: person.jesper_viking
>             state: not_home
>         sequence:
>           - action: notify.mobile_app_samsung_s22
>             metadata: {}
>             data:
>               message: dwq
> mode: single

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105960

Trending Articles



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