Good morning,
I have an ultrasonic sensor measuring the distance to the bottom of my garage, so that when my garage door opens and goes beneath the sensor, I get a notification that the garage door was opened (and vice versa). This is my code:
- alias: "Garagentor öffnet"
trigger:
- platform: template
value_template: "{{ states('sensor.garagentor')|float < 0.2 }}"
for:
seconds: 3
action:
- service: notify.telegram_alle
data:
title: '*Garagentor*'
message: 'Das Garagentor wurde geöffnet'
That works like a charm, the only problem I have is that when I reboot HA or update the NodeMCU via ESPhome, the sensor sensor.garagentor goes to “not available” and the remplate is rendering as “true” and therefore I receive a notification.
Is there a way I can prevent this from happening? Would it work if instead of saying it has to be smaller than 0.2, it also has to be bigger than 0? If yes, how can I do that?
Thank you and have a nice sunday!
Sascha