Is there an easy way to create a set of parametrized devices? Notably, I have a bunchy of fans that each have unique RF codes. Pretty much everything is the same except I’d like to change their name, ID & Code.
Looking at these forums, I’ve tried substitution by declaring my parameters, and that works to create one instance, but on the second instance, it doesn’t like that I’m declaring substitution again. Fair enough that’s not how it works.
Is there a cleaner way than copy/pasting and substituting things around? Here’s what I have that I’d like to create functions for:
Use packages and substitutions, both part on ESPHome. See the docs for more info.
I have about the same situation. I use 7 heating boosters running on ESPHome. They all share the same code, except for their specific device names that are visible for HA.
Thank you so much. That’s the solution. Packages. The yaml I posted above works as-is. I can’t use “substitution:” because only one version of that is allowed, but I can use packages and vars in the following way:
packages:
family_room_fan: !include
file: minkaair.yaml
vars:
device_id: family_room_fan
device_name: Family Room Fan
device_code: "0b1000"
Copy/paste the above block and changes the variables and presto. Cleaner than other alternatives for sure.