Template with Emporia Vue sensors

I am using the Emporia Hue integration which creates entities that are the power utilization for each sensor. I would like to create an entity which I can display which is the su of several sensors. I am new to templating but I thought that templates would be the way to go. However, I am stuck at accessing the sensor values. I tried creating a trivial template like this:

The current power utilization is: {{sensor.power_house_123_1min}}

but that returns an error that β€˜sensor’ is undefined. How do I access the values so that I can get the total as a value I can use?

{{ ((states('sensor.power_house_123_1min') | float (0) )) | round (2) }}

Minor point: the float and round filters should be provided with a default value.

The current version of Home Assistant (October release) will post a warning message to the log if float (and several other filters) has no default value and it is unable to process the value it received. In the December release, it becomes an error message and the template fails.

For more information, refer to 2021.10.0 Breaking Changes - Templates

Helpful post:

1 Like

I tried this:

The current power utilization is {{ ((states('sensor.power_basement_ups_6_1min') | float )) | round (2) }}

I am still getting that sensor is undefined (I cut and pasted the entity id from the Lovelace card that is using it successfully)

Are you trying it in Developer Tools in the Template editor?

EDIT: You can also paste it in a Markdown Card

Yes, I am trying it in Developer tools.

If you copy the template from my first post and paste it in Developer Tools is doesn’t work?

Correct. I’ve tried with different sensors, all of which are properly displaying their values on a Lovelace card and all of which I copied and pasted the entity id.

Template works for me with my entity id’s

My fault…there was a typo in the line. I now have it working. I assume I can add a bunch of sensors to get the total usage.