2020-10-21 00:24:16 +02:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
|
|
|
|
# https://www.zigbee2mqtt.io/devices/GL-C-007-1ID.html
|
|
|
|
allDevices = {
|
|
|
|
"led_1" = { id = "0x00124b001f7a5be9"; };
|
|
|
|
"led_2" = { id = "0x00124b001ee958b3"; };
|
|
|
|
};
|
|
|
|
|
2020-10-30 23:39:40 +01:00
|
|
|
# -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}'
|
2020-10-21 00:24:16 +02:00
|
|
|
# -t "zigbee2mqtt/led_1/set" -m '{"state":"ON","brightness":255,"color":{"hex":"#00FFFF"}}'
|
|
|
|
# -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF"}'
|
2021-11-01 09:20:42 +01:00
|
|
|
in
|
|
|
|
{
|
2020-10-21 00:24:16 +02:00
|
|
|
|
2021-11-01 09:20:42 +01:00
|
|
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
|
|
|
(name:
|
|
|
|
{ id, ... }: {
|
|
|
|
name = id;
|
|
|
|
value = {
|
|
|
|
retain = false;
|
|
|
|
friendly_name = name;
|
|
|
|
transition = 1;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
allDevices;
|
2020-10-21 00:24:16 +02:00
|
|
|
|
|
|
|
services.homeAssistantConfig = {
|
|
|
|
|
2021-11-01 09:20:42 +01:00
|
|
|
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;
|
2020-10-21 00:24:16 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|