diff options
author | makefu <github@syntax-fehler.de> | 2020-05-21 08:38:16 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2020-05-21 08:38:16 +0200 |
commit | d027d1d5316371280221870a9c05f2b35fb437ac (patch) | |
tree | e4c8e2a580d4d7d2d01f440ec837bed707db0c64 | |
parent | ab0906f7aab8a49186e64c4942a516686a132558 (diff) | |
parent | cf5b35b2df428495f5bf4dd89e3cab190f069080 (diff) |
Merge remote-tracking branch 'lass/master'
-rw-r--r-- | jeschli/2configs/firefox.nix | 15 | ||||
-rw-r--r-- | jeschli/2configs/i3.nix | 3 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/audio-fingerprint-defender/default.nix (renamed from jeschli/2configs/own-pkgs/audio-fingerprint-defender/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/canvas-fingerprint-defender/default.nix (renamed from jeschli/2configs/own-pkgs/canvas-fingerprint-defender/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/dark-reader/default.nix (renamed from jeschli/2configs/own-pkgs/dark-reader/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/default.nix | 18 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/firefox-with-config.nix (renamed from jeschli/2configs/overlays/firefox-with-config.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/font-fingerprint-defender/default.nix (renamed from jeschli/2configs/own-pkgs/font-fingerprint-defender/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/hopper/default.nix (renamed from jeschli/2configs/own-pkgs/hopper/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/https-everywhere/default.nix (renamed from jeschli/2configs/own-pkgs/https-everywhere/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/pyocclient/default.nix (renamed from jeschli/2configs/own-pkgs/pyocclient/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/rmount/default.nix (renamed from jeschli/2configs/own-pkgs/rmount/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/ublock-origin/default.nix (renamed from jeschli/2configs/own-pkgs/ublock-origin/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/user-agent-switcher/default.nix (renamed from jeschli/2configs/own-pkgs/user-agent-switcher/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/webgl-fingerprint-defender/default.nix (renamed from jeschli/2configs/own-pkgs/webgl-fingerprint-defender/default.nix) | 0 | ||||
-rw-r--r-- | jeschli/5pkgs/firefox/wl-clipboard/default.nix (renamed from jeschli/2configs/own-pkgs/wl-clipboard/default.nix) | 0 | ||||
-rw-r--r-- | krebs/3modules/external/default.nix | 28 | ||||
-rw-r--r-- | krebs/nixpkgs.json | 6 | ||||
-rw-r--r-- | lass/1systems/icarus/config.nix | 11 | ||||
-rw-r--r-- | lass/1systems/shodan/config.nix | 13 | ||||
-rw-r--r-- | lass/2configs/hass/default.nix | 26 | ||||
-rw-r--r-- | lass/2configs/hass/lib.nix | 196 | ||||
-rw-r--r-- | lass/2configs/hass/rooms/bett.nix | 25 | ||||
-rw-r--r-- | lass/2configs/hass/rooms/essen.nix | 9 | ||||
-rw-r--r-- | lass/2configs/hass/rooms/nass.nix | 10 | ||||
-rw-r--r-- | lass/2configs/hass/zigbee.nix | 79 | ||||
-rw-r--r-- | lass/2configs/home-media.nix | 23 |
27 files changed, 352 insertions, 110 deletions
diff --git a/jeschli/2configs/firefox.nix b/jeschli/2configs/firefox.nix index d171fa82d..1e1e16918 100644 --- a/jeschli/2configs/firefox.nix +++ b/jeschli/2configs/firefox.nix @@ -2,20 +2,11 @@ let - # Firefox addons - https-everywhere = pkgs.callPackage ./own-pkgs/https-everywhere {}; - ublock-origin = pkgs.callPackage ./own-pkgs/ublock-origin {}; - webgl-fingerprint-defender = pkgs.callPackage ./own-pkgs/webgl-fingerprint-defender {}; - canvas-fingerprint-defender = pkgs.callPackage ./own-pkgs/canvas-fingerprint-defender {}; - audio-fingerprint-defender = pkgs.callPackage ./own-pkgs/audio-fingerprint-defender {}; - font-fingerprint-defender = pkgs.callPackage ./own-pkgs/font-fingerprint-defender {}; - user-agent-switcher = pkgs.callPackage ./own-pkgs/user-agent-switcher {}; - dark-reader = pkgs.callPackage ./own-pkgs/dark-reader {}; - - wrapper = pkgs.callPackage ./overlays/firefox-with-config.nix { }; + wrapper = pkgs.callPackage ../5pkgs/firefox/firefox-with-config.nix { }; myFirefox = wrapper pkgs.firefox-unwrapped { - extraExtensions = [ + # these plugins are defined in 5pkgs/firefox + extraExtensions = with pkgs ; [ dark-reader https-everywhere ublock-origin diff --git a/jeschli/2configs/i3.nix b/jeschli/2configs/i3.nix index f062daec3..1a6c4927a 100644 --- a/jeschli/2configs/i3.nix +++ b/jeschli/2configs/i3.nix @@ -232,11 +232,10 @@ services.xserver.enable = true; services.xserver.displayManager.lightdm.enable = true; # Allow users in video group to change brightness - hardware.brightnessctl.enable = true; - environment.systemPackages = with pkgs; [ rofi # Dmenu replacement acpilight # Replacement for xbacklight + brightnessctl arandr # Xrandr gui feh wirelesstools # To get wireless statistics diff --git a/jeschli/2configs/own-pkgs/audio-fingerprint-defender/default.nix b/jeschli/5pkgs/firefox/audio-fingerprint-defender/default.nix index 05815e132..05815e132 100644 --- a/jeschli/2configs/own-pkgs/audio-fingerprint-defender/default.nix +++ b/jeschli/5pkgs/firefox/audio-fingerprint-defender/default.nix diff --git a/jeschli/2configs/own-pkgs/canvas-fingerprint-defender/default.nix b/jeschli/5pkgs/firefox/canvas-fingerprint-defender/default.nix index 21b4b3f97..21b4b3f97 100644 --- a/jeschli/2configs/own-pkgs/canvas-fingerprint-defender/default.nix +++ b/jeschli/5pkgs/firefox/canvas-fingerprint-defender/default.nix diff --git a/jeschli/2configs/own-pkgs/dark-reader/default.nix b/jeschli/5pkgs/firefox/dark-reader/default.nix index 44f4f9054..44f4f9054 100644 --- a/jeschli/2configs/own-pkgs/dark-reader/default.nix +++ b/jeschli/5pkgs/firefox/dark-reader/default.nix diff --git a/jeschli/5pkgs/firefox/default.nix b/jeschli/5pkgs/firefox/default.nix new file mode 100644 index 000000000..6ba4fec83 --- /dev/null +++ b/jeschli/5pkgs/firefox/default.nix @@ -0,0 +1,18 @@ +with import <stockholm/lib>; + +self: super: + +let + # This callPackage will try to detect obsolete overrides. + callPackage = path: args: let + override = self.callPackage path args; + upstream = optionalAttrs (override ? "name") + (super.${(parseDrvName override.name).name} or {}); + in if upstream ? "name" && + override ? "name" && + compareVersions upstream.name override.name != -1 + then trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override + else override; +in + + mapNixDir (path: callPackage path {}) ./. diff --git a/jeschli/2configs/overlays/firefox-with-config.nix b/jeschli/5pkgs/firefox/firefox-with-config.nix index 9be6250d7..9be6250d7 100644 --- a/jeschli/2configs/overlays/firefox-with-config.nix +++ b/jeschli/5pkgs/firefox/firefox-with-config.nix diff --git a/jeschli/2configs/own-pkgs/font-fingerprint-defender/default.nix b/jeschli/5pkgs/firefox/font-fingerprint-defender/default.nix index 26751beef..26751beef 100644 --- a/jeschli/2configs/own-pkgs/font-fingerprint-defender/default.nix +++ b/jeschli/5pkgs/firefox/font-fingerprint-defender/default.nix diff --git a/jeschli/2configs/own-pkgs/hopper/default.nix b/jeschli/5pkgs/firefox/hopper/default.nix index 569fc6aaf..569fc6aaf 100644 --- a/jeschli/2configs/own-pkgs/hopper/default.nix +++ b/jeschli/5pkgs/firefox/hopper/default.nix diff --git a/jeschli/2configs/own-pkgs/https-everywhere/default.nix b/jeschli/5pkgs/firefox/https-everywhere/default.nix index 66fede43c..66fede43c 100644 --- a/jeschli/2configs/own-pkgs/https-everywhere/default.nix +++ b/jeschli/5pkgs/firefox/https-everywhere/default.nix diff --git a/jeschli/2configs/own-pkgs/pyocclient/default.nix b/jeschli/5pkgs/firefox/pyocclient/default.nix index cd91f6171..cd91f6171 100644 --- a/jeschli/2configs/own-pkgs/pyocclient/default.nix +++ b/jeschli/5pkgs/firefox/pyocclient/default.nix diff --git a/jeschli/2configs/own-pkgs/rmount/default.nix b/jeschli/5pkgs/firefox/rmount/default.nix index 22631f420..22631f420 100644 --- a/jeschli/2configs/own-pkgs/rmount/default.nix +++ b/jeschli/5pkgs/firefox/rmount/default.nix diff --git a/jeschli/2configs/own-pkgs/ublock-origin/default.nix b/jeschli/5pkgs/firefox/ublock-origin/default.nix index 002fa3efc..002fa3efc 100644 --- a/jeschli/2configs/own-pkgs/ublock-origin/default.nix +++ b/jeschli/5pkgs/firefox/ublock-origin/default.nix diff --git a/jeschli/2configs/own-pkgs/user-agent-switcher/default.nix b/jeschli/5pkgs/firefox/user-agent-switcher/default.nix index c96f11129..c96f11129 100644 --- a/jeschli/2configs/own-pkgs/user-agent-switcher/default.nix +++ b/jeschli/5pkgs/firefox/user-agent-switcher/default.nix diff --git a/jeschli/2configs/own-pkgs/webgl-fingerprint-defender/default.nix b/jeschli/5pkgs/firefox/webgl-fingerprint-defender/default.nix index 4e608d182..4e608d182 100644 --- a/jeschli/2configs/own-pkgs/webgl-fingerprint-defender/default.nix +++ b/jeschli/5pkgs/firefox/webgl-fingerprint-defender/default.nix diff --git a/jeschli/2configs/own-pkgs/wl-clipboard/default.nix b/jeschli/5pkgs/firefox/wl-clipboard/default.nix index 349d910da..349d910da 100644 --- a/jeschli/2configs/own-pkgs/wl-clipboard/default.nix +++ b/jeschli/5pkgs/firefox/wl-clipboard/default.nix diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index b437456ec..62cdf8542 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -68,6 +68,31 @@ in { }; }; }; + helsinki = { + owner = config.krebs.users.ajs124; + nets = { + retiolum = { + ip4.addr = "10.243.10.1"; + aliases = [ "helsinki.r" ]; + tinc.pubkey = '' + -----BEGIN RSA PUBLIC KEY----- + MIICCgKCAgEA5MnCmT9xVEtv3hoZsjmgF4pVnPgzaWWVrZVguMfXcbTiusgWqBIM + Ms/Ue676J3kQIJT1QSMA2RWDUU++dUcfhHF87vFpnyCnaKjfz6LyAwlSfKluttyY + aFNgcUWlZRl4wkqys/oYhLD1q26mO/ekCA2eohzbB1TCaPY97VM5nl0MkXStMN76 + B+Ipw/gQcZXuWYct8Nj69sETPLnbf6ZBKs+T213as+NUSHVUdmBmV8QtmHDI3e7B + 4wAK1JkFCQgVu9gm/6BvqWroOMcmtxzSceyrY+0MWnAnM+wrLcYYaT2xw1OJyWmM + riOHHMw9iLVxqyQ+3eDucJRQcJzO7I4j8zQaoYxPE1ZSl4wTsaypkMuNOyhYv2C9 + RNPJgTBlr911NnY7TcKauz/lO1Qcl5kHBMrIfwsbsQK+zfN2XX+s21/SPeSJ7k1N + OqXeyX0mz2l7bhBDwTTDtINSz8sB3BL59mVbWY5z5b90oeKPrfygmp7V0CSKgHBr + b5ZIhMRfgcK+HjolcEqdL9INpJZVFYt3vWPNhDpbX5sEOjjR+ODceriL8zdlTBRx + PyB9OiK6tN+L63QFM7H1NFN9fPeOd2WbHvfoeX255kx8FHSALKL5rVSz9Ejwc97k + rG0FItgHXajPazulBfUV0N9ck7SwLTmStKxtQ8NKCoIJLpv2ip4C+t0CAwEAAQ== + -----END RSA PUBLIC KEY----- + Ed25519PublicKey = 47fX1g6qynVprA+PtniBLEonFp1B70nMrJ8SBCWNJnL + ''; + }; + }; + }; homeros = { owner = config.krebs.users.kmein; nets = { @@ -399,6 +424,9 @@ in { }; }; users = { + ajs124 = { + mail = "stockholm@ajs124.de"; + }; ciko = { mail = "wieczorek.stefan@googlemail.com"; }; diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 9cef0dd78..d180b5f3b 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "1e90c46c2d98f9391df79954a74d14f263cad729", - "date": "2020-04-20T23:47:17-04:00", - "sha256": "1xs0lgh3q1hbrj0lbpy3czw41cv6vxx9kdf2npwc58z8xq3sdqmh", + "rev": "5adf2a6c11646898742b0c08f7e94101620ba707", + "date": "2020-05-11T09:54:07+01:00", + "sha256": "0wf7pwma2qyfak39b242mcq8z7cdj65sds7hcjxchy0448shapzi", "fetchSubmodules": false } diff --git a/lass/1systems/icarus/config.nix b/lass/1systems/icarus/config.nix index 5e16052ad..8332e7c53 100644 --- a/lass/1systems/icarus/config.nix +++ b/lass/1systems/icarus/config.nix @@ -21,20 +21,15 @@ with import <stockholm/lib>; #<stockholm/lass/2configs/prism-share.nix> <stockholm/lass/2configs/ssh-cryptsetup.nix> <stockholm/lass/2configs/network-manager.nix> + <stockholm/lass/2configs/home-media.nix> ]; - #media center - users.users.media = { - isNormalUser = true; - uid = genid_uint31 "media"; - extraGroups = [ "video" "audio" ]; - }; + krebs.build.host = config.krebs.hosts.icarus; services.xserver.displayManager.lightdm.autoLogin = { enable = true; user = "media"; }; - krebs.build.host = config.krebs.hosts.icarus; - programs.adb.enable = true; + environment.systemPackages = [ pkgs.chromium ]; } diff --git a/lass/1systems/shodan/config.nix b/lass/1systems/shodan/config.nix index 831e03f79..e41c9bd1e 100644 --- a/lass/1systems/shodan/config.nix +++ b/lass/1systems/shodan/config.nix @@ -22,22 +22,11 @@ with import <stockholm/lib>; <stockholm/lass/2configs/hass> <stockholm/lass/2configs/br.nix> <stockholm/lass/2configs/fetchWallpaper.nix> + <stockholm/lass/2configs/home-media.nix> ]; krebs.build.host = config.krebs.hosts.shodan; - #media center - users.users.media = { - isNormalUser = true; - uid = genid_uint31 "media"; - extraGroups = [ "video" "audio" ]; - }; - - services.xserver.displayManager.lightdm.autoLogin = { - enable = true; - user = "media"; - }; - services.logind.lidSwitch = "ignore"; services.logind.lidSwitchDocked = "ignore"; diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix index ef9361102..639ba3d3f 100644 --- a/lass/2configs/hass/default.nix +++ b/lass/2configs/hass/default.nix @@ -1,8 +1,12 @@ { config, lib, pkgs, ... }: +with import ./lib.nix { inherit lib; }; + { imports = [ ./zigbee.nix ./rooms/bett.nix + ./rooms/essen.nix + ./rooms/nass.nix ]; krebs.iptables.tables.filter.INPUT.rules = [ @@ -33,9 +37,11 @@ homeassistant = { name = "Home"; time_zone = "Europe/Berlin"; - latitude = "48.7687"; - longitude = "9.2478"; - elevation = 247; + latitude = "52.46187"; + longitude = "13.41489"; + elevation = 90; + unit_system = "metric"; + customize = friendly_names; }; config = {}; sun.elevation = 66; @@ -61,6 +67,10 @@ }; }; sensor = [ + { + platform = "dwd_weather_warnings"; + region_name = "Berlin"; + } ]; switch = [ (tasmota_s20 "TV" "tv") @@ -69,6 +79,16 @@ (tasmota_s20 "Stereo Anlage" "stereo") ]; mobile_app = {}; + hue = {}; + weather = [ + { + platform = "openweathermap"; + api_key = "xxx"; # TODO put into secrets + } + ]; + system_health = {}; + history = {}; + shopping_list = {}; }; services.mosquitto = { diff --git a/lass/2configs/hass/lib.nix b/lass/2configs/hass/lib.nix index c69f5e887..555cfae28 100644 --- a/lass/2configs/hass/lib.nix +++ b/lass/2configs/hass/lib.nix @@ -1,18 +1,196 @@ -{ +{ lib, ... }: +rec { lights = { - bett = "light.0x0017880106ed3bd8_light"; - essen = "light.0x0017880108327622_light"; - arbeit = "light.0x0017880106ee2865_light"; - nass = "light.0x00178801082e9f2f_light"; + bett = "0x0017880106ed3bd8"; + essen = "0x0017880108327622"; + arbeit = "0x0017880106ee2865"; + nass = "0x00178801082e9f2f"; + }; + + switches = { + dimmer = { + bett = "0x00178801086ac38c"; + essen = "0x00178801086ad1fb"; + nass = "0x00178801086ac373"; + }; }; sensors = { - bett = "0x00178801086ac38c"; + movement = { + essen = "0x0017880106f772f2"; + nass = "0x0017880106f77f30"; + }; + }; + + friendly_names = + lib.mapAttrs' (n: v: lib.nameValuePair "light.${v}_light" { 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 // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_linkquality" { friendly_name = "s.${n}_link"; }) switches.dimmer // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_linkquality" { friendly_name = "i.${n}_link"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_linkquality" { friendly_name = "l.${n}_link"; }) lights // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_battery" { friendly_name = "s.${n}_bat"; }) switches.dimmer // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_battery" { friendly_name = "i.${n}_bat"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_action" { friendly_name = "s.${n}_act"; }) switches.dimmer // + lib.mapAttrs' (n: v: lib.nameValuePair "binary_sensor.${v}_occupancy" { friendly_name = "i.${n}_move"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "binary_sensor.${v}_occupancy" { friendly_name = "i.${n}_move"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_temperature" { friendly_name = "i.${n}_heat"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_temperature" { friendly_name = "i.${n}_heat"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_illuminance" { friendly_name = "i.${n}_lux"; }) sensors.movement // + lib.mapAttrs' (n: v: lib.nameValuePair "sensor.${v}_illuminance" { friendly_name = "i.${n}_lux"; }) sensors.movement // + {}; + + detect_movement = sensor: light: delay: + let + id = "${sensor}_${light}"; + sensor_ = "binary_sensor.${sensor}_occupancy"; + light_ = "light.${light}_light"; + in { + input_boolean."${id}" = { + }; + timer."${id}" = { + duration = delay; + }; + automation = [ + # { + # alias = "debug detect_movement"; + # trigger = { + # platform = "state"; + # entity_id = sensor_; + # }; + # action = [ + # { + # service = "system_log.write"; + # data_template = { + # message = "XXXXXXXXXXXXXXXXXXXXXX {{ states('input_boolean.${sensor}_${light}_triggered') == 'on' }}"; + # #message = "XXXXXXXXXXXXXXXXXXXXXX {{ state_attr('trigger.to_state.state', 'illuminance') }}"; + # }; + # } + # ]; + # } + { + alias = "movement reset timer ${id}"; + hide_entity = true; + trigger = { + platform = "state"; + entity_id = sensor_; + from = "off"; + to = "on"; + }; + action = [ + { + service = "timer.cancel"; + data_template.entity_id = "timer.${id}"; + } + ]; + } + { + alias = "movement on ${id}"; + # hide_entity = true; + trigger = { + platform = "state"; + entity_id = "binary_sensor.${sensor}_occupancy"; + from = "off"; + to = "on"; + }; + condition = { + condition = "and"; + conditions = [ + { + condition = "template"; + value_template = "{{ trigger.to_state.attributes.illuminance < 13000 }}"; + } + { + condition = "template"; + value_template = "{{ states('${light_}') == 'off' }}"; + } + ]; + }; + action = [ + { + service = "light.turn_on"; + data_template = { + entity_id = light_; + brightness = "100"; + }; + } + { delay = "0:00:02"; } + { + service = "input_boolean.turn_on"; + data_template.entity_id = "input_boolean.${id}"; + } + ]; + } + { + alias = "movement off ${id}"; + hide_entity = true; + trigger = { + platform = "state"; + entity_id = sensor_; + from = "on"; + to = "off"; + }; + condition = { + condition = "template"; + value_template = "{{ states('input_boolean.${id}') == 'on' }}"; + }; + action = [ + { + service = "timer.start"; + entity_id = "timer.${id}"; + } + ]; + } + { + alias = "movement override ${id}"; + hide_entity = true; + trigger = { + platform = "state"; + entity_id = light_; + }; + action = [ + { + service = "input_boolean.turn_off"; + data_template.entity_id = "input_boolean.${id}"; + } + { + service = "system_log.write"; + data_template = { + message = "XXXXXXXXXXXXXXXXXXXXXX {{ trigger }}"; + }; + } + ]; + } + { + alias = "movement expired ${id}"; + hide_entity = true; + trigger = { + platform = "event"; + event_type = "timer.finished"; + event_data.entity_id = "timer.${id}"; + }; + action = [ + { + service = "light.turn_off"; + data_template = { + entity_id = light_; + }; + } + { + service = "input_boolean.turn_off"; + data_template.entity_id = "input_boolean.${id}"; + } + ]; + } + ]; }; lightswitch = switch: light: { automation = [ { + alias = "lightswitch ${switch} turn on light ${light}"; + hide_entity = "true"; trigger = { platform = "mqtt"; topic = "zigbee/${switch}"; @@ -47,13 +225,15 @@ { service = "light.turn_on"; data_template = { - entity_id = light; + entity_id = "light.${light}_light"; brightness = "{{ trigger.payload_json.brightness }}"; }; } ]; } { + alias = "lightswitch ${switch} turn off light ${light}"; + hide_entity = "true"; trigger = { platform = "mqtt"; topic = "zigbee/${switch}"; @@ -74,7 +254,7 @@ action = { service = "light.turn_off"; data_template = { - entity_id = light; + entity_id = "light.${light}_light"; }; }; } diff --git a/lass/2configs/hass/rooms/bett.nix b/lass/2configs/hass/rooms/bett.nix index 21092ef5f..b5da9221c 100644 --- a/lass/2configs/hass/rooms/bett.nix +++ b/lass/2configs/hass/rooms/bett.nix @@ -1,27 +1,8 @@ { lib, ... }: -with import ../lib.nix; +with import ../lib.nix { inherit lib; }; { - lass.hass.config = lib.lists.fold lib.recursiveUpdate {} [ - { - #automation = [{ - # trigger = { - # platform = "mqtt"; - # topic = "zigbee/0x00178801086ac38c/action"; - # payload = "on-press"; - # }; - # action = { - # service = "light.turn_on"; - # data = { - # brightness = 150; - # rgb_color = [ 255 0 0 ]; - # entity_id = [ - # "light.0x0017880108327622_light" - # ]; - # }; - # }; - #}]; - } - (lightswitch sensors.bett lights.bett) + lass.hass.config = lib.mkMerge [ + (lightswitch switches.dimmer.bett lights.bett) ]; } diff --git a/lass/2configs/hass/rooms/essen.nix b/lass/2configs/hass/rooms/essen.nix new file mode 100644 index 000000000..f74996154 --- /dev/null +++ b/lass/2configs/hass/rooms/essen.nix @@ -0,0 +1,9 @@ +{ lib, ... }: +with import ../lib.nix { inherit lib; }; + +{ + lass.hass.config = lib.mkMerge [ + (detect_movement sensors.movement.essen lights.essen 10) + (lightswitch switches.dimmer.essen lights.essen) + ]; +} diff --git a/lass/2configs/hass/rooms/nass.nix b/lass/2configs/hass/rooms/nass.nix new file mode 100644 index 000000000..163f4fc48 --- /dev/null +++ b/lass/2configs/hass/rooms/nass.nix @@ -0,0 +1,10 @@ +{ lib, ... }: +with import ../lib.nix { inherit lib; }; + +{ + lass.hass.config = lib.mkMerge [ + (detect_movement sensors.movement.nass lights.nass 100) + (lightswitch switches.dimmer.nass lights.nass) + ]; +} + diff --git a/lass/2configs/hass/zigbee.nix b/lass/2configs/hass/zigbee.nix index 4d57f9ca4..6d091066e 100644 --- a/lass/2configs/hass/zigbee.nix +++ b/lass/2configs/hass/zigbee.nix @@ -2,7 +2,7 @@ zigbee2mqtt_cfg = pkgs.writeText "zigbee2mqtt.json" (builtins.toJSON { homeassistant = true; - permit_join = true; + permit_join = false; mqtt = { discovery = true; base_topic = "zigbee"; @@ -41,14 +41,14 @@ in { { platform = "mqtt"; name = "Zigbee2mqtt Bridge state"; - state_topic = "/zigbee/bridge/state"; + state_topic = "/zigbee2mqtt/bridge/state"; icon = "mdi:router-wireless"; } # Sensor for Showing the Zigbee2mqtt Version { platform = "mqtt"; name = "Zigbee2mqtt Version"; - state_topic = "/zigbee/bridge/config"; + state_topic = "/zigbee2mqtt/bridge/config"; value_template = "{{ value_json.version }}"; icon = "mdi:zigbee"; } @@ -56,7 +56,7 @@ in { { platform = "mqtt"; name = "Coordinator Version"; - state_topic = "/zigbee/bridge/config"; + state_topic = "/zigbee2mqtt/bridge/config"; value_template = "{{ value_json.coordinator }}"; icon = "mdi:chip"; } @@ -64,39 +64,39 @@ in { switch = [ { platform = "mqtt"; - name = "Zigbee2mqtt Main join"; - state_topic = "/zigbee/bridge/config/permit_join"; - command_topic = "/zigbee/bridge/config/permit_join"; + name = "zigbee2mqtt_join"; + state_topic = "/zigbee2mqtt/bridge/config/permit_join"; + command_topic = "/zigbee2mqtt/bridge/config/permit_join"; payload_on = "true"; payload_off = "false"; } ]; automation = [ - { - alias = "Zigbee2mqtt Log Level"; - initial_state = "on"; - trigger = { - platform = "state"; - entity_id = "input_select.zigbee2mqtt_log_level"; - }; - action = [ - { - service = "mqtt.publish"; - data = { - payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}"; - topic = "/zigbee/bridge/config/log_level"; - }; - } - ]; - } + #{ + # alias = "Zigbee2mqtt Log Level"; + # initial_state = "on"; + # trigger = { + # platform = "state"; + # entity_id = "input_select.zigbee2mqtt_log_level"; + # }; + # action = [ + # { + # service = "mqtt.publish"; + # data = { + # payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}"; + # topic = "/zigbee2mqtt/bridge/config/log_level"; + # }; + # } + # ]; + #} # Automation to start timer when enable join is turned on { id = "zigbee_join_enabled"; - alias = "Zigbee Join Enabled"; + alias = ""; hide_entity = "true"; trigger = { platform = "state"; - entity_id = "switch.zigbee2mqtt_main_join"; + entity_id = "switch.zigbee2mqtt_join"; to = "on"; }; action = { @@ -107,7 +107,6 @@ in { # Automation to stop timer when switch turned off and turn off switch when timer finished { id = "zigbee_join_disabled"; - alias = "Zigbee Join Disabled"; hide_entity = "true"; trigger = [ { @@ -117,7 +116,7 @@ in { } { platform = "state"; - entity_id = "switch.zigbee2mqtt_main_join"; + entity_id = "switch.zigbee2mqtt_join"; to = "off"; < |