Hi.
I am trying to write an automation which turns off the charging functionality of my electric car by just using the change of state of its charging status.
When the charging is finished, the charging status changes from ‘charging’ to ‘connected’. If I remove the car while charging, it changes from whatever to ‘not connected’. And, if it comes from whatever to ‘sleeping’, it means that the charging is disabled. In order to avoid problems with transients, I have set that the duration shall be 1 minute.
This is the code:
alias: Coche Stop Charging
description: Set Charging to OFF when car is at 100% or disconnected
trigger:
- platform: state
entity_id: sensor.openevse_openevse_a25c_charging_status
from: charging
to: connected
for:
hours: 0
minutes: 1
seconds: 0
- platform: state
entity_id: sensor.openevse_openevse_a25c_charging_status
to: not connected
for:
hours: 0
minutes: 1
seconds: 0
- platform: state
entity_id: sensor.openevse_openevse_a25c_charging_status
to: sleeping
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- service: input_select.select_option
data:
option: "Off"
target:
entity_id: input_select.coche_modo_carga
mode: single
The thing is that this automation is not triggered as I expected.
For example, this morning, the succession of charging states have been:
- ‘charging’ until 8:15:22
- ‘connected’ from 8:15:22 until 8:25:42
- ‘sleeping’ from 8:25:42
With this data, I expected the automation to be triggered at 8:16:22, that is 1 minute after changing from ‘charging’ to ‘connected’.
However, the automation has been triggered by the last condition at 8:26:42, that is one minute after being in ‘sleeping’:
What am I doing wrong, or how could I write it?
Thanks!