pepe: proper hass grouping

This commit is contained in:
Ingolf Wagner 2020-04-16 00:22:29 +02:00
parent 1ff1a25e89
commit b7b7f1f2b3
Signed by: palo
GPG key ID: 76BF5F1928B9618B
7 changed files with 78 additions and 93 deletions

View file

@ -37,65 +37,81 @@ in {
automation = let
# todo : at night only turn trigger essential groups
presents = room_group: present_group: [
roomPresents = { roomGroup, presentsGroup }: [
{
alias = "presents -> turn on ${room_group} lights";
alias = "presents -> turn on ${roomGroup} lights";
trigger = {
platform = "state";
entity_id = "group.${present_group}";
entity_id = "group.${presentsGroup}";
from = "off";
to = "on";
};
action = [
{
service = "switch.turn_on";
entity_id = "group.${room_group}";
entity_id = "group.${roomGroup}";
}
{
service = "light.turn_on";
entity_id = "group.${room_group}";
entity_id = "group.${roomGroup}";
}
];
}
{
alias = "absents -> turn off ${room_group} lights";
alias = "absents -> turn off ${roomGroup} lights";
trigger = {
platform = "state";
entity_id = "group.${present_group}";
entity_id = "group.${presentsGroup}";
from = "on";
to = "off";
};
action = [
{
service = "switch.turn_off";
entity_id = "group.${room_group}";
entity_id = "group.${roomGroup}";
}
{
service = "light.turn_off";
entity_id = "group.${room_group}";
entity_id = "group.${roomGroup}";
}
];
}
];
in (presents "kitchen_room" "kitchen_room_present")
++ (presents "kitchen_room_essential" "kitchen_room_essential_present")
++ (presents "living_room" "living_room_present")
++ (presents "living_essential_room" "living_room_essential_present")
++ (presents "floor_room" "floor_room_present")
++ (presents "floor_room_essential" "floor_room_essential_present")
++ (presents "bath_room" "bath_room_present")
++ (presents "bath_room_essential" "bath_room_essential_present")
++ (presents "bed_room" "bed_room_present")
++ (presents "bed_room_essential" "bed_room_essential_present") ++ [
];
in lib.flatten (map roomPresents [
{
roomGroup = "kitchen_room_lights";
presentsGroup = "kitchen_room_present";
}
{
roomGroup = "living_room_lights";
presentsGroup = "living_room_present";
}
{
roomGroup = "floor_room_lights";
presentsGroup = "floor_room_present";
}
{
roomGroup = "bath_room_lights";
presentsGroup = "bath_room_present";
}
{
roomGroup = "bed_room_lights";
presentsGroup = "bed_room_present";
}
]);
group = let
create_room = { name, description }: {
"${name}" = {
name = description;
name = "${description}";
view = false;
entities = [ "group.${name}_essential" ];
control = "hidden";
entities = [ ];
};
"${name}_lights" = {
name = "${description} Beleuchtung";
view = false;
entities = [ ];
};
"${name}_present" = {
control = "hidden";
@ -109,11 +125,16 @@ in {
view = false;
entities = [ ];
};
"${name}_essential_present" = {
control = "hidden";
name = "${description} Flüchtig Anwesend";
view = false;
entities = [ "group.${name}_present" ];
"view_${name}" = {
name = description;
view = true;
entities = [
"group.${name}"
"group.${name}_lights"
"group.${name}_present"
"group.${name}_essential"
"group.${name}_essential_present"
];
};
};
create_rooms = rooms:
@ -146,46 +167,13 @@ in {
name = "Räume";
view = true;
entities = [
"group.all_lights"
"group.floor_room"
"group.floor_room_essential_present"
"group.bed_room"
"group.bed_room_essential_present"
"group.living_room"
"group.living_room_essential_present"
"group.kitchen_room"
"group.kitchen_room_essential_present"
"group.bath_room"
"group.bath_room_essential_present"
];
};
view_bed_room = {
name = "Schlafzimmer";
view = true;
entities = [ "group.bed_room" "group.bed_room_essential_present" ];
};
view_living_room = {
name = "Wohnzimmer";
view = true;
entities =
[ "group.living_room" "group.living_room_essential_present" ];
};
view_kitchen_room = {
name = "Küche";
view = true;
entities =
[ "group.kitchen_room" "group.kitchen_room_essential_present" ];
};
view_floor_room = {
name = "Flur";
view = true;
entities = [ "group.floor_room" "group.floor_room_essential_present" ];
};
view_bath_room = {
name = "Klo";
view = true;
entities = [ "group.bath_room" "group.bath_room_essential_present" ];
};
# overview
# --------

View file

@ -5,38 +5,38 @@ let
"pal01" = {
label = "Schlafzimmer Lampe Links";
icon = "mdi:lightbulb-on";
room = "bed_room_essential";
room = "bed_room_lights";
type = "light";
};
"pal02" = {
label = "Flur Lampe";
label = "Wohnzimmer Lampe";
icon = "mdi:lightbulb-on";
room = "living_room_essential";
room = "living_room_lights";
type = "light";
};
"pal03" = {
label = "Wohnzimmer Lampe";
icon = "mdi:lightbulb-on";
room = "living_room_essential";
room = "living_room_lights";
type = "light";
};
"pal04" = {
label = "Schlafzimmer Lampe Rechts";
icon = "mdi:lightbulb-on";
room = "bed_room";
room = "bed_room_lights";
type = "light";
};
"pal05" = {
label = "TV";
icon = "mdi:television";
room = "living_room";
room = "living_room_lights";
type = "device";
device = "tv";
};
"pal06" = {
label = "Küchen Lampe";
icon = "mdi:lightbulb-on";
room = "kitchen_room_essential";
room = "kitchen_room_lights";
type = "light";
};
"pal07" = {

View file

@ -12,16 +12,16 @@ let
"button_1" = {
id = "0x00158d0002b04f65";
# states = { click = "input_boolean.living_room_button"; } # input state to hold (optional) (default "input_boolean.single_${name}")
groups = [ "living_room_present" ];
groups = [ "living_room" "living_room_present" ];
};
"button_2" = {
id = "0x00158d0002b04f09";
groups = [ "bed_room_present" ];
groups = [ "bed_room" "bed_room_present" ];
states.single = "input_boolean.bed_room_buttons";
};
"button_3" = {
id = "0x00158d0002b00e04";
groups = [ "bed_room_present" ];
groups = [ "bed_room" "bed_room_present" ];
states.single = "input_boolean.bed_room_buttons";
};
};

View file

@ -6,12 +6,12 @@ let
"door_sensor_1" = { id = "0x00158d000312dc52"; };
"door_sensor_2" = {
id = "0x00158d000316d5bf";
groups = [ "floor_room_present" ];
groups = [ "floor_room" "floor_room_present" ];
};
"door_sensor_3" = { id = "0x00158d0002f9516f"; };
"door_sensor_4" = {
id = "0x00158d00031383b9";
groups = [ "floor_room_present" ];
groups = [ "floor_room" "floor_room_present" ];
};
"door_sensor_5" = { id = "0x00158d0003120d3e"; };
};

View file

@ -5,29 +5,26 @@ let
allDevices = {
"light_1" = {
id = "0x7cb03eaa0a0347b5";
groups = [ "floor_room_essential" ];
groups = [ "floor_room" "floor_room_essential" "floor_room_lights" ];
};
"light_2" = {
id = "0x7cb03eaa0a0387b9";
groups = [ "floor_room" ];
groups = [ "floor_room" "floor_room_lights" ];
};
"light_3" = {
id = "0x7cb03eaa0a033a86";
groups = [ "living_room" ];
groups = [ "living_room" "living_room_lights" ];
};
"light_4" = {
id = "0x7cb03eaa0a04aabf";
groups = [ "bath_room_essential" ];
};
"light_5" = {
id = "0x7cb03eaa0a0346e4";
groups = [ "living_room" ];
groups = [ "bath_room" "bath_room_essential" "bath_room_lights" ];
};
"light_5" = { id = "0x7cb03eaa0a0346e4"; };
"light_6" = { id = "0x7cb03eaa0a034b46"; };
"light_7" = { id = "0x7cb03eaa0a033b4f"; };
"light_8" = {
id = "0x7cb03eaa0a0384d3";
groups = [ "bed_room" ];
groups = [ "bed_room" "bed_room_essential" "bed_room_lights" ];
};
};

View file

@ -6,42 +6,42 @@ let
"motion_sensor_1" = {
id = "0x00158d0002fbd451";
groups = [ "kitchen_room_present" ];
groups = [ "kitchen_room" "kitchen_room_present" ];
timeout = 60 * 2;
};
"motion_sensor_2" = {
id = "0x00158d0002f9a6b8";
groups = [ "kitchen_room_present" ];
groups = [ "kitchen_room" "kitchen_room_present" ];
timeout = 60 * 2;
};
"motion_sensor_3" = {
id = "0x00158d0002f04522";
groups = [ "living_room_present" ];
groups = [ "living_room" "living_room_present" ];
timeout = 60 * 3;
};
"motion_sensor_4" = {
id = "0x00158d0002f9a558";
groups = [ "living_room_present" ];
groups = [ "living_room" "living_room_present" ];
timeout = 60 * 3;
};
"motion_sensor_5" = {
id = "0x00158d0002f9a56f";
groups = [ "bath_room_essential_present" ];
groups = [ "bath_room" "bath_room_present" ];
timeout = 60 * 3;
};
"motion_sensor_6" = {
id = "0x00158d0002f9a5cb";
groups = [ "floor_room_present" ];
timeout = 60 * 5;
groups = [ "floor_room" "floor_room_present" ];
timeout = 60 * 2;
};
"motion_sensor_7" = {
id = "0x00158d0002f9a6aa";
groups = [ "bed_room_essential_present" ];
groups = [ "bed_room" "bed_room_present" ];
timeout = 60 * 1.2;
};
"motion_sensor_8" = {
id = "0x00158d0002f04637";
groups = [ "bath_room_essential_present" ];
groups = [ "bath_room" "bath_room_present" ];
timeout = 60 * 3;
};
};

View file

@ -5,11 +5,11 @@ let
allDevices = {
"temperature_sensor_1" = {
id = "0x00158d0002d79220";
groups = [ "living_room_present" ];
groups = [ "living_room" ];
};
"temperature_sensor_2" = {
id = "0x00158d0002d7913d";
groups = [ "living_room_present" ];
groups = [ "living_room" ];
};
};