Custom fields on devices/entities

I would like to have multiple custom fields associated with devices. I would use these essentially for grouping but a device could be associated with multiple groups. My immediate use case is to associate each of my wall-powered devices with the circuit breaker they are powered by. That way if one device goes offline, I can check the other devices on the same circuit to determine if the breaker is blown, or just a powerstrip or something got turned off. Right now, I am maintaining a separate database accessed via appdaemon to do this. But a custom field ( name and value ) could be used for other situations where a scene isn’t the right solution. Something similar to the to-do entity could also work, if we had access to read the items in the to-do list.

You can use customize to add attributes to an entity. In the past I have done this to indicate the power rating of various devices. So…

light.landing_1:
  power: '5.2'

Gives you…

The only downside to using customization is that it doesn’t show your custom data on the device, which would be nice. You have to drill into the attributes of a specific device to get at those fields. I also use customization to indicate what circuit breaker a device is on so I had to write a script to go through all entities and find those that are on the same breaker.

I like how Powercalc adds a sensor linked to the device with the power calculations and have thought of writing a similar add-on for tracking custom data like the circuit breaker so it’s visible right on the device page itself, but if it were baked into HA that would be a pretty cool feature.

1 Like

Thanks, I didn’t know about customizing entities. I agree with CO_4x4, that it would be nice if we could customize the entities from the device page itself, instead of having to do it through yaml.

It used to be possible to add custom attributes via the UI but the feature was removed in 2021.12.0.

From the Breaking Changes section of 2021.12’s Release Notes:

1 Like

Nice, let me ask this. Can the fields be added at the domain level and then filled in with their correct values from the gui ( through settings ) and their state be saved and restored in the database with each reboot. I’m trying to keep from adding 50 or more custom fields to my configuration.yaml or any other static file.

No.

I know how to add custom attribute for entity, but I really miss custom attribute for device.
I’d like to add for device some description: where it is located in my house, how do I reset this device, etc. , maybe even hyperlink to manual
Having hundred’s devices, it’s easy to forget all details

Let me add another purpose for device attributes/fields.

The MAC address of the device.

No reason to burden the device or even sensor inside the device with what is essentially a static piece of documentation for personal sanity and the inevitable troubleshooting we all go through.

Another use I WOULD have used this attribute/or field would have been battery type. I say would have because like MAC address this is an obvious addition for many devices…… so obvious that there is a wonderful HACS addition to add just that value (battery levels and types) to any device. https://andrew-codechimp.github.io/HA-Battery-Notes/

So how about we “inspire” a move to fix the real issue of the lack in extensibility rather than just each having to hack things up for our one particular type/use for extending a device? Seems to me a general purpose solution is ultimately more stable and long term viable solution to this class of issues.

Thoughts?

1 Like