Seeking best practices to maintain configuration of dozens of Zigbee2MQTT devices in Home Assistant that are all similar, but may have slight variations?!
My situation: I have a bunch of Inovelli Blue Smart Switches in Zigbee2MQTT. They each have dozens of settings to configure (e.g. LED color, minimum dim setting, etc). Most should have the same core settings (LEDs should all be amber color), but some have slightly different ones (30% LED brightness except bedroom switches should have 15% brightness).
I’ve tried various combinations of scripts, automations, groups, labels, MQTT groups (don’t work), etc. I’ve tried sending raw MQTT messages, editing HA device entities, etc. But everything I’ve tried is either not maintainable and tedious, doesn’t work, etc. What I’d like:
Have a running list of all the devices that share config.
Have some sub-sets of them for “overrides” (e.g. non-dimmers, or bedroom switches).
Have stored, but editable config for all the lists.
Be able to simply configure new devices.
Be able to simply update all devices when I have a new config (e.g. if I grow tired of amber lights and want them all blue)
It looks like Ansible could be useful for config files - but what I need isn’t the config of the Zigbee network, but rather sending Zigbee/MQTT commands or changing HA entity settings (which sends Zigbee/MQTT commands) to the device to change the device’s settings itself.
Each switch stores its own config and isn’t centrally stored or knowable unless HA/Z2M queries for it.
I’d like to hear why a script didn’t work. My first thought would be to use a script with a series of dictionaries. The first is “default” with all of the default configs. Each device that deviates from the default needs its own dictionary containing only the settings that override defaults. That way you can modify the default dictionary to update everything using that default setting but you have a minimal number of additional dictionaries containing exceptions. New devices automatically pick up the defaults and it’s only four or five lines of code to add exceptions as you scale out.