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";
automation = let
# todo : at night only turn trigger essential groups
presents = room_group: present_group: [
{
alias = "presents -> turn on ${room_group} lights";
@ -62,9 +62,7 @@ in {
entity_id = "group.${room_group}";
};
}
];
in (presents "kitchen_room" "kitchen_room_present")
++ (presents "living_room" "living_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
# -----
floor_room = {
name = "Flur";
view = false;
};
floor_room_present = {
control = "hidden";
name = "Flur Anwesend";
view = false;
};
bed_room = {
name = "Schlafzimmer";
view = false;
};
bed_room_present = {
control = "hidden";
name = "Schlafzimmer Anwesend";
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;
};
in (create_rooms [
{
name = "floor_room";
description = "Flur";
}
{
name = "bed_room";
description = "Schlafzimmer";
}
{
name = "living_room";
description = "Wohnzimmer";
}
{
name = "kitchen_room";
description = "Küche";
}
]) // {
view_rooms = {
name = "Räume";
view = true;

View file

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

View file

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