Hi all,
I’ve just installed HA and I’m puzzling with Utility Meter. I’ve installed the DSMR component and copy and pasted the script for calculating the daily and monthly energy consumption into my configuration.yaml.
utility_meter:
daily_energy_offpeak:
source: sensor.energy_consumption_tarif_1
name: Daily Energy (Offpeak)
cycle: daily
daily_energy_peak:
source: sensor.energy_consumption_tarif_2
name: Daily Energy (Peak)
cycle: daily
daily_gas:
source: sensor.gas_consumption
name: Daily Gas
cycle: daily
monthly_energy_offpeak:
source: sensor.energy_consumption_tarif_1
name: Monthly Energy (Offpeak)
cycle: monthly
monthly_energy_peak:
source: sensor.energy_consumption_tarif_2
name: Monthly Energy (Peak)
cycle: monthly
monthly_gas:
source: sensor.gas_consumption
name: Monthly Gas
cycle: monthly
This works perfectly. But when I wan’t to calculate the total energy per day and per month than I get returned ‘none’. I’ve copy and pasted the code into my configuration.yaml
template:
- sensor:
- name: 'Daily Energy Total'
device_class: energy
unit_of_measurement: kWh
state: >
{% if is_number(states('sensor.daily_energy_offpeak')) and is_number(states('sensor.daily_energy_peak')) %}
{{ states('sensor.daily_energy_offpeak') | float + states('sensor.daily_energy_peak') | float }}
{% else %}
None
{% endif %}
- name: 'Monthly Energy Total'
device_class: energy
unit_of_measurement: kWh
state: >
{% if is_number(states('sensor.monthly_energy_offpeak')) and is_number(states('sensor.monthly_energy_peak')) %}
{{ states('sensor.monthly_energy_offpeak') | float + states('sensor.monthly_energy_peak') | float }}
{% else %}
None
{% endif %}
I can’t figure out where it’s going wrong. Can someone point me in the right direction?
Kind regards,
Bjorn