#Now I m trying to create a template
1 messages · Page 1 of 1 (latest)
here's what I have, as a working template sensor:
`sensor:
- name: "UPS Power Usage"
unit_of_measurement: "kWh"
icon: mdi:server
state: >
{{ (states('sensor.ups_load_2') | float / 100) * 900 / 1000 | round(2) }}
state_class: total_increasing
device_class: energy`
when I look at it in entities, I see a sensor that looks like any other energy meter. But this one isn't available to add to the energy dashboard
You cant have total increasing and energy with unit W
im currently using: unit_of_measurement: "kWh"
my sensor looks like all my other energy meter entitites... but it isn't avaiable in the energy dashboard as an individual item
If you don't add state class it won't show up no
I have state_class
`sensor:
- name: "UPS Power Usage"
unit_of_measurement: kWh
icon: mdi:server
state: >
{{ (states('sensor.ups_load_2') | float / 100) * 900 / 1000 | round(2) }}
state_class: total_increasing
device_class: energy`
Have you checked the Dev tools -> statistics for errors?
just did, right now it says no issue
in statistics, it shows the unit as W but in the entity it is kWh
You understand the difference?
yeah, just making sure that descrpeancy isn't indivitive of an issue
That's the issue then
Believe you are using legacy-style templates. You need to use the new style templates to add state_class
That should give you a rendering error no?
I think what happened is you saved the template once using unit W and then later changed it to kWh. Now the statistics unit is wrong, like you see
It should automatically create an issue for that and then you just click solve...
@solid hound that's it! .... after another reload I found the fix issue
many thanks! wow that was a hard one
now the only issue is this error:
Last reset missing
The following entities have state class 'measurement' but 'last_reset' is missing:
sensor.ups_power_usage
it's a template sensor and apparently last_reset isn't avaiable to templates
Just wait