I am trying to create ESPHome controller for ceiiling fans around my house using CC1101 board. So far it works pretty well, but I need to configure ~10 remote’s buttons multiplied by several fans. I want to avoid repeating raw code and provide some structure. ESPHome’s substitutions
feature seems like a perfect candidate, but I can’t figure out how to apply it to arrays/lists. I.e. I have something like that at the very top of my .yaml file:
substitutions:
cc1101_device_id: 335, -359, 648, -709, 297, -709, 295, -736, 294, -712, 294, -387, 634, -384, 632, -709, 318, -359, 658, -706, 296, -729, 301, -714, 308, -344, 665, -693, 312, -721, 291, -374, 642, -382
cc1101_button_stop: 647, -359, 649, -712, 295, -384, 654, -362, 655, -362, 654, -360, 654, -360, 657
And I want to define binary_sensor like this:
binary_sensor:
- platform: remote_receiver
name: Master Bedroom Fan Stop
raw:
code: [ ${cc1101_device_id} , ${cc1101_button_stop} ]
It fails to compile at code:
line, expecting a plain yaml list instead of what I’ve put into it. I think substitutions simply not applied here, since it is list/array.
Any ideas of alternative that would allow me to modularize configuration?