summaryrefslogtreecommitdiffstats
path: root/lass/2configs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-01-24 09:47:24 +0100
committerlassulus <lassulus@lassul.us>2021-01-24 09:47:24 +0100
commitfed3663923bf8064215dd0f2f8eac4ee82d63179 (patch)
tree748dcc6953c59618b19e8378a66282cd56f319d5 /lass/2configs
parenta6ace6ef5e4613d2d59c20cb7e2811ea3c5e9c10 (diff)
l hass: use better naming
Diffstat (limited to 'lass/2configs')
-rw-r--r--lass/2configs/hass/lib.nix25
-rw-r--r--lass/2configs/hass/rooms/bett.nix2
-rw-r--r--lass/2configs/hass/rooms/essen.nix4
-rw-r--r--lass/2configs/hass/rooms/nass.nix4
4 files changed, 14 insertions, 21 deletions
diff --git a/lass/2configs/hass/lib.nix b/lass/2configs/hass/lib.nix
index 9281a19ec..1f9f9945d 100644
--- a/lass/2configs/hass/lib.nix
+++ b/lass/2configs/hass/lib.nix
@@ -23,7 +23,7 @@ rec {
};
friendly_names =
- lib.mapAttrs' (n: v: lib.nameValuePair "light.${v}_light" { friendly_name = "l.${n}"; }) lights //
+ lib.mapAttrs' (n: v: lib.nameValuePair "light.${v}" { friendly_name = "l.${n}"; }) lights //
lib.mapAttrs' (n: v: lib.nameValuePair "binary_sensor.${v}_update_available" { friendly_name = "s.${n}_up"; }) switches.dimmer //
lib.mapAttrs' (n: v: lib.nameValuePair "binary_sensor.${v}_update_available" { friendly_name = "i.${n}_up"; }) sensors.movement //
lib.mapAttrs' (n: v: lib.nameValuePair "binary_sensor.${v}_update_available" { friendly_name = "l.${n}_up"; }) lights //
@@ -41,11 +41,11 @@ rec {
lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_illuminance" { friendly_name = "i.${n}_lux"; }) sensors.movement //
{};
- detect_movement = sensor: light: delay:
+ detect_movement = name: sensor: light: delay:
let
- id = "${sensor}_${light}";
+ id = name;
sensor_ = "binary_sensor.${sensor}_occupancy";
- light_ = "light.${light}_light";
+ light_ = "light.${light}";
in {
input_boolean."${id}" = {
};
@@ -71,7 +71,6 @@ rec {
# }
{
alias = "movement reset timer ${id}";
- hide_entity = true;
trigger = {
platform = "state";
entity_id = sensor_;
@@ -87,7 +86,6 @@ rec {
}
{
alias = "movement on ${id}";
- # hide_entity = true;
trigger = {
platform = "state";
entity_id = "binary_sensor.${sensor}_occupancy";
@@ -124,7 +122,6 @@ rec {
}
{
alias = "movement off ${id}";
- hide_entity = true;
trigger = {
platform = "state";
entity_id = sensor_;
@@ -144,7 +141,6 @@ rec {
}
{
alias = "movement override ${id}";
- hide_entity = true;
trigger = {
platform = "state";
entity_id = light_;
@@ -164,7 +160,6 @@ rec {
}
{
alias = "movement expired ${id}";
- hide_entity = true;
trigger = {
platform = "event";
event_type = "timer.finished";
@@ -186,11 +181,10 @@ rec {
];
};
- lightswitch = switch: light: {
+ lightswitch = name: switch: light: {
automation = [
{
- alias = "lightswitch ${switch} turn on light ${light}";
- hide_entity = "true";
+ alias = "lightswitch ${name} turn on";
trigger = {
platform = "mqtt";
topic = "zigbee/${switch}";
@@ -225,15 +219,14 @@ rec {
{
service = "light.turn_on";
data_template = {
- entity_id = "light.${light}_light";
+ entity_id = "light.${light}";
brightness = "{{ trigger.payload_json.brightness }}";
};
}
];
}
{
- alias = "lightswitch ${switch} turn off light ${light}";
- hide_entity = "true";
+ alias = "lightswitch ${name} turn off";
trigger = {
platform = "mqtt";
topic = "zigbee/${switch}";
@@ -254,7 +247,7 @@ rec {
action = {
service = "light.turn_off";
data_template = {
- entity_id = "light.${light}_light";
+ entity_id = "light.${light}";
};
};
}
diff --git a/lass/2configs/hass/rooms/bett.nix b/lass/2configs/hass/rooms/bett.nix
index 48a1f72d7..026c5722c 100644
--- a/lass/2configs/hass/rooms/bett.nix
+++ b/lass/2configs/hass/rooms/bett.nix
@@ -3,7 +3,7 @@ with import ../lib.nix { inherit lib; };
{
services.home-assistant.config = lib.mkMerge [
- (lightswitch switches.dimmer.bett lights.bett)
+ (lightswitch "bett" switches.dimmer.bett lights.bett)
];
# lass.hass.love = {
diff --git a/lass/2configs/hass/rooms/essen.nix b/lass/2configs/hass/rooms/essen.nix
index eeb3d30d2..293935f65 100644
--- a/lass/2configs/hass/rooms/essen.nix
+++ b/lass/2configs/hass/rooms/essen.nix
@@ -3,7 +3,7 @@ with import ../lib.nix { inherit lib; };
{
services.home-assistant.config = lib.mkMerge [
- (detect_movement sensors.movement.essen lights.essen 10)
- (lightswitch switches.dimmer.essen lights.essen)
+ (detect_movement "essen" sensors.movement.essen lights.essen 70)
+ (lightswitch "essen" switches.dimmer.essen lights.essen)
];
}
diff --git a/lass/2configs/hass/rooms/nass.nix b/lass/2configs/hass/rooms/nass.nix
index 7e6298738..b23ba86cd 100644
--- a/lass/2configs/hass/rooms/nass.nix
+++ b/lass/2configs/hass/rooms/nass.nix
@@ -3,8 +3,8 @@ with import ../lib.nix { inherit lib; };
{
services.home-assistant.config = lib.mkMerge [
- (detect_movement sensors.movement.nass lights.nass 100)
- (lightswitch switches.dimmer.nass lights.nass)
+ (detect_movement "nass" sensors.movement.nass lights.nass 100)
+ (lightswitch "nass" switches.dimmer.nass lights.nass)
];
}