Hi! I’m using HASS for a while now, but I want to have a card on my dashboard that shows my current actual power usage (which can be negative due to solar production). The problem lies with the calculation for the nett usage for me: It should be as simple as ‘current consumption - current production’, but it’s not that simple it seems.
I currently have this in my template.yaml:
- sensor:
#Huidig netto verbruik
- name: 'Nett usage'
device_class: energy
unit_of_measurement: kW
state: >
{% if is_number(states('sensor.power_consumption')) and is_number(states('sensor.power_production')) %}
{{ (states('sensor.power_consumption') - states('sensor.power_production')) | float (0) }}
{% else %}
0
{% endif %}
Is there something I’m missing?