light-control: wip
This commit is contained in:
parent
60d9482999
commit
bc1f5ae7ac
1 changed files with 58 additions and 57 deletions
|
@ -45,69 +45,70 @@ in {
|
||||||
};
|
};
|
||||||
}) allDevices;
|
}) allDevices;
|
||||||
|
|
||||||
#services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
# light = lib.mapAttrsToList (name:
|
light = lib.mapAttrsToList (name:
|
||||||
# { ... }: {
|
{ ... }: {
|
||||||
# platform = "mqtt";
|
platform = "mqtt";
|
||||||
# name = name;
|
name = name;
|
||||||
# state_topic = "zigbee2mqtt/${name}";
|
state_topic = "zigbee2mqtt/${name}";
|
||||||
# availability_topic = "zigbee2mqtt/bridge/state";
|
availability_topic = "zigbee2mqtt/bridge/state";
|
||||||
# command_topic = "zigbee2mqtt/${name}/set";
|
command_topic = "zigbee2mqtt/${name}/set";
|
||||||
# value_template = "{{ value_json.click }}";
|
value_template = "{{ value_json.click }}";
|
||||||
# brightness = true;
|
brightness = true;
|
||||||
# color_temp = true;
|
color_temp = true;
|
||||||
# schema = "json";
|
schema = "json";
|
||||||
# }) allDevices;
|
}) allDevices;
|
||||||
|
|
||||||
# sensor = with lib;
|
# sensor = with lib;
|
||||||
# mapAttrsToList (name:
|
# mapAttrsToList (name:
|
||||||
# { ... }: {
|
# { ... }: {
|
||||||
# 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";
|
||||||
# value_template = "{{ value_json.linkquality}}";
|
# value_template = "{{ value_json.linkquality}}";
|
||||||
# }) allDevices;
|
# }) allDevices;
|
||||||
|
|
||||||
# binary_sensor = lib.mapAttrsToList (name:
|
# binary_sensor = lib.mapAttrsToList (name:
|
||||||
# { ... }: {
|
# { ... }: {
|
||||||
# name = "update_${name}";
|
# name = "update_${name}";
|
||||||
# platform = "mqtt";
|
# platform = "mqtt";
|
||||||
# state_topic = "zigbee2mqtt/${name}";
|
# state_topic = "zigbee2mqtt/${name}";
|
||||||
# availability_topic = "zigbee2mqtt/bridge/state";
|
# availability_topic = "zigbee2mqtt/bridge/state";
|
||||||
# payload_on = true;
|
# payload_on = true;
|
||||||
# payload_off = false;
|
# payload_off = false;
|
||||||
# value_template = "{{ value_json.update_available }}";
|
# value_template = "{{ value_json.update_available }}";
|
||||||
# }) allDevices;
|
# }) allDevices;
|
||||||
|
|
||||||
# # create groups
|
# # create groups
|
||||||
# # -------------
|
# # -------------
|
||||||
# group = let
|
# group = let
|
||||||
|
|
||||||
# # to have nice panels for every device
|
# # to have nice panels for every device
|
||||||
# lightGroups = lib.mapAttrs (name:
|
# lightGroups = lib.mapAttrs (name:
|
||||||
# { ... }: {
|
# { ... }: {
|
||||||
# entities = [
|
# entities = [
|
||||||
# "light.${name}"
|
# "light.${name}"
|
||||||
# "sensor.link_${name}"
|
# "sensor.link_${name}"
|
||||||
# "binary_sensor.update_${name}"
|
# "binary_sensor.update_${name}"
|
||||||
# ];
|
# ];
|
||||||
# }) allDevices;
|
# }) allDevices;
|
||||||
|
|
||||||
# # sort lights into given groups.
|
# # sort lights into given groups.
|
||||||
# sortedInGroups = let
|
# sortedInGroups = let
|
||||||
# groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
|
# groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
|
||||||
# { groups ? [ ], ... }:
|
# { groups ? [ ], ... }:
|
||||||
# map (groupName: { "${groupName}" = "light.${name}"; }) groups)
|
# map (groupName: { "${groupName}" = "light.${name}"; }) groups)
|
||||||
# allDevices));
|
# allDevices));
|
||||||
# in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
|
# in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
|
||||||
|
|
||||||
# in sortedInGroups // lightGroups // {
|
# in sortedInGroups // lightGroups // {
|
||||||
# all_lights.entities =
|
# all_lights.entities =
|
||||||
# lib.mapAttrsToList (name: { ... }: "light.${name}") allDevices;
|
# lib.mapAttrsToList (name: { ... }: "light.${name}") allDevices;
|
||||||
# };
|
# };
|
||||||
#};
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue