pepe: improved hass

This commit is contained in:
Ingolf Wagner 2020-04-16 00:10:12 +02:00
parent 53acb610b1
commit 1ff1a25e89
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
4 changed files with 28 additions and 15 deletions

View file

@ -190,7 +190,7 @@ in {
# overview # overview
# -------- # --------
all_sensors = { all_sensors = {
name = "Sensor Overview"; name = "Alle Sensoren";
control = "hidden"; control = "hidden";
}; };
today = { today = {

View file

@ -88,8 +88,11 @@ in {
lightGroups = lib.mapAttrs (name: lightGroups = lib.mapAttrs (name:
{ ... }: { { ... }: {
control = "hidden"; control = "hidden";
entities = entities = [
[ "light.${name}" "sensor.link_${name}" "binary_sensor.update_${name}" ]; "light.${name}"
"sensor.link_${name}"
"binary_sensor.update_${name}"
];
}) allDevices; }) allDevices;
# sort lights into given groups. # sort lights into given groups.

View file

@ -7,45 +7,55 @@ let
"motion_sensor_1" = { "motion_sensor_1" = {
id = "0x00158d0002fbd451"; id = "0x00158d0002fbd451";
groups = [ "kitchen_room_present" ]; groups = [ "kitchen_room_present" ];
timeout = 60 * 2;
}; };
"motion_sensor_2" = { "motion_sensor_2" = {
id = "0x00158d0002f9a6b8"; id = "0x00158d0002f9a6b8";
groups = [ "kitchen_room_present" ]; groups = [ "kitchen_room_present" ];
timeout = 60 * 2;
}; };
"motion_sensor_3" = { "motion_sensor_3" = {
id = "0x00158d0002f04522"; id = "0x00158d0002f04522";
groups = [ "living_room_present" ]; groups = [ "living_room_present" ];
timeout = 60 * 3;
}; };
"motion_sensor_4" = { "motion_sensor_4" = {
id = "0x00158d0002f9a558"; id = "0x00158d0002f9a558";
groups = [ "living_room_present" ]; groups = [ "living_room_present" ];
timeout = 60 * 3;
}; };
"motion_sensor_5" = { "motion_sensor_5" = {
id = "0x00158d0002f9a56f"; id = "0x00158d0002f9a56f";
groups = [ "bath_room_essential_present" ]; groups = [ "bath_room_essential_present" ];
timeout = 60 * 3;
}; };
"motion_sensor_6" = { "motion_sensor_6" = {
id = "0x00158d0002f9a5cb"; id = "0x00158d0002f9a5cb";
groups = [ "floor_room_present" ]; groups = [ "floor_room_present" ];
timeout = 60 * 5;
}; };
"motion_sensor_7" = { "motion_sensor_7" = {
id = "0x00158d0002f9a6aa"; id = "0x00158d0002f9a6aa";
groups = [ "bed_room_essential_present" ]; groups = [ "bed_room_essential_present" ];
timeout = 60 * 1.2;
}; };
"motion_sensor_8" = { "motion_sensor_8" = {
id = "0x00158d0002f04637"; id = "0x00158d0002f04637";
groups = [ "bath_room_essential_present" ]; groups = [ "bath_room_essential_present" ];
timeout = 60 * 3;
}; };
}; };
in { in {
services.zigbee2mqtt.devices = lib.mapAttrs' (name: services.zigbee2mqtt.devices = lib.mapAttrs' (name:
{ id, ... }: { { id, timeout ? 90, ... }: {
name = id; name = id;
value = { value = {
retain = false; retain = false;
friendly_name = name; friendly_name = name;
# should not be set below 60 seconds
occupancy_timeout = timeout;
}; };
}) allDevices; }) allDevices;

View file

@ -47,15 +47,15 @@ in {
device_class = "humidity"; device_class = "humidity";
value_template = "{{ value_json.humidity }}"; value_template = "{{ value_json.humidity }}";
} }
{ #{
platform = "mqtt"; # platform = "mqtt";
name = "pressure_${name}"; # name = "pressure_${name}";
state_topic = "zigbee2mqtt/${name}"; # state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state"; # availability_topic = "zigbee2mqtt/bridge/state";
unit_of_measurement = "hPa"; # unit_of_measurement = "hPa";
device_class = "pressure"; # device_class = "pressure";
value_template = "{{ value_json.pressure }}"; # value_template = "{{ value_json.pressure }}";
} #}
{ {
name = "battery_${name}"; name = "battery_${name}";
platform = "mqtt"; platform = "mqtt";
@ -87,7 +87,7 @@ in {
entities = [ entities = [
"sensor.${name}" "sensor.${name}"
"sensor.humidity_${name}" "sensor.humidity_${name}"
"sensor.pressure_${name}" #"sensor.pressure_${name}"
"sensor.battery_${name}" "sensor.battery_${name}"
"sensor.link_${name}" "sensor.link_${name}"
@ -105,7 +105,7 @@ in {
in sortedInGroups // sensorGroups // { in sortedInGroups // sensorGroups // {
all_sensors.entities = all_sensors.entities =
lib.mapAttrsToList (name: { ... }: "binary_sensor.${name}") allDevices; lib.mapAttrsToList (name: { ... }: "sensor.${name}") allDevices;
}; };
}; };