Re the YAML - that’s a clever trick. I had thought “<<: &…” was effectively one thing, but actually it is two. “<<:” says insert the following indented parts (map) after it at that point, and there just happens to be a separate “&” anchor sitting there as well marking the following indented parts (map) for later re-use.
Interesting that I don’t see that sort of usage in very many YAML explainers.
Also interesting that HA complains about duplicate keys when given a ‘typical’ example of anchor usage such as:
By using references to the state object & YAML anchors, aliases, and overrides we can declare a complex entity once, and then use that as a template for multiple additional entities.
Note, you’ll need to separately declare the required input boolean, text, and number entities as well.
This file (fans-config.yaml) is included with fan: !include fans-config.yaml in configuration.yaml: