pepe: prepare lights for the night

This commit is contained in:
Ingolf Wagner 2020-04-14 11:38:40 +02:00
parent ab5ca9b142
commit 98f6fd8eea
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 47 additions and 45 deletions

View file

@ -34,7 +34,7 @@ in {
prometheus.namespace = "hass"; prometheus.namespace = "hass";
automation = let automation = let
# todo : at night only turn trigger essential groups
presents = room_group: present_group: [ presents = room_group: present_group: [
{ {
alias = "presents -> turn on ${room_group} lights"; alias = "presents -> turn on ${room_group} lights";
@ -62,9 +62,7 @@ in {
entity_id = "group.${room_group}"; entity_id = "group.${room_group}";
}; };
} }
]; ];
in (presents "kitchen_room" "kitchen_room_present") in (presents "kitchen_room" "kitchen_room_present")
++ (presents "living_room" "living_room_present") ++ (presents "living_room" "living_room_present")
++ (presents "floor_room" "floor_room_present") ++ (presents "floor_room" "floor_room_present")
@ -72,45 +70,46 @@ in {
]; ];
group = { group = let
create_room = { name, description }: {
"${name}" = {
name = description;
view = false;
entities = [ "group.${name}_essential" ];
};
"${name}_present" = {
control = "hidden";
name = "${description} Anwesend";
view = false;
};
"${name}_essential" = {
control = "hidden";
name = "${description} Minimale Beleuchtung";
view = false;
};
};
create_rooms = rooms:
lib.foldr (a: b: a // b) { } (map create_room rooms);
# rooms # rooms
# ----- # -----
floor_room = { in (create_rooms [
name = "Flur"; {
view = false; name = "floor_room";
}; description = "Flur";
floor_room_present = { }
control = "hidden"; {
name = "Flur Anwesend"; name = "bed_room";
view = false; description = "Schlafzimmer";
}; }
bed_room = { {
name = "Schlafzimmer"; name = "living_room";
view = false; description = "Wohnzimmer";
}; }
bed_room_present = { {
control = "hidden"; name = "kitchen_room";
name = "Schlafzimmer Anwesend"; description = "Küche";
view = false; }
}; ]) // {
living_room = {
name = "Wohnzimmer";
view = false;
};
living_room_present = {
control = "hidden";
name = "Wohnzimmer Anwesend";
view = false;
};
kitchen_room = {
name = "Küche";
view = false;
};
kitchen_room_present = {
control = "hidden";
name = "Küche Anwesend";
view = false;
};
view_rooms = { view_rooms = {
name = "Räume"; name = "Räume";
view = true; view = true;

View file

@ -5,19 +5,19 @@ let
"pal01" = { "pal01" = {
label = "Schlafzimmer Lampe Links"; label = "Schlafzimmer Lampe Links";
icon = "mdi:lightbulb-on"; icon = "mdi:lightbulb-on";
room = "bed_room"; room = "bed_room_essential";
type = "light"; type = "light";
}; };
"pal02" = { "pal02" = {
label = "Flur Lampe"; label = "Flur Lampe";
icon = "mdi:lightbulb-on"; icon = "mdi:lightbulb-on";
room = "floor_room"; room = "floor_room_essential";
type = "light"; type = "light";
}; };
"pal03" = { "pal03" = {
label = "Wohnzimmer Lampe"; label = "Wohnzimmer Lampe";
icon = "mdi:lightbulb-on"; icon = "mdi:lightbulb-on";
room = "living_room"; room = "living_room_essential";
type = "light"; type = "light";
}; };
"pal04" = { "pal04" = {
@ -36,7 +36,7 @@ let
"pal06" = { "pal06" = {
label = "Küchen Lampe"; label = "Küchen Lampe";
icon = "mdi:lightbulb-on"; icon = "mdi:lightbulb-on";
room = "kitchen_room"; room = "kitchen_room_essential";
type = "light"; type = "light";
}; };
"pal07" = { "pal07" = {

View file

@ -57,7 +57,10 @@ let
id = "0x00158d0002f9a5cb"; id = "0x00158d0002f9a5cb";
room = "floor_room_present"; room = "floor_room_present";
}; };
"motion_sensor_7" = { id = "0x00158d0002f9a6aa"; }; "motion_sensor_7" = {
id = "0x00158d0002f9a6aa";
room = "bed_room_present";
};
"motion_sensor_8" = { id = "0x00158d0002f04637"; }; "motion_sensor_8" = { id = "0x00158d0002f04637"; };
}; };
door = { door = {