I’m just a beginner and want to have an Alert when a lamp is on for some minutes, I did check all kind of constructions and the current one is generating Alerts every second or so… For sure I do something wrong but can’t figure out the problem. HA version is 87.0
I hope someone can give me some directions,
many thanks in advance,
Peter
binary_sensor:
platform: template
scan_interval: 5 # seconds
sensors:
lmp:
value_template: "{{is_state('light.hue_go_2','on') }}"
alert:
light_hue:
name: Hue lamp on # ALARM message string
done_message: hue lamp off # end ALARM messsage string
entity_id: binary_sensor.lmp # binary sensor
state: 'on' # problem condition
repeat: 2 # each 2 minutes notify
can_acknowledge: true
skip_first: true # send notification after first delay
notifiers:
- ios_iphone_peter
How did you install Home Assistant? If you’re not using Hass.io/Docker, is the timezone set in Home Assistant the same as the timezone set in the OS?
I ran into a problem way back, and again more recently (6 ish months back) when checking where if the timezones were different alerts would be fired out at around one a second or so.
maybe not relevant in your setup, but you are using a hue light for triggering this alert. Hue is very ‘dangerous’ (read unreliable) for this use case, since the HA Hue integration looses connection to the lights ever so often. See: All my hue lights randomly becoming unavailable among many others threads on this topic.
Having that for a trigger isn’t the best way to test you alerts…I was forced to stop using Hue light states for triggers in regular automations just because of that. Seeing you are using a binary_sensor to top that, makes it even more precarious, since binary_sensors have been an issue in the Hue integration also. Might be solved meanwhile, but I’ve taken out as many as I could just to be sure.
My advice in testing alerts would be not to use hue light states… especially not the hue_go, which has connection irregularities of its own
Ive used this in my setup to see what was going on and I was amazed about the activity (that wasn’t there of course, simply indicating HA lost Hue lights)
water:
name: Water Kitchen
message: "Water has been detected in the kichten for {{ relative_time(states.binary_sensor.water_keuken.last_changed) }}"
done_message: "Water issue has been taken care"
entity_id: binary_sensor.water_keuken
state: 'on'
repeat:
- 10
- 15
- 30
- 60
can_acknowledge: true
skip_first: true
notifiers:
- android