Hi I have an automation that I use to check the status of the chargers for my ebikes and when they are finished charging it shuts off the electricity to the chargers.
It looks liks this:
alias: TEST CHARGING
description: ''
trigger:
- platform: device
type: turned_on
device_id: f1ea1e101858f505992102b2f61cd0fa
entity_id: switch.bikeport_relay
domain: switch
for:
hours: 0
minutes: 0
seconds: 30
condition:
- type: is_power
condition: device
device_id: f1ea1e101858f505992102b2f61cd0fa
entity_id: sensor.bikeport_power
domain: sensor
below: 4
action:
- type: turn_off
device_id: f1ea1e101858f505992102b2f61cd0fa
entity_id: switch.bikeport_relay
domain: switch
- service: notify.mobile_app_pixel_5
data:
message: TEST_charging_finished
mode: single
My issue is that if the server restarts during a charging cycle the trigger is already active, is there any way for the automation to allways look for if the switch is “on”. The reason why I have a 30 sec delay is that it takes some time before the power is updated from the switch to the system.