hass: configure fyrtur and batteries

This commit is contained in:
Ingolf Wagner 2020-10-30 23:39:40 +01:00
parent 49574ee6ec
commit 902df4d118
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
10 changed files with 260 additions and 347 deletions

View file

@ -152,7 +152,6 @@ in {
}; };
}; };
} }
{ {
alias = "Set Scene To Outside when opening door"; alias = "Set Scene To Outside when opening door";
trigger = [ trigger = [
@ -179,68 +178,88 @@ in {
}; };
}; };
} }
# window roles # window roles
{ {
alias = "windows down in the evening"; alias = "windows down in the evening";
trigger = [{ trigger = [{
platform = "sun"; platform = "sun";
event = "sunset"; event = "sunset";
offset = "+00:10:00"; # 10 min after sunset offset = "+00:01:00"; # 10 min after sunset
}]; }];
action = [ action = [
{ {
service = "mqtt.publish"; service = "mqtt.publish";
data_template = { data_template = {
topic = "zigbee2mqtt/fyrtur1/set"; topic = "zigbee2mqtt/fyrtur1/set"; # office
payload_template = ''{"position":"15"}''; payload_template = ''{"position":"15"}'';
}; };
} }
{ {
service = "mqtt.publish"; service = "mqtt.publish";
data_template = { data_template = {
topic = "zigbee2mqtt/fyrtur2/set"; topic = "zigbee2mqtt/fyrtur2/set"; # office
payload_template = ''{"position":"15"}''; payload_template = ''{"position":"15"}'';
}; };
} }
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur3/set";
payload_template = ''{"position":"21"}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur4/set";
payload_template = ''{"position":"21"}'';
};
}
]; ];
} }
{ {
alias = "windows up in the morning"; alias = "windows up in the morning";
trigger = [{ trigger = [{
platform = "sun"; platform = "time";
event = "sunrise"; at = "09:00:00";
offset = "-00:3:00"; # 3 min before sunrise
}];
action = [{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur1/set";
payload_template = ''{"position":"90"}'';
};
}]; }];
action = [
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur1/set";
payload_template = ''{"position":"90"}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur3/set";
payload_template = ''{"position":"99"}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur4/set";
payload_template = ''{"position":"99"}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur2/set";
payload_template = ''{"position":"90"}'';
};
}
];
} }
{ # heater
alias = "windows up in the morning";
trigger = [{
platform = "sun";
event = "sunrise";
offset = "+02:30:00"; # 2 1/2 hours after sunrise
}];
action = [{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/fyrtur2/set";
payload_template = ''{"position":"90"}'';
};
}];
}
{ {
alias = "heater on in the morning"; alias = "heater on in the morning";
trigger = [{ trigger = [{
platform = "time"; platform = "time";
at = "09:30:00"; at = "09:00:00";
}]; }];
action = [ action = [
{ {
@ -248,7 +267,7 @@ in {
data_template = { data_template = {
topic = "zigbee2mqtt/heater1/set"; # office topic = "zigbee2mqtt/heater1/set"; # office
payload_template = payload_template =
''{"system_mode":"auto","current_heating_setpoint":21.5}''; ''{"system_mode":"auto","current_heating_setpoint":21.0}'';
}; };
} }
{ {
@ -256,7 +275,7 @@ in {
data_template = { data_template = {
topic = "zigbee2mqtt/heater2/set"; # office topic = "zigbee2mqtt/heater2/set"; # office
payload_template = payload_template =
''{"system_mode":"auto","current_heating_setpoint":21.5}''; ''{"system_mode":"auto","current_heating_setpoint":21.0}'';
}; };
} }
{ {
@ -264,7 +283,7 @@ in {
data_template = { data_template = {
topic = "zigbee2mqtt/heater3/set"; # bed room topic = "zigbee2mqtt/heater3/set"; # bed room
payload_template = payload_template =
''{"system_mode":"auto","current_heating_setpoint":20.0}''; ''{"system_mode":"auto","current_heating_setpoint":19.0}'';
}; };
} }
{ {
@ -272,12 +291,52 @@ in {
data_template = { data_template = {
topic = "zigbee2mqtt/heater4/set"; # storage room topic = "zigbee2mqtt/heater4/set"; # storage room
payload_template = payload_template =
''{"system_mode":"auto","current_heating_setpoint":18.0}''; ''{"system_mode":"auto","current_heating_setpoint":19.0}'';
};
}
];
}
{
alias = "heater up in the early evening";
trigger = [{
platform = "time";
at = "19:45:00";
}];
action = [
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/heater1/set"; # office
payload_template =
''{"system_mode":"auto","current_heating_setpoint":24.0}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/heater2/set"; # office
payload_template =
''{"system_mode":"auto","current_heating_setpoint":24.0}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/heater3/set"; # bed room
payload_template =
''{"system_mode":"auto","current_heating_setpoint":24.0}'';
};
}
{
service = "mqtt.publish";
data_template = {
topic = "zigbee2mqtt/heater4/set"; # storage room
payload_template =
''{"system_mode":"auto","current_heating_setpoint":19.0}'';
}; };
} }
]; ];
} }
{ {
alias = "heater off in the evening"; alias = "heater off in the evening";
trigger = [{ trigger = [{

View file

@ -106,8 +106,9 @@
delay = delay; delay = delay;
command = { command = {
# Configure it once to the color you like # Configure it once to the color you like
# {"state":"{{state}}","brightness":{{brightness}},"color":{"hex":"#FFFFFF}} # {"state":"{{state}}","brightness":{{brightness}},"color":{"hex":"#FFFFFF},"color_temp":255","transition":0}
command = ''{"state":"{{state}}","brightness":{{brightness}}}''; command = ''
{"state":"{{state}}","brightness":{{brightness}},"transition":0}'';
topic = "${topic}/set"; topic = "${topic}/set";
on = "ON"; on = "ON";
off = "OFF"; off = "OFF";
@ -131,6 +132,10 @@
topic = "zigbee2mqtt/light_7"; topic = "zigbee2mqtt/light_7";
rooms = [ "sleeping_room" ]; rooms = [ "sleeping_room" ];
}) })
(led {
topic = "zigbee2mqtt/led_1";
rooms = [ "office_room" ];
})
(led { (led {
topic = "zigbee2mqtt/led_2"; topic = "zigbee2mqtt/led_2";
rooms = [ "kitchen" ]; rooms = [ "kitchen" ];

View file

@ -3,6 +3,7 @@
./mqtt.nix ./mqtt.nix
./zigbee2mqtt/buttons.nix ./zigbee2mqtt/buttons.nix
./zigbee2mqtt/doors.nix ./zigbee2mqtt/doors.nix
./zigbee2mqtt/fyrtur.nix
./zigbee2mqtt/heater.nix ./zigbee2mqtt/heater.nix
./zigbee2mqtt/leds.nix ./zigbee2mqtt/leds.nix
./zigbee2mqtt/lights.nix ./zigbee2mqtt/lights.nix
@ -10,7 +11,6 @@
./zigbee2mqtt/repeater.nix ./zigbee2mqtt/repeater.nix
./zigbee2mqtt/service.nix ./zigbee2mqtt/service.nix
./zigbee2mqtt/temperatur.nix ./zigbee2mqtt/temperatur.nix
./zigbee2mqtt/windows.nix
]; ];
services.zigbee2mqtt = { services.zigbee2mqtt = {

View file

@ -11,19 +11,19 @@ let
allDevices = { allDevices = {
"button_1" = { "button_1" = {
id = "0x00158d0002b04f65"; id = "0x00158d0002b04f65";
groups = [ "living_room" ]; #groups = [ "living_room" ];
states.single = "input_boolean.situation_toggle"; states.single = "input_boolean.situation_toggle";
states.hold = "input_boolean.printer_toggle"; states.hold = "input_boolean.printer_toggle";
}; };
"button_2" = { "button_2" = {
id = "0x00158d0002b04f09"; id = "0x00158d0002b04f09";
groups = [ "bed_room" ]; #groups = [ "bed_room" ];
states.single = "input_boolean.situation_toggle"; states.single = "input_boolean.situation_toggle";
states.hold = "input_boolean.printer_toggle"; states.hold = "input_boolean.printer_toggle";
}; };
"button_3" = { "button_3" = {
id = "0x00158d0002b00e04"; id = "0x00158d0002b00e04";
groups = [ "bed_room" ]; #groups = [ "bed_room" ];
states.single = "input_boolean.situation_toggle"; states.single = "input_boolean.situation_toggle";
states.hold = "input_boolean.printer_toggle"; states.hold = "input_boolean.printer_toggle";
}; };
@ -107,41 +107,37 @@ in {
# create groups # create groups
# ------------- # -------------
group = let #group = let
# # to have nice panels for every device
# to have nice panels for every device # sensorGroups = lib.mapAttrs (name:
sensorGroups = lib.mapAttrs (name: # { states ? { }, ... }:
{ states ? { }, ... }: # let
let # entityIds = { single ? "input_boolean.single_${name}"
entityIds = { single ? "input_boolean.single_${name}" # , double ? "input_boolean.double_${name}"
, double ? "input_boolean.double_${name}" # , hold ? "input_boolean.hold_${name}", ... }: [
, hold ? "input_boolean.hold_${name}", ... }: [ # single
single # double
double # hold
hold # ];
]; # in {
in { # entities = [ "sensor.${name}" ] ++ (entityIds states)
entities = [ "sensor.${name}" ] ++ (entityIds states) # ++ [ "sensor.battery_${name}" "sensor.link_${name}" ];
++ [ "sensor.battery_${name}" "sensor.link_${name}" ]; # }) allDevices;
}) allDevices; # # sort lights into given groups.
# sortedInGroups = let
# sort lights into given groups. # groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
sortedInGroups = let # { groups ? [ ], states ? { }, ... }:
groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name: # map (groupName: {
{ groups ? [ ], states ? { }, ... }: # "${groupName}" = if (lib.hasAttr "single" states) then
map (groupName: { # states.single
"${groupName}" = if (lib.hasAttr "single" states) then # else
states.single # "input_boolean.single_${name}";
else # }) groups) allDevices));
"input_boolean.single_${name}"; # in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
}) groups) allDevices)); #in sortedInGroups // sensorGroups // {
in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries; # all_sensors.entities =
# lib.mapAttrsToList (name: { ... }: "binary_sensor.${name}") allDevices;
in sortedInGroups // sensorGroups // { #};
all_sensors.entities =
lib.mapAttrsToList (name: { ... }: "binary_sensor.${name}") allDevices;
};
# create automation # create automation
# ----------------- # -----------------

View file

@ -0,0 +1,52 @@
{ pkgs, lib, ... }:
let
# https://www.zigbee2mqtt.io/devices/E1757.html
allDevices = {
"fyrtur1" = { id = "0x680ae2fffe64fa40"; }; # office
"fyrtur2" = { id = "0x680ae2fffe6e9f41"; }; # bed room
"fyrtur3" = { id = "0x680ae2fffe8f6411"; }; # office (close to kitchen)
"fyrtur4" = { id = "0x680ae2fffe91d234"; }; # kitchen
};
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":100}'
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":15}'
in {
services.zigbee2mqtt.devices = lib.mapAttrs' (name:
{ id, ... }: {
name = id;
value = {
retain = false;
friendly_name = name;
transition = 0.1;
};
}) allDevices;
services.homeAssistantConfig = {
sensor = lib.flatten (lib.mapAttrsToList (name:
{ ... }: [
{
name = "battery_${name}";
platform = "mqtt";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
unit_of_measurement = "%";
icon = "mdi:battery-10";
value_template = "{{ value_json.battery }}";
}
{
name = "link_${name}";
platform = "mqtt";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
icon = "mdi:signal";
unit_of_measurement = "lqi";
value_template = "{{ value_json.linkquality }}";
}
]) allDevices);
};
}

View file

@ -26,83 +26,27 @@ in {
services.homeAssistantConfig = { services.homeAssistantConfig = {
#light = lib.flatten (lib.mapAttrsToList (name: sensor = lib.flatten (lib.mapAttrsToList (name:
# { ... }: [ { ... }: [
# { {
# name = "rgb_${name}"; name = "battery_${name}";
# platform = "mqtt"; platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}"; state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state"; availability_topic = "zigbee2mqtt/bridge/state";
# brightness = true; unit_of_measurement = "%";
# color_temp = true; icon = "mdi:battery-10";
# xy = true; value_template = "{{ value_json.battery }}";
# schema = "json"; }
# command_topic = "zigbee2mqtt/${name}/rgb/set"; {
# brightness_scale = 254; name = "link_${name}";
# state_topic_postfix = "rgb"; platform = "mqtt";
# } state_topic = "zigbee2mqtt/${name}";
# { availability_topic = "zigbee2mqtt/bridge/state";
# name = "white_${name}"; icon = "mdi:signal";
# platform = "mqtt"; unit_of_measurement = "lqi";
# state_topic = "zigbee2mqtt/${name}"; value_template = "{{ value_json.linkquality }}";
# availability_topic = "zigbee2mqtt/bridge/state"; }
# brightness = true; ]) allDevices);
# schema = "json";
# command_topic = "zigbee2mqtt/${name}/white/set";
# brightness_scale = 254;
# state_topic_postfix = "white";
# }
# ]) allDevices);
#sensor = with lib;
# mapAttrsToList (name:
# { ... }: {
# name = "link_${name}";
# platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# icon = "mdi:signal";
# unit_of_measurement = "lqi";
# value_template = "{{ value_json.linkquality}}";
# }) allDevices;
# binary_sensor = lib.mapAttrsToList (name:
# { ... }: {
# name = "update_${name}";
# platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# payload_on = true;
# payload_off = false;
# value_template = "{{ value_json.update_available }}";
# }) allDevices;
# # create groups
# # -------------
# group = let
# # to have nice panels for every device
# lightGroups = lib.mapAttrs (name:
# { ... }: {
# entities = [
# "light.${name}"
# "sensor.link_${name}"
# "binary_sensor.update_${name}"
# ];
# }) allDevices;
# # sort lights into given groups.
# sortedInGroups = let
# groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
# { groups ? [ ], ... }:
# map (groupName: { "${groupName}" = "light.${name}"; }) groups)
# allDevices));
# in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
# in sortedInGroups // lightGroups // {
# all_lights.entities =
# lib.mapAttrsToList (name: { ... }: "light.${name}") allDevices;
# };
}; };

View file

@ -7,6 +7,8 @@ let
"led_2" = { id = "0x00124b001ee958b3"; }; "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":"ON","brightness":255,"color":{"hex":"#00FFFF"}}'
# -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF"}' # -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF"}'
in { in {

View file

@ -51,63 +51,28 @@ in {
}; };
}) allDevices; }) allDevices;
#services.homeAssistantConfig = { services.homeAssistantConfig = {
# # define meta information sensors # define meta information sensors
# sensor = lib.flatten (lib.mapAttrsToList (name: sensor = lib.flatten (lib.mapAttrsToList (name:
# { ... }: [ { ... }: [
# { {
# name = "battery_${name}"; name = "battery_${name}";
# platform = "mqtt"; platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}"; state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state"; availability_topic = "zigbee2mqtt/bridge/state";
# unit_of_measurement = "%"; unit_of_measurement = "%";
# icon = "mdi:battery-10"; icon = "mdi:battery-10";
# value_template = "{{ value_json.battery }}"; value_template = "{{ value_json.battery }}";
# } }
# { {
# name = "link_${name}"; name = "link_${name}";
# platform = "mqtt"; platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}"; state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state"; availability_topic = "zigbee2mqtt/bridge/state";
# icon = "mdi:signal"; icon = "mdi:signal";
# unit_of_measurement = "lqi"; unit_of_measurement = "lqi";
# value_template = "{{ value_json.linkquality }}"; value_template = "{{ value_json.linkquality }}";
# } }
# ]) allDevices); ]) allDevices);
# binary_sensor = lib.mapAttrsToList (name: };
# { ... }: {
# name = name;
# platform = "mqtt";
# device_class = "motion";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# payload_on = true;
# payload_off = false;
# value_template = "{{ value_json.occupancy }}";
# }) allDevices;
# # create groups
# # -------------
# group = let
# # to have nice panels for every device
# sensorGroups = lib.mapAttrs (name:
# { ... }: {
# entities = [
# "binary_sensor.${name}"
# "sensor.battery_${name}"
# "sensor.link_${name}"
# ];
# }) allDevices;
# # sort lights into given groups.
# sortedInGroups = let
# groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
# { groups ? [ ], ... }:
# map (groupName: { "${groupName}" = "binary_sensor.${name}"; }) groups)
# allDevices));
# in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
# in sortedInGroups // sensorGroups // {
# all_sensors.entities =
# lib.mapAttrsToList (name: { ... }: "binary_sensor.${name}") allDevices;
# };
#};
} }

View file

@ -78,34 +78,30 @@ in {
# create groups # create groups
# ------------- # -------------
group = let #group = let
# # to have nice panels for every device
# sensorGroups = lib.mapAttrs (name:
# { ... }: {
# entities = [
# "sensor.${name}"
# "sensor.humidity_${name}"
# #"sensor.pressure_${name}"
# "sensor.battery_${name}"
# "sensor.link_${name}"
# ];
# }) allDevices;
# # sort lights into given groups.
# sortedInGroups = let
# groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
# { groups ? [ ], ... }:
# map (groupName: { "${groupName}" = "sensor.${name}"; }) groups)
# allDevices));
# in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
#in sortedInGroups // sensorGroups // {
# all_sensors.entities =
# lib.mapAttrsToList (name: { ... }: "sensor.${name}") allDevices;
#};
# to have nice panels for every device
sensorGroups = lib.mapAttrs (name:
{ ... }: {
entities = [
"sensor.${name}"
"sensor.humidity_${name}"
#"sensor.pressure_${name}"
"sensor.battery_${name}"
"sensor.link_${name}"
];
}) allDevices;
# sort lights into given groups.
sortedInGroups = let
groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
{ groups ? [ ], ... }:
map (groupName: { "${groupName}" = "sensor.${name}"; }) groups)
allDevices));
in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
in sortedInGroups // sensorGroups // {
all_sensors.entities =
lib.mapAttrsToList (name: { ... }: "sensor.${name}") allDevices;
};
}; };
} }

View file

@ -1,106 +0,0 @@
{ pkgs, lib, ... }:
let
# https://www.zigbee2mqtt.io/devices/E1757.html
allDevices = {
"fyrtur1" = { id = "0x680ae2fffe64fa40"; }; # office
"fyrtur2" = { id = "0x680ae2fffe6e9f41"; }; # sleeping room
};
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":100}'
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":15}'
in {
services.zigbee2mqtt.devices = lib.mapAttrs' (name:
{ id, ... }: {
name = id;
value = {
retain = false;
friendly_name = name;
transition = 1;
};
}) allDevices;
services.homeAssistantConfig = {
#light = lib.flatten (lib.mapAttrsToList (name:
# { ... }: [
# {
# name = "rgb_${name}";
# platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# brightness = true;
# color_temp = true;
# xy = true;
# schema = "json";
# command_topic = "zigbee2mqtt/${name}/rgb/set";
# brightness_scale = 254;
# state_topic_postfix = "rgb";
# }
# {
# name = "white_${name}";
# platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# brightness = true;
# schema = "json";
# command_topic = "zigbee2mqtt/${name}/white/set";
# brightness_scale = 254;
# state_topic_postfix = "white";
# }
# ]) allDevices);
#sensor = with lib;
# mapAttrsToList (name:
# { ... }: {
# name = "link_${name}";
# platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# icon = "mdi:signal";
# unit_of_measurement = "lqi";
# value_template = "{{ value_json.linkquality}}";
# }) allDevices;
# binary_sensor = lib.mapAttrsToList (name:
# { ... }: {
# name = "update_${name}";
# platform = "mqtt";
# state_topic = "zigbee2mqtt/${name}";
# availability_topic = "zigbee2mqtt/bridge/state";
# payload_on = true;
# payload_off = false;
# value_template = "{{ value_json.update_available }}";
# }) allDevices;
# # create groups
# # -------------
# group = let
# # to have nice panels for every device
# lightGroups = lib.mapAttrs (name:
# { ... }: {
# entities = [
# "light.${name}"
# "sensor.link_${name}"
# "binary_sensor.update_${name}"
# ];
# }) allDevices;
# # sort lights into given groups.
# sortedInGroups = let
# groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
# { groups ? [ ], ... }:
# map (groupName: { "${groupName}" = "light.${name}"; }) groups)
# allDevices));
# in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
# in sortedInGroups // lightGroups // {
# all_lights.entities =
# lib.mapAttrsToList (name: { ... }: "light.${name}") allDevices;
# };
};
}