home-assistant: improved presents tracking

This commit is contained in:
Ingolf Wagner 2020-05-06 22:35:31 +02:00
parent 3576374285
commit 858f2fb2d9
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
2 changed files with 15 additions and 4 deletions

View file

@ -213,12 +213,13 @@ in {
allRoomPresentGroups = map (name: "${name}_present") allRooms; allRoomPresentGroups = map (name: "${name}_present") allRooms;
foo = switchPresentsTracking =
# group to determine presents # group to determine presents
presentGroup: presentGroup:
let let
otherRoomPresentGroups = otherRoomPresentGroups =
builtins.filter (name: name != presentGroup) allRoomPresentGroups; (builtins.filter (name: name != presentGroup)
allRoomPresentGroups) ++ [ "outside" ];
in [ in [
{ {
alias = alias =
@ -293,7 +294,8 @@ in {
}]; }];
} }
]; ];
in flatMap foo allRoomPresentGroups; in (flatMap switchPresentsTracking allRoomPresentGroups)
++ (switchPresentsTracking "outside");
# change light scene in rooms when changing situation # change light scene in rooms when changing situation
# --------------------------------------------------- # ---------------------------------------------------
@ -540,6 +542,7 @@ in {
"group.living_room" "group.living_room"
"group.kitchen_room" "group.kitchen_room"
"group.bath_room" "group.bath_room"
"group.outside"
]; ];
}; };
@ -551,9 +554,17 @@ in {
"group.living_room_present" "group.living_room_present"
"group.kitchen_room_present" "group.kitchen_room_present"
"group.bath_room_present" "group.bath_room_present"
"group.outside"
]; ];
}; };
outside = {
control = "hidden";
name = "Draußen";
view = false;
entities = [ ];
};
# overview # overview
# -------- # --------
all_sensors = { all_sensors = {

View file

@ -9,7 +9,7 @@ let
}; };
"door_sensor_2" = { "door_sensor_2" = {
id = "0x00158d000316d5bf"; id = "0x00158d000316d5bf";
groups = [ "floor_room" "floor_room_present" ]; groups = [ "outside" ];
}; };
"window_sensor_3" = { "window_sensor_3" = {
id = "0x00158d0002f9516f"; id = "0x00158d0002f9516f";