Home Assistant Attributes Card

Note: Please, be aware that this post may contain affiliate links.

So you have that new Integration in Home Assistant, but once it’s installed, you see that it just gives you one entity, with a bunch of attributes. First things first: don’t blame Lovelace – it’s not Ada‘s fault.

Screenshot of an entity in the "States" tab of the "Developer Tools" Panel in Home Assistant, the single entity with an I.D of climate dot living room has 12 different attributes. One of the attributes is current underscore humidity. It is that attribute we will be working with.
How many attributes in one sensor?

This can be fixed by turning the attributes that we want into sensors themselves and should take about 10 minutes. So sit back, relax, take a deep breath, and off we go.

Oh, by the way – you do have HACS installed, right? If not then simply head over to the HACS site for installation instructions (erm… but make sure you come back yeah?)

Install the Attributes Integration

Screenshot of the attributes integration located in the H.A.C.S panel of Home Assistant
Find the “Attributes” Integration within HACS

Once you are in HACS, Click on “Integrations” and click in the search box, and either search for “attributes” or just look for it – it’s called… well… “Attributes”

Then go into the integration and click “Install”

Restart Home Assistant

You should now restart Home Assistant so that the new integration can be registered. But wait, if you have advanced mode enabled I recommend always checking your configuration (advanced mode can be enabled from within your profile page).

Screenshot of the bottom left corner of the Home Assistant interface showing my initials (J.E)  in a circle, showing that this is the link to the profile page.
Profile page link

Checking your config isn’t as much of an issue now that Home Assistant has added a “Safe Mode”. It’s still a sensible precaution, though, as prevention is always better than the cure.

Assuming your config is healthy, restart Home Assistant. Once it’s restarted, you can create a new entry in your configuration.

Create new sensor

For my new sensor entry I’ll need the:

  • name of the attribute (attribute)
  • entity_id (entity_id)
  • unit of measurement (unit_of_measurement)
  • name you to want to give to your attribute (friendly_name)

I’ll explain why that last one is crossed out shortly.

Using the placeholders above, I can configure the configuration like so:

sensor:
  - platform: attributes
    friendly_name: {friendly_name}
    attribute: {attribute}
    unit_of_measurement: {unit_of_measurement}
    entities:
      - {entity_id}

This could give me something like the following if I were to use my climate.living_room example from the image from above

sensor:
  - platform: attributes
    friendly_name: living_room_humidity
    attribute: current_humidity
    unit_of_measurement: %
    entities:
      - climate.living_room

Whatever version you have from whatever entity you are using, save the file, check your config and assuming all is well – restart.

Go find your sensor

When Ada [Lovelace] loads up again, head over to the “Developer Tools” panel and make sure you are in the “States” tab.

Then, while you are in the filter box, type “sensor” and find your new entity, it will be in the form of.

  1. the new sensor domain ie
    sensor
  2. the dot separator ie
    .
  3. old entity_id without the domain eg climate.living_room =
    living_room
  4. an underscore ie
    _
  5. the name of the attribute eg
    current_humidity

So, in this case, it would be

sensor.living_room_current_humidity

A single issue to workaround

Now one thing I can’t get to work is the friendly_name. I even tried giving it a very unique friendly name so that I’d find it easier, but alas, that didn’t work. I can keep you up to speed on this though, as there is a bug filed for this and I’ll keep up to date with the situation and update this post when it’s fixed.

So if we stick with my climate example and the “current_humidity” attribute I put into the config, the new entity_id will be sensor.living_room_current_humidity

Screenshot of the resulting entity in the "States" tab of the "Developer Tools" panel in Home Assistant. The new sensors I.D is sensor dot living underscore room underscore current underscore humidity with the state of 36. This is the correct value for the new entity.
As promised

The only thing that’s left to do it to keep an eye out for the update when it comes. If you’re not used to HACS, the updatable integrations/plugins etc are listed separately at the top of the page (like this)

Screenshot of the top left corner of the Home Assistant Interface within the H.A.C.S integration.
The integration is on the "Installed" tab of the interface, and there is a sub title of "pending updates". Underneath that there is a single entry for the integration "Alexa Media Player" that is on my system

When the update happens, you can either click on the “changelog” option and read the docs or if you leave the update and check back here, I’ll update the post to reflect the updates.

There you have it, Folks, now you can make it into a graph using the standard Lovelace Graph card, or some other widget.

You’re welcome,

John

Credits

unsplash-logoMathew Schwartz

Featured image by Mathew Schwartz on Unsplash

Grandadevans

I am a disabled veteran of 3 tours of Iraq and a tour of Afghanistan as part of the British Army. No longer able to work as I have to lay down on a sofa-bed in my living room 20-ish hours a day. I'm hoping to be able to make a living blogging about my Home Automation /Smart Home journey and maybe regain some dignity in life.

4 thoughts on “Home Assistant Attributes Card

  • April 6, 2020 at 00:23
    Permalink

    I did not know about this John and believe this should be natively part of HA! Thanks for the tip. Sadly when visiting Github this morning, I noticed the developer is not responding to bugs or pull requests so I’m reluctant to rely on a HA add-on that is not being maintained. If I add a whole bunch of sensors using – attributes and the HA updates and it breaks, looks like there is little hope of a timely fix?

    Reply
    • April 6, 2020 at 06:42
      Permalink

      This is a fantastic point and one that shows a gaping hole in my blogging skills. It is my duty as the person writing the article to make sure that if I’m recommending a plugin/addon etc, that I’ve done my best to make sure that it’s not only suitable but is also safe. It’s the same reason I never recommend a product for what I can get out of it. If the top product in a post happens to be from a manufacturer that doesn’t have any affiliate marketing available, then so be it.
      With that in mind, I have a few options (just thinking through my fingertips here). Either way, I will need to do more research on the addons etc that I use. I could then warn people of this, or I could find alternatives. I think that I’d probably do both of those, to be honest.
      Thank you for your critique and for bringing this deficiency in my blogging style to my attention. That probably wasn’t your intention, but either way, I’m genuinely glad you did as it will allow me to provide a better service 🙂 🙂
      Thanks again
      John

      Reply
  • April 6, 2020 at 07:04
    Permalink

    Hey John. Certainly wasn’t my intention to knock your blogging style as that is faultless. Just something I do now as a matter of course as I’ve become so heavily reliant on HA since I first started using it over 4 years ago.

    Reply
    • April 6, 2020 at 09:09
      Permalink

      When I wrote about whether you meant to criticise or not, I didn’t mean that in a negative context. As I said, I’m glad you drew attention to the problem with the lack of interaction from the creator. I realise that I need to be more thorough and at least transparent as to the reliability of these addons.
      I think there was a comment on here or on the YouTube channel the other week where I thought the person commenting was wrong, and I said so (in a constructive way), so I am not afraid to stick to my position if I think I am correct. It’s just that in this case, I have been missing something in my checklist I will be writing this week as a sort of template for creating posts, that will hopefully negate me having to repeat the same steps for every post.
      Thanks again
      John

      Reply

Leave a Reply