Hi there,
Apologies, I’m new here. Hopefully I have posted to the right place!
I have a bidirectional Wallbox EV charger that has a power sensor which is a positive figure regardless of whether I am charging or discharging the car. There is also a ‘status’ sensor with discharging and charging as modes.
I would like to create a helper that changes the power figure to a negative when discharging and keeps it as positive when charging.
I’m then hoping to create automations to vary the amount the car discharges during peak electricity costs to cover what the house is using.
Any help would be greatly appreciated!
Many thanks,
James
Hi, here is some guidelines:
Settings, Devices, Helpers
Create Helper
Template, Sensor
The template would be similar to this:
{% set power = states('sensor.wallbox_power') | int(0) %}
{% if states('sensor.wallbox.status') == 'Discharge' %}
{{ (power * -1) }}
{% else %} {{ power }}
{% endif %}
Then Unit of measurement = W
Device class = Power
Replace with your actual sensors and the actual discharge state.
And before creating the helper, paste the template code in Developer Tools, Template to get it working.
And if the power involves decimals that you want to retain, change int(0) to float(0)