I have an e-bike charger connected to a switchable socket. If the charger draws power for less than a couple of seconds after the socket is being switched on, this is a clear sign that I forgot to plug the charger into the bike.
I want to be notified in this case. While I can think of some clumsy solution with timers or template triggers subtracting last changed timestamps from the current time I suspect, I’m just overlooking something super easy but somehow I can’t figure this out right now.
is there an elegant way to achieve this? Or do I have to use timers or timestamp calculations?
- trigger:
- platform: state
entity_id: switch.SWITCH
to: 'on'
for: 5
condition:
- condition: numeric_state
entity_id: sensor.POWER
below: N
action:
- ...
This will trigger when the switch is turned on and stays on for 5 seconds. At that time it will check the power draw level and if it’s below some threshold it will run the actions.