In the spirit of DRY (Don’t repeat yourself), I’m looking to build a resusable sensor template. My suspicion is that this needs to be a custom component, but before I go down that route I want to ensure there isn’t another way.
I have the following repeated four times in my config, once for each member of the family. The only bit that changes is the proximity sensor (in this case proximity.ali_travel). Essentially, the sensor shows how far someone is from home, and changes the icon depending on at home, moving (away/towards home) or parked away from home.
So can this be packaged in such a way that it can be reused by just passing in the proximity sensor?
I realise that, that was why I was seeing if this could be moved into it’s own template somehow. I’m thinking my only option is to build a custom component.
Sure it would be updating a sensor with an automation and not templating.
But there’s actually no integrates way to avoid repetition.
With repetitive configuration file, when there’s no way to avoid repetition I tend to generate my config file with a script, therefore even if the code repeat itself I do not repeat myself and edits are way faster.
So you can use dedicated yalm file generated programmatically
The request is for a method to easily create multiple instances of a single Template Sensor configuration, each with only minor differences. Effectively, a means of templating YAML. There’s no native facility for that purpose.