WTH can't I attach a template sensor to a particular device

I often create derivative template sensors from other sensors created by particular integrations/devices. It would be nice to be able to declare the template to be part of the device, so that it could appear on the device’s page (e.g. under a separate template entities categories).

Or devices could automatically show all the template sensors which depend on the device’s entities.

It actually attaches itself to a device automatically, code reference:

Please note, devices are only a feature that can be used for things managed through the UI; there is no device context or possibility available when creating YAML helpers.

…/Frenck

1 Like

i can create device referneces in yaml, when i create mqtt entities, why the heck isn’t that possible when creating template entities in yaml?

For template helper entities created through the UI, you can associate them with a device through the template options.
I’ve been migrating some of my template sensors that were defined in YML to be configured through the UI (If they don’t use properties that are only definable through YML…)

Migration is not the problem. Problematic might be a situation if one wants to maintain his/her configuration organized in packages. Having some sensors in packages while others in UI isn’t a really good idea.