It would be really nice for Home Assistant’s overall organization if we could attach an entity to an existing device and/or create internal devices.
For example, attach helper entities that were created to help with automation or for statistics related to entities that already exist on a device.
Or create an internal device to group several helper entities related to a specific use.
I think it could go like this:
Add the ability to create devices in current Helpers.
Add the ability to include a device in the configuration of entities that are not linked to one. On the frontend it can be similar to the area configuration.
Devices are not really deeply integrated into HA and you should somewhat ignore them.
HA works on entities and there are very few device specific functions, and certainly none for custom devices, so grouping them in devices will make no real difference.
I think devices is mostly for integrations to be able to handle a group of entities, like deleting and creating on connection changes and if you have custom entities, then they might not be handled well by a deletion and later recreation.
I don’t think the OP is asking for a deep integration, just a logical association so that you can view all entities for a device (both integration added and custom ones like template sensors) in the device details screen.
I’ve had to create template sensors for all of my energy meters to prevent them resetting if they go offline, these are now just a big list and I depend on the names or IDs to know which device they are about, it would be nice to be able to associate each template with the device it’s based on for organisation.
Another use case could be associating input values that are used to control automations of a device with the device itself so you can change your automation settings that impact a device from the device screen directly.
I understand the wish, but proper naming if automations and scripts could solve a lot of the organization issues. Automations and scripts can be connected to multiple entities and thereby also multiple devices, which could make it hard.
The “deep” was more meant that HA do not really have the device concept that well implemented and you wish for an easy way to control anything from the device overview is already flawed in the current way devices work, which is why the experts here will advice you not to use devices whenever possible.
I am currently building a custom integration that will allow the user to modify devices in the following ways:
Change device attributes
(Re-)Assign any entity to any device
Create new devices
Merge two devices
Changing attributes and assigning entities already works, however the integration is currently under development, lacking documentation and should be treated as unstable and experimental.
I have a smart plug added to my major white good. One of things that I do is create a template sensor which tells me when a cycle is running. So I can use it in automations.
The it would be really great if I could add this template sensor to this page and it just appears as one of the sensors for this device. This would make ot much cleaner and able to view this data when you need to.
And the people who vote for this issue would also like to be able to use devices to handle a group of entities. Is code somehow more important than end users?
Dashboards & automations deal with entities because devices make no sense there, but the management capabilities are centered around devices and their entities.
I use the device entity view often, and I assume many other people do too. Having a way to logically associate a custom entity with a device makes the management experience better.
Claiming that someone’s naming conventions or the internal implementation are the downfall of their experience is naive and will prevent homeassistant ever reaching the mainstream. I sincerely hope this is not the way the core homeassistant team thinks.
Now here’s my use case for this feature request.
I have a presence sensor that sends distance to target in meters. There’s no unit of measure entity, so i can’t simply configure it to use ft.
From my searches so far it looks like what I need to do is create a template entity and do the conversion there. But then when I go back to the management view there’s no way for me to view it along with all the other entities and that’s a disjointed experience.
Yes.
Code is the base this is built on.
Some decisions have been made about how things are structured and how they interact.
Some of these can be changed, but others are so fundamental that it is not possible without starting all over again.
Home Assistant will never be mainstream.
Mainstream will mean a streamlining that would limit the flexibility of Home Assistant to a degree were it would be unmanagable codewise to support all the devices it can today or it would require a workforce of coders that would be hundreds times bigger than today.
I understand that many see a device as a reference to a physical thing, but it is reference to a group of entities in an integration, which might then relate to a physical thing.
This extra layer with the integration is important, because each integration control their own devices and entities, but with this request several integrations would require control over the same device and that is just a road to chaos.
But you know that integrations do this already and therefore this reason is not really true. Adding entities to (others integration) devices. Even core ones. It is only not available in UI or YAML directly for the user.
No, this should not be a reason to not allow the users to link entities to devices and it is requested not only by one or a niche. See all the WTHs.
If the user, who wants to use this optional link, let him use this optional link. I will not confuse the ones, who are not needing or doing it.
Devices are a half-baked implementation and cause more problems than good.
The use case is valid enough, but HA is entity based and if you need to organize anything, then it would probably be entity-based.
In the current Home Assistant structure, it is possible to create or link a device with just one config entry. Template entities created via YAML do not have a configuration entry.
So it is not an option not to extend it to entities via YAML config, the developers were willing, but it is not compatible.