diff options
Diffstat (limited to 'makefu/2configs/home/ham')
-rw-r--r-- | makefu/2configs/home/ham/automation/light_buttons.nix | 60 | ||||
-rw-r--r-- | makefu/2configs/home/ham/default.nix | 1 | ||||
-rw-r--r-- | makefu/2configs/home/ham/device_tracker/tile.nix | 10 | ||||
-rw-r--r-- | makefu/2configs/home/ham/light/arbeitszimmer.nix | 20 | ||||
-rw-r--r-- | makefu/2configs/home/ham/mqtt.nix | 43 |
5 files changed, 98 insertions, 36 deletions
diff --git a/makefu/2configs/home/ham/automation/light_buttons.nix b/makefu/2configs/home/ham/automation/light_buttons.nix index 62fc87bb4..1892917c4 100644 --- a/makefu/2configs/home/ham/automation/light_buttons.nix +++ b/makefu/2configs/home/ham/automation/light_buttons.nix @@ -1,27 +1,53 @@ let inherit (import ../lib) btn_cycle_light; - turn_off_all = btn: #lights: - { - alias = "Turn of all lights via ${btn} double click"; - trigger = { - platform = "state"; - entity_id = "sensor.${btn}_click"; - to = "double"; - }; - action = { - service = "light.turn_off"; - #entity_id = lights; - entity_id = "all"; - }; - }; in { services.home-assistant.config.automation = [ # (btn_cycle_light "light.arbeitszimmerbeleuchtung" "arbeitszimmer_btn1") (btn_cycle_light "light.schlafzimmer_komode_osram" "schlafzimmer_btn2" 128) - - (btn_cycle_light "light.keller_osram" "keller_btn1" 128) + { + alias = "toggle keller"; + trigger = { + platform = "state"; + entity_id = "sensor.keller_btn1_click"; + to = "single"; + }; + action = { + service = "light.toggle"; + #entity_id = lights; + data = { + entity_id = "light.keller_osram"; + brightness = 255; + }; + }; + } + { + alias = "low brightness keller with doubleclick"; + trigger = { + platform = "state"; + entity_id = "sensor.keller_btn1_click"; + to = "double"; + }; + action = { + service = "light.toggle"; + data = { + entity_id = "light.keller_osram"; + brightness = 50; + }; + }; + } # (btn_cycle_light "light.wohnzimmerbeleuchtung" "wohnzimmer_btn3") - (turn_off_all "schlafzimmer_btn2" ) + { + alias = "Turn of all lights via schlafzimmer_btn2 double click"; + trigger = { + platform = "state"; + entity_id = "sensor.schlafzimmer_btn2_click"; + to = "double"; + }; + action = { + service = "light.turn_off"; + entity_id = "all"; + }; + } ]; } diff --git a/makefu/2configs/home/ham/default.nix b/makefu/2configs/home/ham/default.nix index 6ab3cd46c..e17cfc35d 100644 --- a/makefu/2configs/home/ham/default.nix +++ b/makefu/2configs/home/ham/default.nix @@ -23,6 +23,7 @@ in { # ./multi/fliegen-couter.nix ./device_tracker/openwrt.nix + ./device_tracker/tile.nix ./sensor/outside.nix diff --git a/makefu/2configs/home/ham/device_tracker/tile.nix b/makefu/2configs/home/ham/device_tracker/tile.nix new file mode 100644 index 000000000..ad1e6c15d --- /dev/null +++ b/makefu/2configs/home/ham/device_tracker/tile.nix @@ -0,0 +1,10 @@ +{ + + services.home-assistant.config.device_tracker = + [ + { inherit (import <secrets/hass/tile.nix>) username password; + platform = "tile"; + show_inactive = true; + } + ]; +} diff --git a/makefu/2configs/home/ham/light/arbeitszimmer.nix b/makefu/2configs/home/ham/light/arbeitszimmer.nix index bc60678b3..45fbfb57b 100644 --- a/makefu/2configs/home/ham/light/arbeitszimmer.nix +++ b/makefu/2configs/home/ham/light/arbeitszimmer.nix @@ -6,7 +6,8 @@ let ]; arbeitszimmerbeleuchtung = [ "light.arbeitszimmer_schrank_dimmer" - "light.arbeitszimmer_kerze" # arbeitszimmer_kerze + "light.arbeitszimmer_kerze" + "light.arbeitszimmer_pflanzenlicht" ]; in { services.home-assistant.config.light = [ @@ -20,5 +21,22 @@ in { name = "Arbeitszimmer Deko"; entities = arbeitszimmer_deko; } + { platform = "switch"; + name = "Arbeitszimmer Pflanzenlicht"; + entity_id = "switch.arbeitszimmer_stecker1"; + } + ]; + services.home-assistant.config.automation = [ + { + alias = "Toggle Arbeitszimmerbeleuchtung via Remote"; + trigger = { + platform = "state"; + entity_id = "sensor.arbeitszimmer_remote1_action"; + }; + action = { + service = "light.toggle"; + data.entity_id = "light.arbeitszimmerbeleuchtung"; + }; + } ]; } diff --git a/makefu/2configs/home/ham/mqtt.nix b/makefu/2configs/home/ham/mqtt.nix index cd1c328d7..c90afff4a 100644 --- a/makefu/2configs/home/ham/mqtt.nix +++ b/makefu/2configs/home/ham/mqtt.nix @@ -1,24 +1,31 @@ { pkgs, config, ... }: { + environment.systemPackages = [ pkgs.mosquitto ]; + # port open via trusted interface services.mosquitto = { enable = true; - host = "0.0.0.0"; - allowAnonymous = false; - checkPasswords = true; - # see <host>/mosquitto - users.sensor = { - hashedPassword = "$6$2DXU7W1bvqXPqxkF$vtdz5KTd/T09hmoc9LjgEGFjvpwQbQth6vlVcr5hJNLgcBHv4U03YCKC8TKXbmQAa8xiJ76xJIg25kcL+KI3tg=="; - acl = [ "topic readwrite #" ]; - }; - users.hass = { - hashedPassword = "$6$SHuYGrE5kPSUc/hu$EomZ0KBy+vkxLt/6eJkrSBjYblCCeMjhDfUd2mwqXYJ4XsP8hGmZ59mMlmBCd3AvlFYQxb4DT/j3TYlrqo7cDA=="; - acl = [ "topic readwrite #" ]; - }; - users.stats = { - hashedPassword = "$6$j4H7KXD/YZgvgNmL$8e9sUKRXowDqJLOVgzCdDrvDE3+4dGgU6AngfAeN/rleGOgaMhee2Mbg2KS5TC1TOW3tYbk9NhjLYtjBgfRkoA=="; - acl = [ "topic read #" ]; - }; + persistence = false; + settings.max_keepalive = 60; + listeners = [ + { + port = 1883; + omitPasswordAuth = false; + users.sensor = { + hashedPassword = "$6$2DXU7W1bvqXPqxkF$vtdz5KTd/T09hmoc9LjgEGFjvpwQbQth6vlVcr5hJNLgcBHv4U03YCKC8TKXbmQAa8xiJ76xJIg25kcL+KI3tg=="; + acl = [ "topic readwrite #" ]; + }; + users.hass = { + hashedPassword = "$6$SHuYGrE5kPSUc/hu$EomZ0KBy+vkxLt/6eJkrSBjYblCCeMjhDfUd2mwqXYJ4XsP8hGmZ59mMlmBCd3AvlFYQxb4DT/j3TYlrqo7cDA=="; + acl = [ "topic readwrite #" ]; + }; + users.stats = { + hashedPassword = "$6$j4H7KXD/YZgvgNmL$8e9sUKRXowDqJLOVgzCdDrvDE3+4dGgU6AngfAeN/rleGOgaMhee2Mbg2KS5TC1TOW3tYbk9NhjLYtjBgfRkoA=="; + acl = [ "topic read #" ]; + }; + settings = { + allow_anonymous = false; + }; + } + ]; }; - environment.systemPackages = [ pkgs.mosquitto ]; - # port open via trusted interface } |