[SOLVED] Energy monitor units - can't get them to work!

Solved - The underlying issue is that changes in units seem to take quite a bit of time, sometimes hours, to propagate. The reasons are not clear to me, but make sure to do several reboots and reloads, then wait, and in my case the units recovered.

So if its possible you had an incorrect configuration at some point, do a few reloads and wait :frowning:


Hi all, I’m going a little crazy here and I’m sure I’m just missing something simple. I have various power meters, and they all measure in W. For my utility meters, I fork them off and calculate kW to feed into integrations → utility meter. I do this for two items: my “whole house”, and my “EV charger”.

Even though they are both setup identically (I think…) the EV displays as W not Wh.

The values themselves are off because I haven’t found a way to reset the integrators after changing the units. I may just have to give them a new name/uniqueID and start over. So forget the units themselves for now (unless you notice something I’m doing wrong!!).


(above) House is as expected, an energy measurement. EV is a power measurement.

(below) House looks good. ignore the values (negative is from solar). EV energy changed the icon and has a werid unit (?)


I do wonder if I missed up something in the metadata with all the hacking trying to get it work and I should just delete the entities and let it re-create them. The history is not important since I am just spinning this up.

Here is the Yaml:

template:
 sensor:
  - name: "Whole House (W)"
    unique_id: 8c9867df-32fb-47b4-afa6-ce4de1a3f75a
    unit_of_measurement: "W"
    state_class: "measurement"
    device_class: "power"
    availability: >
      {{ has_value('sensor.em16_a1_power') and has_value('sensor.em16_b1_power') }}
    state: >
      {{ (states('sensor.em16_a1_power')|float + states('sensor.em16_b1_power')|float) | round(1) | default(0) }}
    attributes:
      amps: "{{ states('sensor.em16_a1_current') }}, {{ states('sensor.em16_b1_current') }}"
      voltage: "{{ states('sensor.em16_a1_voltage') }}, {{ states('sensor.em16_b1_voltage') }}"
      pf: "{{ states('sensor.em16_a1_power_factor') }}, {{ states('sensor.em16_b1_power_factor') }}"
      energy: "{{ states('sensor.em16_a1_this_month_energy') }}, {{ states('sensor.em16_b1_this_month_energy') }}"

  - name: "Whole House (kW)"
    unique_id: e8ffeb66-7596-4eec-bbde-43b165419866
    unit_of_measurement: "kW"
    state_class: "measurement"
    device_class: "power"
    availability: "{{ has_value('sensor.whole_house') }}"
    state: >
      {{ (states('sensor.whole_house')|float / 1000) | default(0) }}
   
  - name: "EV Charger (W)"
    unique_id: e9971788-f98f-43a2-bcfe-721f60f5c71d
    unit_of_measurement: "W"
    state_class: "measurement"
    device_class: "power"
    availability: >
      {{ has_value('sensor.em16_a2_power') and has_value('sensor.em16_b2_power') }}
    state: >
      {{ (states('sensor.em16_a2_power')|float + states('sensor.em16_b2_power')|float) | round(1) | default(0) }}
    attributes:
      amps: "{{ states('sensor.em16_a2_current') }}, {{ states('sensor.em16_b2_current') }}"
      voltage: "{{ states('sensor.em16_a2_voltage') }}, {{ states('sensor.em16_b2_voltage') }}"
      pf: "{{ states('sensor.em16_a2_power_factor') }}, {{ states('sensor.em16_b2_power_factor') }}"
      energy: "{{ states('sensor.em16_a2_this_month_energy') }}, {{ states('sensor.em16_b2_this_month_energy') }}"

  - name: "EV Charger (kW)"
    unique_id: 4f2073a7-5a0f-45b9-8a71-40a03fc6026d
    unit_of_measurement: "kW"
    state_class: "measurement"
    device_class: "power"
    availability: "{{ has_value('sensor.ev_charger') }}"
    state: >
      {{ (states('sensor.ev_charger')|float / 1000) | default(0) }}

sensor:
    - platform: integration
      source: sensor.whole_house_kw
      unique_id: 8e0f97f5-d6ee-4c58-b464-6b6058078029
      method: "left"
      name: "Whole House Energy (kWh)"
      unit_prefix: k   # <-- does not behave as expected.
      max_sub_interval:
        minutes: 5
        
    - platform: integration
      source: sensor.ev_charger_kw
      name: "EV Energy (kWh)"
      unique_id: 7a2dc1d1-b77e-4531-8620-0f3e2b346aee
      method: "left"
      unit_prefix: k     # <-- does not behave as expected.
      max_sub_interval:
        minutes: 5    

utility_meter:
  daily_energy:
    name: "Whole House Utility Meter (daily)"
    source: sensor.whole_house_energy_kw
    unique_id: c57b98cd-702d-4ee9-8676-d8e092c471f8
    cycle: "daily"

  monthly_energy:
    name: "Whole House Utility Meter (monthly)"
    source: sensor.whole_house_energy_kw
    unique_id: 70630af8-c523-4904-9159-4ed105c454ce
    cycle: "monthly"

# ------------------ EV  -----------------
  ev_daily_energy:
    name: "EV Utility Meter (daily)"
    source: sensor.ev_energy_kw
    unique_id: 2f7222dc-974e-4b4d-9833-aaead667a20f
    cycle: "daily"

  ev_monthly_energy:
    name: "EV Utility Meter (monthly)"
    source: sensor.ev_energy_kw
    unique_id: ccece0e7-7c4e-4924-83e4-e8456aabb43c
    cycle: "monthly"

EDIT:
poking around in the Developer Tools shows me that its wrong:

I removed the kW template integration completely and just configured the card to show my units in kW instead of W, and everything started working. So weird :frowning: