I have helpers like input_booleans and input_select that I have made to help control a certain device it would be great if I could just add these entities to the relevant device.
Relates to this one but you question is boarder than just templates: Why can't we add template entities to existing devices?
Helpers are not provided by a device in any way. So Iām not sure how that would work?
A template entity⦠yeah, maybe, if it provided/extracted information from a device. However, for an input/helper that isnāt the case.
itās more an organise kinda thing.
If I set up an esphome device that relies on a helper for example then adding that helper to the device in HA would make it more ālogicā. More a ārelated toā instead of āstemming fromāā¦
I agree. Most of my helpers are also related with one device. Usually via some automation but still meant for this particular device. All Riemann sum and Utility Meters are always related with one device.
I agree on those, as these consume the device itself (unlike input_* helpers).
But those cases could just be fixed/handled by the respective integrations already. For example, when using a Switch as X, the replacement entity gets added to the device.
So from that perspective, I think āWth canāt I add a helper an existing deviceā would maybe be better described as āWth donāt Riemann sum and Utility Meters add themselves to their respective devicesā.
ā¦/Frenck
Yeah, āhelpersā that use one source entity should always be under this device. I agree that it would be nice to get Riemann sum and Utility meters (what periods?) somehow automatically.
There are also āhelpersā that are not obvious like āDerivative sensorā or statistics min/max/avg sensor.
One simple solution would be to automatically assign all other sensors whose input is from device, under the same device but show them like ārelatedā. It is still good to have distinction what sensors are coming from device/integration and what are added extra by user.
Sometimes the āRelatedā doesnāt work even with the entity itself - again both Rieman sum and Utility Meter are the first ones I see this information missing.
It would just be a UI upgrade though right? So it would be similar to how you currently can assign any entity to any area. But it would just be another drop down, which would allow you to assign any entity to any device. The backend stuff is pretty much already in the place, because the likes of MQTT sensors uses it - mapping a sensor to a device. So on the backend surely it would be as simple as storing in the JSON config - that an entity belongs to a particular device. The only things it wouldnāt work for - would be YAML defined entities that have no unique_id (which is fine, because they canāt be configured in the UI anyway)
You can assign a unique id to most yaml defined entities. just add unique_id: like you would add friendly_name: (enjoy updating your yaml files
Oh I know, as Iāve updated from the old format for things like MQTT and Template stuff, Iāve added unique IDs to stuff. But not everything in YAML has always been able to have a unique ID - itās reasonably recent that that has improved. Once an entity has a unique ID - there is no reason it canāt be added to a device, because itās uniquely identifiable
It should also be possible to assign a device for various template sensors, or SQL sensors. I create various template sensors from power use states of devices and it would be nice to have those appear on the device page.
I like this idea.
Here is my NS panel and it groups the automations and scripts I have to this device in the left panel.
It would be very nice if these included a edit and this input_* filed.
And please make sure there is a edit button so that we can add them manually because my scripts are not here in the list.
That would make it very easy to organize and find everything related to one device.
I fully concur with this WTH. It is very similar to one from last year (WTH canāt I manually create a device from entities?).
I would extend this WTH to be more general, as in the one I linked above. WTH can I not add/link entities to a device, or even compile several into a āvirtualā device? For example, I have a smart plug on my dishwasher that allows me to monitor the power consumption. I have a template that uses this power consumption to create a dishwasher state (off, idle, drying, washing). Currently, this template entity state just floats by itself rather than being linked to the Dishwasher device.
The powercalc integration create sensors about power and energy from a device. The new sensor is added to the device overview. Itās perfect! But why I canāt do it manually? I want it
You are very right. Powercalc is able to add a new Sensor box in the device overview.
I created a Real power sensor for my TV feeding from the socket Power, which creates an Energy sensor for the device (the actual TV).
[It doesnāt actually create/duplicate the power sensor into the TV, it creates a new Energy one that feeds off the power, but that is by design of the creator to avoid duplication I guess).
So, itās possible to do this (add a sensor to a device). As you pointed, the quesiton is how to do this manually. I have sensors, template entities, etc floating around that I would love to merge into the deviceā¦