From c334eb47eb5f5be64a3d1d969365bc7dcebbcf39 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 24 Jan 2021 09:43:53 +0100 Subject: l hass: open zigbee2mqtt frontend --- lass/2configs/hass/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lass/2configs/hass') diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix index 78379ba1c..44f6e25f9 100644 --- a/lass/2configs/hass/default.nix +++ b/lass/2configs/hass/default.nix @@ -13,7 +13,9 @@ with import ./lib.nix { inherit lib; }; { predicate = "-i int0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto { predicate = "-i docker0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto { predicate = "-i int0 -p tcp --dport 8123"; target = "ACCEPT"; } # hass + { predicate = "-i int0 -p tcp --dport 1337"; target = "ACCEPT"; } # hass { predicate = "-i retiolum -p tcp --dport 8123"; target = "ACCEPT"; } # hass + { predicate = "-i retiolum -p tcp --dport 1337"; target = "ACCEPT"; } # hass frontend { predicate = "-i wiregrill -p tcp --dport 8123"; target = "ACCEPT"; } # hass ]; -- cgit v1.2.3 From a6ace6ef5e4613d2d59c20cb7e2811ea3c5e9c10 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 24 Jan 2021 09:46:43 +0100 Subject: l hass: enable shopping list, disable hue --- lass/2configs/hass/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs/hass') diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix index 44f6e25f9..3cd6e0ebf 100644 --- a/lass/2configs/hass/default.nix +++ b/lass/2configs/hass/default.nix @@ -49,6 +49,7 @@ with import ./lib.nix { inherit lib; }; }; config = {}; sun.elevation = 66; + shopping_list = {}; discovery = {}; frontend = {}; mqtt = { @@ -83,7 +84,6 @@ with import ./lib.nix { inherit lib; }; (tasmota_s20 "Stereo Anlage" "stereo") ]; mobile_app = {}; - hue = {}; weather = [ { platform = "openweathermap"; -- cgit v1.2.3 From fed3663923bf8064215dd0f2f8eac4ee82d63179 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 24 Jan 2021 09:47:24 +0100 Subject: l hass: use better naming --- lass/2configs/hass/lib.nix | 25 +++++++++---------------- lass/2configs/hass/rooms/bett.nix | 2 +- lass/2configs/hass/rooms/essen.nix | 4 ++-- lass/2configs/hass/rooms/nass.nix | 4 ++-- 4 files changed, 14 insertions(+), 21 deletions(-) (limited to 'lass/2configs/hass') 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) ]; } -- cgit v1.2.3