pepe: proper hass grouping
This commit is contained in:
parent
1ff1a25e89
commit
b7b7f1f2b3
7 changed files with 78 additions and 93 deletions
|
@ -37,65 +37,81 @@ in {
|
||||||
|
|
||||||
automation = let
|
automation = let
|
||||||
# todo : at night only turn trigger essential groups
|
# 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 = {
|
trigger = {
|
||||||
platform = "state";
|
platform = "state";
|
||||||
entity_id = "group.${present_group}";
|
entity_id = "group.${presentsGroup}";
|
||||||
from = "off";
|
from = "off";
|
||||||
to = "on";
|
to = "on";
|
||||||
};
|
};
|
||||||
action = [
|
action = [
|
||||||
{
|
{
|
||||||
service = "switch.turn_on";
|
service = "switch.turn_on";
|
||||||
entity_id = "group.${room_group}";
|
entity_id = "group.${roomGroup}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
service = "light.turn_on";
|
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 = {
|
trigger = {
|
||||||
platform = "state";
|
platform = "state";
|
||||||
entity_id = "group.${present_group}";
|
entity_id = "group.${presentsGroup}";
|
||||||
from = "on";
|
from = "on";
|
||||||
to = "off";
|
to = "off";
|
||||||
};
|
};
|
||||||
action = [
|
action = [
|
||||||
{
|
{
|
||||||
service = "switch.turn_off";
|
service = "switch.turn_off";
|
||||||
entity_id = "group.${room_group}";
|
entity_id = "group.${roomGroup}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
service = "light.turn_off";
|
service = "light.turn_off";
|
||||||
entity_id = "group.${room_group}";
|
entity_id = "group.${roomGroup}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
in (presents "kitchen_room" "kitchen_room_present")
|
in lib.flatten (map roomPresents [
|
||||||
++ (presents "kitchen_room_essential" "kitchen_room_essential_present")
|
{
|
||||||
++ (presents "living_room" "living_room_present")
|
roomGroup = "kitchen_room_lights";
|
||||||
++ (presents "living_essential_room" "living_room_essential_present")
|
presentsGroup = "kitchen_room_present";
|
||||||
++ (presents "floor_room" "floor_room_present")
|
}
|
||||||
++ (presents "floor_room_essential" "floor_room_essential_present")
|
{
|
||||||
++ (presents "bath_room" "bath_room_present")
|
roomGroup = "living_room_lights";
|
||||||
++ (presents "bath_room_essential" "bath_room_essential_present")
|
presentsGroup = "living_room_present";
|
||||||
++ (presents "bed_room" "bed_room_present")
|
}
|
||||||
++ (presents "bed_room_essential" "bed_room_essential_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
|
group = let
|
||||||
create_room = { name, description }: {
|
create_room = { name, description }: {
|
||||||
"${name}" = {
|
"${name}" = {
|
||||||
name = description;
|
name = "${description}";
|
||||||
view = false;
|
view = false;
|
||||||
entities = [ "group.${name}_essential" ];
|
control = "hidden";
|
||||||
|
entities = [ ];
|
||||||
|
};
|
||||||
|
"${name}_lights" = {
|
||||||
|
name = "${description} Beleuchtung";
|
||||||
|
view = false;
|
||||||
|
entities = [ ];
|
||||||
};
|
};
|
||||||
"${name}_present" = {
|
"${name}_present" = {
|
||||||
control = "hidden";
|
control = "hidden";
|
||||||
|
@ -109,11 +125,16 @@ in {
|
||||||
view = false;
|
view = false;
|
||||||
entities = [ ];
|
entities = [ ];
|
||||||
};
|
};
|
||||||
"${name}_essential_present" = {
|
"view_${name}" = {
|
||||||
control = "hidden";
|
name = description;
|
||||||
name = "${description} Flüchtig Anwesend";
|
view = true;
|
||||||
view = false;
|
entities = [
|
||||||
entities = [ "group.${name}_present" ];
|
"group.${name}"
|
||||||
|
"group.${name}_lights"
|
||||||
|
"group.${name}_present"
|
||||||
|
"group.${name}_essential"
|
||||||
|
"group.${name}_essential_present"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
create_rooms = rooms:
|
create_rooms = rooms:
|
||||||
|
@ -146,46 +167,13 @@ in {
|
||||||
name = "Räume";
|
name = "Räume";
|
||||||
view = true;
|
view = true;
|
||||||
entities = [
|
entities = [
|
||||||
"group.all_lights"
|
|
||||||
"group.floor_room"
|
"group.floor_room"
|
||||||
"group.floor_room_essential_present"
|
|
||||||
"group.bed_room"
|
"group.bed_room"
|
||||||
"group.bed_room_essential_present"
|
|
||||||
"group.living_room"
|
"group.living_room"
|
||||||
"group.living_room_essential_present"
|
|
||||||
"group.kitchen_room"
|
"group.kitchen_room"
|
||||||
"group.kitchen_room_essential_present"
|
|
||||||
"group.bath_room"
|
"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
|
# overview
|
||||||
# --------
|
# --------
|
||||||
|
|
|
@ -5,38 +5,38 @@ let
|
||||||
"pal01" = {
|
"pal01" = {
|
||||||
label = "Schlafzimmer Lampe Links";
|
label = "Schlafzimmer Lampe Links";
|
||||||
icon = "mdi:lightbulb-on";
|
icon = "mdi:lightbulb-on";
|
||||||
room = "bed_room_essential";
|
room = "bed_room_lights";
|
||||||
type = "light";
|
type = "light";
|
||||||
};
|
};
|
||||||
"pal02" = {
|
"pal02" = {
|
||||||
label = "Flur Lampe";
|
label = "Wohnzimmer Lampe";
|
||||||
icon = "mdi:lightbulb-on";
|
icon = "mdi:lightbulb-on";
|
||||||
room = "living_room_essential";
|
room = "living_room_lights";
|
||||||
type = "light";
|
type = "light";
|
||||||
};
|
};
|
||||||
"pal03" = {
|
"pal03" = {
|
||||||
label = "Wohnzimmer Lampe";
|
label = "Wohnzimmer Lampe";
|
||||||
icon = "mdi:lightbulb-on";
|
icon = "mdi:lightbulb-on";
|
||||||
room = "living_room_essential";
|
room = "living_room_lights";
|
||||||
type = "light";
|
type = "light";
|
||||||
};
|
};
|
||||||
"pal04" = {
|
"pal04" = {
|
||||||
label = "Schlafzimmer Lampe Rechts";
|
label = "Schlafzimmer Lampe Rechts";
|
||||||
icon = "mdi:lightbulb-on";
|
icon = "mdi:lightbulb-on";
|
||||||
room = "bed_room";
|
room = "bed_room_lights";
|
||||||
type = "light";
|
type = "light";
|
||||||
};
|
};
|
||||||
"pal05" = {
|
"pal05" = {
|
||||||
label = "TV";
|
label = "TV";
|
||||||
icon = "mdi:television";
|
icon = "mdi:television";
|
||||||
room = "living_room";
|
room = "living_room_lights";
|
||||||
type = "device";
|
type = "device";
|
||||||
device = "tv";
|
device = "tv";
|
||||||
};
|
};
|
||||||
"pal06" = {
|
"pal06" = {
|
||||||
label = "Küchen Lampe";
|
label = "Küchen Lampe";
|
||||||
icon = "mdi:lightbulb-on";
|
icon = "mdi:lightbulb-on";
|
||||||
room = "kitchen_room_essential";
|
room = "kitchen_room_lights";
|
||||||
type = "light";
|
type = "light";
|
||||||
};
|
};
|
||||||
"pal07" = {
|
"pal07" = {
|
||||||
|
|
|
@ -12,16 +12,16 @@ let
|
||||||
"button_1" = {
|
"button_1" = {
|
||||||
id = "0x00158d0002b04f65";
|
id = "0x00158d0002b04f65";
|
||||||
# states = { click = "input_boolean.living_room_button"; } # input state to hold (optional) (default "input_boolean.single_${name}")
|
# 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" = {
|
"button_2" = {
|
||||||
id = "0x00158d0002b04f09";
|
id = "0x00158d0002b04f09";
|
||||||
groups = [ "bed_room_present" ];
|
groups = [ "bed_room" "bed_room_present" ];
|
||||||
states.single = "input_boolean.bed_room_buttons";
|
states.single = "input_boolean.bed_room_buttons";
|
||||||
};
|
};
|
||||||
"button_3" = {
|
"button_3" = {
|
||||||
id = "0x00158d0002b00e04";
|
id = "0x00158d0002b00e04";
|
||||||
groups = [ "bed_room_present" ];
|
groups = [ "bed_room" "bed_room_present" ];
|
||||||
states.single = "input_boolean.bed_room_buttons";
|
states.single = "input_boolean.bed_room_buttons";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,12 +6,12 @@ let
|
||||||
"door_sensor_1" = { id = "0x00158d000312dc52"; };
|
"door_sensor_1" = { id = "0x00158d000312dc52"; };
|
||||||
"door_sensor_2" = {
|
"door_sensor_2" = {
|
||||||
id = "0x00158d000316d5bf";
|
id = "0x00158d000316d5bf";
|
||||||
groups = [ "floor_room_present" ];
|
groups = [ "floor_room" "floor_room_present" ];
|
||||||
};
|
};
|
||||||
"door_sensor_3" = { id = "0x00158d0002f9516f"; };
|
"door_sensor_3" = { id = "0x00158d0002f9516f"; };
|
||||||
"door_sensor_4" = {
|
"door_sensor_4" = {
|
||||||
id = "0x00158d00031383b9";
|
id = "0x00158d00031383b9";
|
||||||
groups = [ "floor_room_present" ];
|
groups = [ "floor_room" "floor_room_present" ];
|
||||||
};
|
};
|
||||||
"door_sensor_5" = { id = "0x00158d0003120d3e"; };
|
"door_sensor_5" = { id = "0x00158d0003120d3e"; };
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,29 +5,26 @@ let
|
||||||
allDevices = {
|
allDevices = {
|
||||||
"light_1" = {
|
"light_1" = {
|
||||||
id = "0x7cb03eaa0a0347b5";
|
id = "0x7cb03eaa0a0347b5";
|
||||||
groups = [ "floor_room_essential" ];
|
groups = [ "floor_room" "floor_room_essential" "floor_room_lights" ];
|
||||||
};
|
};
|
||||||
"light_2" = {
|
"light_2" = {
|
||||||
id = "0x7cb03eaa0a0387b9";
|
id = "0x7cb03eaa0a0387b9";
|
||||||
groups = [ "floor_room" ];
|
groups = [ "floor_room" "floor_room_lights" ];
|
||||||
};
|
};
|
||||||
"light_3" = {
|
"light_3" = {
|
||||||
id = "0x7cb03eaa0a033a86";
|
id = "0x7cb03eaa0a033a86";
|
||||||
groups = [ "living_room" ];
|
groups = [ "living_room" "living_room_lights" ];
|
||||||
};
|
};
|
||||||
"light_4" = {
|
"light_4" = {
|
||||||
id = "0x7cb03eaa0a04aabf";
|
id = "0x7cb03eaa0a04aabf";
|
||||||
groups = [ "bath_room_essential" ];
|
groups = [ "bath_room" "bath_room_essential" "bath_room_lights" ];
|
||||||
};
|
|
||||||
"light_5" = {
|
|
||||||
id = "0x7cb03eaa0a0346e4";
|
|
||||||
groups = [ "living_room" ];
|
|
||||||
};
|
};
|
||||||
|
"light_5" = { id = "0x7cb03eaa0a0346e4"; };
|
||||||
"light_6" = { id = "0x7cb03eaa0a034b46"; };
|
"light_6" = { id = "0x7cb03eaa0a034b46"; };
|
||||||
"light_7" = { id = "0x7cb03eaa0a033b4f"; };
|
"light_7" = { id = "0x7cb03eaa0a033b4f"; };
|
||||||
"light_8" = {
|
"light_8" = {
|
||||||
id = "0x7cb03eaa0a0384d3";
|
id = "0x7cb03eaa0a0384d3";
|
||||||
groups = [ "bed_room" ];
|
groups = [ "bed_room" "bed_room_essential" "bed_room_lights" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,42 +6,42 @@ let
|
||||||
|
|
||||||
"motion_sensor_1" = {
|
"motion_sensor_1" = {
|
||||||
id = "0x00158d0002fbd451";
|
id = "0x00158d0002fbd451";
|
||||||
groups = [ "kitchen_room_present" ];
|
groups = [ "kitchen_room" "kitchen_room_present" ];
|
||||||
timeout = 60 * 2;
|
timeout = 60 * 2;
|
||||||
};
|
};
|
||||||
"motion_sensor_2" = {
|
"motion_sensor_2" = {
|
||||||
id = "0x00158d0002f9a6b8";
|
id = "0x00158d0002f9a6b8";
|
||||||
groups = [ "kitchen_room_present" ];
|
groups = [ "kitchen_room" "kitchen_room_present" ];
|
||||||
timeout = 60 * 2;
|
timeout = 60 * 2;
|
||||||
};
|
};
|
||||||
"motion_sensor_3" = {
|
"motion_sensor_3" = {
|
||||||
id = "0x00158d0002f04522";
|
id = "0x00158d0002f04522";
|
||||||
groups = [ "living_room_present" ];
|
groups = [ "living_room" "living_room_present" ];
|
||||||
timeout = 60 * 3;
|
timeout = 60 * 3;
|
||||||
};
|
};
|
||||||
"motion_sensor_4" = {
|
"motion_sensor_4" = {
|
||||||
id = "0x00158d0002f9a558";
|
id = "0x00158d0002f9a558";
|
||||||
groups = [ "living_room_present" ];
|
groups = [ "living_room" "living_room_present" ];
|
||||||
timeout = 60 * 3;
|
timeout = 60 * 3;
|
||||||
};
|
};
|
||||||
"motion_sensor_5" = {
|
"motion_sensor_5" = {
|
||||||
id = "0x00158d0002f9a56f";
|
id = "0x00158d0002f9a56f";
|
||||||
groups = [ "bath_room_essential_present" ];
|
groups = [ "bath_room" "bath_room_present" ];
|
||||||
timeout = 60 * 3;
|
timeout = 60 * 3;
|
||||||
};
|
};
|
||||||
"motion_sensor_6" = {
|
"motion_sensor_6" = {
|
||||||
id = "0x00158d0002f9a5cb";
|
id = "0x00158d0002f9a5cb";
|
||||||
groups = [ "floor_room_present" ];
|
groups = [ "floor_room" "floor_room_present" ];
|
||||||
timeout = 60 * 5;
|
timeout = 60 * 2;
|
||||||
};
|
};
|
||||||
"motion_sensor_7" = {
|
"motion_sensor_7" = {
|
||||||
id = "0x00158d0002f9a6aa";
|
id = "0x00158d0002f9a6aa";
|
||||||
groups = [ "bed_room_essential_present" ];
|
groups = [ "bed_room" "bed_room_present" ];
|
||||||
timeout = 60 * 1.2;
|
timeout = 60 * 1.2;
|
||||||
};
|
};
|
||||||
"motion_sensor_8" = {
|
"motion_sensor_8" = {
|
||||||
id = "0x00158d0002f04637";
|
id = "0x00158d0002f04637";
|
||||||
groups = [ "bath_room_essential_present" ];
|
groups = [ "bath_room" "bath_room_present" ];
|
||||||
timeout = 60 * 3;
|
timeout = 60 * 3;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,11 +5,11 @@ let
|
||||||
allDevices = {
|
allDevices = {
|
||||||
"temperature_sensor_1" = {
|
"temperature_sensor_1" = {
|
||||||
id = "0x00158d0002d79220";
|
id = "0x00158d0002d79220";
|
||||||
groups = [ "living_room_present" ];
|
groups = [ "living_room" ];
|
||||||
};
|
};
|
||||||
"temperature_sensor_2" = {
|
"temperature_sensor_2" = {
|
||||||
id = "0x00158d0002d7913d";
|
id = "0x00158d0002d7913d";
|
||||||
groups = [ "living_room_present" ];
|
groups = [ "living_room" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue