{ pkgs, lib, ... }: let # https://www.zigbee2mqtt.io/devices/GL-C-007-1ID.html allDevices = { "led_1" = { id = "0x00124b001f7a5be9"; }; "led_2" = { id = "0x00124b001ee958b3"; }; }; # -t "zigbee2mqtt/led_1/set" -m '{"state":"ON","transition":0, "color_temp":255}' # -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF","transition":0, "color_temp":255}' # -t "zigbee2mqtt/led_1/set" -m '{"state":"ON","brightness":255,"color":{"hex":"#00FFFF"}}' # -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF"}' in { services.zigbee2mqttConfiguration = lib.mapAttrs' (name: { id, ... }: { name = id; value = { retain = false; friendly_name = name; transition = 1; }; }) allDevices; services.homeAssistantConfig = { light = lib.mapAttrsToList (name: { ... }: { platform = "mqtt"; name = name; state_topic = "zigbee2mqtt/${name}"; availability_topic = "zigbee2mqtt/bridge/state"; command_topic = "zigbee2mqtt/${name}/set"; value_template = "{{ value_json.click }}"; brightness = true; color_temp = true; schema = "json"; }) allDevices; }; }