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

Mqtt automation after 30 seconds

$
0
0

@alain57 wrote:

Hello,
i have a motion detector that is not working like i was expected and I did a bit of automation
Indeed somehow it detects motion every 5 seconds, but goes to the off status after 90 seconds :confused:

So my plan is to store the timestamp of the last motion it received and when the current time - stored time > 30, turn off the light

basically this is what i did :
if motion detected, publish the current timestamp to an mqtt topic
and i added a sensor (test) that has the value of the mqtt topic

but i didn’t found a way to automate the end of the process :’(

I tried something like this

  trigger:
  - above: '30'
    entity_id: sensor.test
    platform: numeric_state
    value_template: '{{ now().strftime("%s")| int - states(sensor.test) | int  }}'
  condition: []
  action:
  - entity_id: light.lumiere_salle_de_bain_du_bas
    service: light.turn_off

any clue what i’m missing ?

Thanks a lot in advance :wink:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



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