I’ve got an EV Charging point and I want to use the state in an automation.
At the moment I have the charger mode state as a string
A = connected but not charging
BXX = not connected
CXX = connected and charging
I can’t seem to get a working template.
This in developer tools:
{{states(“sensor.charger_mode3_state”)}}
{{ ‘’ in “sensor.charger_mode3_state.value” }}
Results in
C2
True
If I add anything to the check like:
{{ ‘C’ in “sensor.charger_mode3_state.value” }} or {{ ‘C2’ in “sensor.charger_mode3_state.value” }}
The result is instantly False, even tho the mode I read is C2
Where in the automation are you trying to use this?
That’s because
Capital letter “C” isn’t in the string “sensor.charger_mode3_state.value”.
{{ a }} or {{ b }} is not a logic expression, it is a way to print two values with the word “or” between them. A logic expression includes the logic operator(s) inside the expression delimiters {{ }}… {{ a or b }}
Its to trigger an automation. I already change the max charging and turn charging completely on or off with automations but if the charger has been off for a long time and it restarts some things go wrong.
So if I only want to charge when there’s solar, it shuts down in the evening automatically and I set the max charging when the sun goes back up but the car is in a kind of sleep state.
If I know my chargepoint is in the connected and power allowed but still not charging mode, I know to trigger my car’s API to restart charging.