Entities and attributes. And how to configure them

I need help with the below, I think it should work but I so can’t get it done on my own. The whole setup here is to integrate everything via HomeAssistant.

An entity is now integrated via Zigbee Sonoff stick. The entity itself is available in Home Assistant. So far, so good.

Now this entity in Home Assistant also has attributes. See image below. Unfortunately, these attributes are not available as separate entities. Only as an attribute of an entity.

Who can explain to me in plain language IF and HOW I can make the attributes of an entity into a separate entity. I cannot work this out!
My eternal thanks will be yours!

The HomeAssistant Entity:

The attributes via HA developer tools
(Specifically interested in “load_power” and “voltage”):

The basic way would be a state-based Template sensor. You can set one up either through the UI Template Helper editor in the Helpers menu or in your YAML configuration.

The basic template to retrieve the value of an attribute looks like:

state_attr('switch.example', 'voltage')

Templating docs

For energy and power sensors you may also want to consider combining a Template sensor with the Utility Meter integration… it depends on your needs.


Thank you; I will sure try this tonight.

Can you please elaborate some more how I am supposed to add the attributes of the entity? As shown above. They are not available in any of the menus?

The attributes as shown in the yellow field are not available as entities. And i would like them to be. How can I make them available as an entity?

Only the status (On/Off) is available, the attributes are not.

When I try the syntax
I do not get the power as a result.

What am I missing?

You can create template helper in the gui in the helpers section. The template itself that you need to supply would look something like this:

{{ state_attr('switch.your_entity', 'your_attribute') }}

That would give you a separate entity with the same value of the attribute.

But might I ask why you think you need a separate entity? There may be other ways to get at the attribute where you want it. If so, it is not needed to duplicate the information.

Note that you need to replace the entity id and attribute name, because you only posted screenshots I was not able to copy paste your entity id.

1 Like

What menus? What are you actually trying to do?

When I try the syntax
value_template: “{{ state_attr(‘switch.voetpad_158d00023369fc’, ‘power_consumed’) }}”
In the helper, I do not get the power as a result.

The syntax seems correct though; there is a result:

That syntax is for yaml, that is why I said to use the gui and gave you an example without value_template: and surrounding quotes.

The output in the template tester just copied the value template text, which is not what you want in your new entity. You want that to be a number, not a text.

1 Like

Thank you !

{{ state_attr(‘switch.voetpad_158d00023369fc’, ‘power_consumed’) }}