summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2020-03-23 10:15:42 +0100
committerlassulus <lassulus@lassul.us>2020-03-23 10:15:42 +0100
commit8c27f12f86096f06e56333125eb6c713aece34ed (patch)
tree83d29ab23719468ff6e8d31f29963dd449edbef2 /makefu/2configs/ham
parentcab3be8a19d445d3292454099dbc1ca97bca60c5 (diff)
parent8e3cd9fcffc473706a3ebafa5cb80f7a75c29aa5 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs/ham')
-rw-r--r--makefu/2configs/ham/androidtv/adbshell.nix38
-rw-r--r--makefu/2configs/ham/androidtv/default.nix30
-rw-r--r--makefu/2configs/ham/androidtv/purepythonadb.nix21
-rw-r--r--makefu/2configs/ham/automation/firetv_restart.nix33
-rw-r--r--makefu/2configs/ham/default.nix152
-rw-r--r--makefu/2configs/ham/google-muell.nix45
-rw-r--r--makefu/2configs/ham/lib/default.nix44
-rw-r--r--makefu/2configs/ham/mqtt.nix24
-rw-r--r--makefu/2configs/ham/multi/flurlicht.nix57
-rw-r--r--makefu/2configs/ham/multi/kurzzeitwecker.nix132
-rw-r--r--makefu/2configs/ham/multi/zigbee2mqtt.nix129
-rw-r--r--makefu/2configs/ham/sensor/outside.nix20
-rw-r--r--makefu/2configs/ham/zigbee2mqtt/default.nix20
13 files changed, 745 insertions, 0 deletions
diff --git a/makefu/2configs/ham/androidtv/adbshell.nix b/makefu/2configs/ham/androidtv/adbshell.nix
new file mode 100644
index 000000000..f5b96c859
--- /dev/null
+++ b/makefu/2configs/ham/androidtv/adbshell.nix
@@ -0,0 +1,38 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, cryptography
+, pyasn1
+, rsa
+, pycryptodome
+}:
+
+buildPythonPackage rec {
+ pname = "adb_shell";
+ version = "0.0.8";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "01f9jinhfyjldg9793gz2i7gcd9xyx0a62r7a5ijssklcnn2rwnm";
+ };
+
+ propagatedBuildInputs = [
+ cryptography
+ pyasn1
+ rsa
+ ];
+
+ # tests are not part of pypi package
+ doCheck = false;
+
+ checkInputs = [
+ pycryptodome
+ ];
+
+ meta = with lib; {
+ description = "A Python implementation of ADB with shell and FileSync functionality";
+ homepage = https://github.com/JeffLIrion/adb_shell/;
+ license = licenses.mit;
+ # maintainers = [ maintainers. ];
+ };
+}
diff --git a/makefu/2configs/ham/androidtv/default.nix b/makefu/2configs/ham/androidtv/default.nix
new file mode 100644
index 000000000..8f3bdc1f3
--- /dev/null
+++ b/makefu/2configs/ham/androidtv/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, buildPythonPackage
+, callPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+ pname = "androidtv";
+ version = "0.0.34";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "13078i2a9hglpv4ldycph5n5485np21vs6z2qn830hybmx8kfxsw";
+ };
+
+ propagatedBuildInputs = [
+ (callPackage ./adbshell.nix {})
+ (callPackage ./purepythonadb.nix {})
+ ];
+
+ # tests are not packaged in pypi release
+ doCheck = false;
+
+ meta = with lib; {
+ description = "Communicate with an Android TV or Fire TV device via ADB over a network";
+ homepage = https://github.com/JeffLIrion/python-androidtv/;
+ license = licenses.mit;
+ # maintainers = [ maintainers. ];
+ };
+}
diff --git a/makefu/2configs/ham/androidtv/purepythonadb.nix b/makefu/2configs/ham/androidtv/purepythonadb.nix
new file mode 100644
index 000000000..d4e763b70
--- /dev/null
+++ b/makefu/2configs/ham/androidtv/purepythonadb.nix
@@ -0,0 +1,21 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+ pname = "pure-python-adb";
+ version = "0.2.3.dev0";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "88e5a4578435197799aa368fb1a5d87fe43e02a888cb7e85c2ad66173b383c89";
+ };
+
+ meta = with lib; {
+ description = "Pure python implementation of the adb client";
+ homepage = https://github.com/Swind/pure-python-adb;
+ license = licenses.mit;
+ # maintainers = [ maintainers. ];
+ };
+} \ No newline at end of file
diff --git a/makefu/2configs/ham/automation/firetv_restart.nix b/makefu/2configs/ham/automation/firetv_restart.nix
new file mode 100644
index 000000000..1094d177f
--- /dev/null
+++ b/makefu/2configs/ham/automation/firetv_restart.nix
@@ -0,0 +1,33 @@
+let
+ cmd = command: {
+ service = "androidtv.adb_command";
+ data = {
+ entity_id = "media_player.firetv_stick";
+ inherit command;
+ };
+ };
+ sec = seconds: { delay.seconds = seconds; };
+in [
+ {
+ alias = "Nightly reboot of firetv";
+ trigger = {
+ platform = "time";
+ at = "03:00:00";
+ };
+ action = [
+ (cmd "reboot")
+ (sec 90) # go to my music because apparently select_source does not seem to always work
+ (cmd "HOME")
+ (sec 2)
+ (cmd "DOWN")
+ (sec 2)
+ (cmd "DOWN")
+ (sec 2)
+ (cmd "ENTER")
+ (sec 4)
+ (cmd "RIGHT")
+ (sec 2)
+ (cmd "RIGHT")
+ ];
+ }
+]
diff --git a/makefu/2configs/ham/default.nix b/makefu/2configs/ham/default.nix
new file mode 100644
index 000000000..53723299c
--- /dev/null
+++ b/makefu/2configs/ham/default.nix
@@ -0,0 +1,152 @@
+{ pkgs, lib, config, ... }:
+
+# Ideas:
+## wake-on-lan server
+##
+let
+ upkgs = (import <nixpkgs-unstable> {}).pkgs;
+ hlib = (import ./lib);
+ prefix = hlib.prefix;
+ tasmota = hlib.tasmota;
+ firetv_stick = "192.168.1.24";
+ hassdir = "/var/lib/hass";
+ zigbee = import ./multi/zigbee2mqtt.nix;
+ #flurlicht = import ./multi/flurlicht.nix;
+ kurzzeitwecker = import ./multi/kurzzeitwecker.nix;
+ firetv_restart = import ./multi/firetv_restart.nix;
+# switch
+# automation
+# binary_sensor
+# sensor
+# input_select
+# timer
+in {
+ imports = [
+ ./mqtt.nix
+ ];
+
+ services.home-assistant = {
+ package = (upkgs.home-assistant.overrideAttrs (old: {
+ })).override {
+ extraPackages = ps: with ps; [
+ python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts
+ (ps.callPackage ./androidtv {})
+ ];
+ };
+ config = {
+ input_select = zigbee.input_select; # dict
+ timer = zigbee.timer // kurzzeitwecker.timer; # dict
+ homeassistant = {
+ name = "Home"; time_zone = "Europe/Berlin";
+ latitude = "48.7687";
+ longitude = "9.2478";
+ elevation = 247;
+ };
+ discovery = {};
+ conversation = {};
+ history = {};
+ logbook = {};
+ logger = {
+ default = "info";
+ };
+ tts = [
+ { platform = "google_translate";
+ language = "de";
+ time_memory = 57600;
+ service_name = "google_say";
+ }
+ ];
+
+ telegram_bot = [
+ # secrets file: {
+ # "platform": "broadcast",
+ # "api_key": "", # talk to Botfather /newbot
+ # "allowed_chat_ids": [ ID ] # curl -X GET # https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates
+ #}
+ (builtins.fromJSON
+ (builtins.readFile <secrets/hass/telegram-bot.json>))
+ ];
+ notify = [
+ {
+ platform = "kodi";
+ name = "wohnzimmer";
+ host = firetv_stick;
+ }
+ {
+ platform = "telegram";
+ name = "telegrambot";
+ chat_id = builtins.elemAt
+ (builtins.fromJSON (builtins.readFile
+ <secrets/hass/telegram-bot.json>)).allowed_chat_ids 0;
+ }
+ ];
+ sun.elevation = 247;
+ recorder = {};
+ media_player = [
+ { platform = "FireTV Stick kodi";
+ host = firetv_stick;
+ }
+ { platform = "androidtv";
+ name = "FireTV Stick";
+ device_class = "firetv";
+ # adb_server_ip = firetv_stick;
+ host = firetv_stick;
+ port = 5555;
+ }
+ ];
+ mqtt = {
+ broker = "localhost";
+ discovery = true; #enable esphome discovery
+ discovery_prefix = "homeassistant";
+ port = 1883;
+ client_id = "home-assistant";
+ username = "hass";
+ password = lib.removeSuffix "\n" (builtins.readFile <secrets/mqtt/hass>);
+ keepalive = 60;
+ protocol = 3.1;
+ birth_message = {
+ topic = "${prefix}/hass/tele/LWT";
+ payload = "Online";
+ qos = 1;
+ retain = true;
+ };
+ will_message = {
+ topic = "${prefix}/hass/tele/LWT";
+ payload = "Offline";
+ qos = 1;
+ retain = true;
+ };
+ };
+ luftdaten = {
+ show_on_map = true;
+ sensor_id = 679;
+ sensors.monitored_conditions = [ "P1" "P2" ];
+ };
+ #binary_sensor =
+ # flurlicht.binary_sensor;
+ sensor = [
+ { platform = "speedtest";
+ monitored_conditions = [ "ping" "download" "upload" ];
+ }
+ # https://www.home-assistant.io/cookbook/automation_for_rainy_days/
+ ]
+ ++ ((import ./sensor/outside.nix) {inherit lib;})
+ ++ zigbee.sensor ;
+ frontend = { };
+ # light = flurlicht.light;
+ http = { };
+ switch = [];
+ automation = []
+ ++ (import ./automation/firetv_restart.nix)
+ ++ kurzzeitwecker.automation
+ #++ flurlicht.automation
+ ++ zigbee.automation;
+ script =
+ { }
+ // kurzzeitwecker.script; # dict
+ };
+ enable = true;
+ configDir = hassdir;
+ };
+
+}
diff --git a/makefu/2configs/ham/google-muell.nix b/makefu/2configs/ham/google-muell.nix
new file mode 100644
index 000000000..c81eae201
--- /dev/null
+++ b/makefu/2configs/ham/google-muell.nix
@@ -0,0 +1,45 @@
+{ config, lib, pkgs, buildPythonPackage, ... }:
+with import <stockholm/lib>;
+let
+ pkg = pkgs.ampel;
+ home = "/var/lib/ampel";
+ sec = "${toString <secrets>}/ampel/google-muell.json";
+ ampelsec = "${home}/google-muell.json";
+ cred = "${toString <secrets>}/ampel/google-muell-creds.json";
+ # TODO: generate this credential file locally
+ ampelcred = "${home}/google-muell-creds.json";
+ sleepval = "1800";
+ # default-color = "18,63,40";
+ default-color = "255,127,0";
+ config_json = toFile "config.json" (toJSON {
+ mq_hostname = "localhost";
+ mq_port = 1883;
+ mq_username = "sensor";
+ mq_topic = "/ham/flurlicht/cmnd/MEM1";
+ mq_password = replaceChars ["\n"] [""] (readFile "${toString <secrets>}/mqtt/sensor");
+ });
+in {
+ users.users.ampel = {
+ uid = genid "ampel";
+ createHome = true;
+ isSystemUser = true;
+ inherit home;
+ };
+ systemd.services.google-muell-ampel = {
+ description = "Send led change to rgb cubes";
+ after = [ "network-online.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "ampel";
+ ExecStartPre = pkgs.writeDash "copy-ampel-secrets" ''
+ install -m600 -o ampel ${sec} ${ampelsec}
+ install -m600 -o ampel ${cred} ${ampelcred}
+ '';
+ ExecStart = "${pkg}/bin/google-muell --config ${config_json} --default-color=${default-color} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}";
+ PermissionsStartOnly = true;
+ Restart = "always";
+ RestartSec = 10;
+ PrivateTmp = true;
+ };
+ };
+}
diff --git a/makefu/2configs/ham/lib/default.nix b/makefu/2configs/ham/lib/default.nix
new file mode 100644
index 000000000..45c86138b
--- /dev/null
+++ b/makefu/2configs/ham/lib/default.nix
@@ -0,0 +1,44 @@
+let
+ prefix = "/ham";
+in
+{
+ inherit prefix;
+ say = let
+ # returns a list of actions to be performed on an mpd to say something
+ tts = { message, entity }:
+ [
+ {
+ service = "media_player.turn_on";
+ data.entity_id = entity;
+ }
+ {
+ service = "media_player.play_media";
+ data = {
+ entity_id = entity;
+ media_content_type = "playlist";
+ media_content_id = "ansage";
+ };
+ }
+ {
+ service = "media_player.turn_on";
+ data.entity_id = entity;
+ }
+ { delay.seconds = 8; }
+ {
+ service = "tts.say";
+ entity_id = entity;
+ data_template = {
+ inherit message;
+ language = "de";
+ };
+ }
+ ];
+ in
+ {
+ firetv = message: tts {
+ inherit message;
+ entity = "firetv";
+ };
+ };
+ zigbee.prefix = "/ham/zigbee";
+}
diff --git a/makefu/2configs/ham/mqtt.nix b/makefu/2configs/ham/mqtt.nix
new file mode 100644
index 000000000..cd1c328d7
--- /dev/null
+++ b/makefu/2configs/ham/mqtt.nix
@@ -0,0 +1,24 @@
+{ pkgs, config, ... }:
+{
+ 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 #" ];
+ };
+ };
+ environment.systemPackages = [ pkgs.mosquitto ];
+ # port open via trusted interface
+}
diff --git a/makefu/2configs/ham/multi/flurlicht.nix b/makefu/2configs/ham/multi/flurlicht.nix
new file mode 100644
index 000000000..25eb78b7f
--- /dev/null
+++ b/makefu/2configs/ham/multi/flurlicht.nix
@@ -0,0 +1,57 @@
+# provides:
+# light
+# automation
+# binary_sensor
+let
+ hlib = (import ../lib);
+ tasmota = hlib.tasmota;
+in
+{
+ binary_sensor = [
+ (tasmota.motion { name = "Flur Bewegung"; host = "flurlicht";})
+ ];
+ light = [ (tasmota.rgb { name = "Flurlicht"; host = "flurlicht";} ) ];
+ automation = [
+ { alias = "Dunkel bei Sonnenuntergang";
+ trigger = {
+ platform = "sun";
+ event = "sunset";
+ # offset: "-00:45:00"
+ };
+ action = [
+ {
+ service= "light.turn_on";
+ data = {
+ entity_id= "light.flurlicht";
+ # rgb_color = [ 0,0,0 ]; <-- TODO default color
+ brightness_pct = 15;
+ };
+ }
+ {
+ service= "light.turn_off";
+ entity_id= "light.flurlicht";
+ }
+ ];
+ }
+ { alias = "Hell bei Sonnenaufgang";
+ trigger = {
+ platform = "sun";
+ event = "sunrise";
+ # offset: "-00:00:00"
+ };
+ action = [
+ {
+ service= "light.turn_on";
+ data = {
+ entity_id= "light.flurlicht";
+ brightness_pct = 85;
+ };
+ }
+ {
+ service= "light.turn_off";
+ entity_id= "light.flurlicht";
+ }
+ ];
+ }
+ ];
+}
diff --git a/makefu/2configs/ham/multi/kurzzeitwecker.nix b/makefu/2configs/ham/multi/kurzzeitwecker.nix
new file mode 100644
index 000000000..03d0d5aac
--- /dev/null
+++ b/makefu/2configs/ham/multi/kurzzeitwecker.nix
@@ -0,0 +1,132 @@
+# Provides:
+# timer
+# automation
+# script
+
+# Needs:
+# sensor.zigbee_btn1_click
+# notify.telegrambot
+let
+ button = "sensor.zigbee_btn2_click";
+in {
+ timer.kurzzeitwecker =
+ {
+ name = "Zigbee Kurzzeitwecker";
+ duration = 300;
+ };
+ script.add_5_minutes_to_kurzzeitwecker =
+ {
+ alias = "Add 5 minutes to kurzzeitwecker";
+ sequence = [
+ { service = "timer.pause";
+ entity_id = "timer.kurzzeitwecker";
+ }
+ { service = "timer.start";
+ data_template = {
+ entity_id = "timer.kurzzeitwecker";
+ duration = ''
+ {% set r = state_attr('timer.kurzzeitwecker', 'remaining') ~ '-0000' %}
+ {% set t = strptime(r, '%H:%M:%S.%f%z') %}
+ {{ (as_timestamp(t) + 300) | timestamp_custom('%H:%M:%S', false) }}
+ '';
+ };
+ }
+ ];
+ };
+ automation =
+ [
+ {
+ alias = "Start Timer 5min";
+ trigger = {
+ platform = "state";
+ entity_id = button;
+ to = "single";
+ };
+ condition =
+ { condition = "state";
+ entity_id = "timer.kurzzeitwecker";
+ state = "idle";
+ };
+
+ action = [
+ { service = "timer.start";
+ entity_id = "timer.kurzzeitwecker";
+ data.duration = "00:05:00";
+ }
+ {
+ service = "notify.telegrambot";
+ data.message = "Timer gestartet {{state_attr('timer.kurzzeitwecker', 'remaining') }}, verbleibend ";
+ }
+ ];
+ }
+ {
+ alias = "Add Timer 5min";
+ trigger = {
+ platform = "state";
+ entity_id = button;
+ to = "single";
+ };
+ condition =
+ { condition = "state";
+ entity_id = "timer.kurzzeitwecker";
+ state = "active";
+ };
+
+ action = [
+ { service = "homeassistant.turn_on";
+ entity_id = "script.add_5_minutes_to_kurzzeitwecker";
+ }
+ {
+ service = "notify.telegrambot";
+ data.message = ''Timer um 5 minuten verlängert, {{ state_attr('timer.kurzzeitwecker', 'remaining') | truncate(9,True," ") }} verbleibend '';
+ }
+ ];
+ }
+ {
+ alias = "Stop timer on double click";
+ trigger = [
+ {
+ platform = "state";
+ entity_id = button;
+ to = "double";
+ }
+ {
+ platform = "state";
+ entity_id = button;
+ to = "triple";
+ }
+ ];
+ condition =
+ {
+ condition = "state";
+ entity_id = "timer.kurzzeitwecker";
+ state = "active";
+ };
+
+ action = [
+ {
+ service = "timer.cancel";
+ entity_id = "timer.kurzzeitwecker";
+ }
+ {
+ service = "notify.telegrambot";
+ data.message = "Timer gestoppt, abgebrochen";
+ }
+ ];
+ }
+ {
+ alias = "Timer Finished";
+ trigger = {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.kurzzeitwecker";
+ };
+ action = [
+ {
+ service = "notify.telegrambot";
+ data.message = "Timer beendet";
+ }
+ ];
+ }
+ ];
+}
diff --git a/makefu/2configs/ham/multi/zigbee2mqtt.nix b/makefu/2configs/ham/multi/zigbee2mqtt.nix
new file mode 100644
index 000000000..947eb5517
--- /dev/null
+++ b/makefu/2configs/ham/multi/zigbee2mqtt.nix
@@ -0,0 +1,129 @@
+# provides:
+# switch
+# automation
+# binary_sensor
+# sensor
+# input_select
+# timer
+let
+ inherit (import ../lib) zigbee;
+ prefix = zigbee.prefix;
+in {
+ sensor =
+
+ [
+ # Sensor for monitoring the bridge state
+ {
+ platform = "mqtt";
+ name = "Zigbee2mqtt Bridge state";
+ state_topic = "${prefix}/bridge/state";
+ icon = "mdi:router-wireless";
+ }
+ # Sensor for Showing the Zigbee2mqtt Version
+ {
+ platform = "mqtt";
+ name = "Zigbee2mqtt Version";
+ state_topic = "${prefix}/bridge/config";
+ value_template = "{{ value_json.version }}";
+ icon = "mdi:zigbee";
+ }
+ # Sensor for Showing the Coordinator Version
+ {
+ platform = "mqtt";
+ name = "Coordinator Version";
+ state_topic = "${prefix}/bridge/config";
+ value_template = "{{ value_json.coordinator }}";
+ icon = "mdi:chip";
+ }
+ ];
+ switch = [
+ {
+ platform = "mqtt";
+ name = "Zigbee2mqtt Main join";
+ state_topic = "${prefix}/bridge/config/permit_join";
+ command_topic = "${prefix}/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 = "${prefix}/bridge/config/log_level";
+ };
+ }
+ ];
+ }
+# Automation to start timer when enable join is turned on
+ {
+ id = "zigbee_join_enabled";
+ alias = "Zigbee Join Enabled";
+ hide_entity = "true";
+ trigger =
+ {
+ platform = "state";
+ entity_id = "switch.zigbee2mqtt_main_join";
+ to = "on";
+ };
+ action =
+ {
+ service = "timer.start";
+ entity_id = "timer.zigbee_permit_join";
+ };
+ }
+# # 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 = [
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.zigbee_permit_join";
+ }
+ {
+ platform = "state";
+ entity_id = "switch.zigbee2mqtt_main_join";
+ to = "off";
+ }
+ ];
+ action = [
+ { service = "timer.cancel";
+ data.entity_id = "timer.zigbee_permit_join";
+ }
+ { service = "switch.turn_off";
+ entity_id = "switch.zigbee2mqtt_main_join";
+ }
+ ];
+ }
+ ];
+ input_select.zigbee2mqtt_log_level =
+ {
+ name = "Zigbee2mqtt Log Level";
+ options = [
+ "debug"
+ "info"
+ "warn"
+ "error"
+ ];
+ initial = "info";
+ icon = "mdi:format-list-bulleted";
+ };
+
+ timer.zigbee_permit_join =
+ {
+ name = "Zigbee Time remaining";
+ duration = 120;
+ };
+}
diff --git a/makefu/2configs/ham/sensor/outside.nix b/makefu/2configs/ham/sensor/outside.nix
new file mode 100644
index 000000000..c46b35ba3
--- /dev/null
+++ b/makefu/2configs/ham/sensor/outside.nix
@@ -0,0 +1,20 @@
+{lib,...}: [
+ { platform = "darksky";
+ api_key = lib.removeSuffix "\n"
+ (builtins.readFile <secrets/hass/darksky.apikey>);
+ language = "de";
+ monitored_conditions = [
+ "summary" "icon"
+ "nearest_storm_distance" "precip_probability"
+ "precip_intensity"
+ "temperature" # "temperature_high" "temperature_low"
+ "apparent_temperature"
+ "hourly_summary" # next 24 hours text
+ "humidity"
+ "pressure"
+ "uv_index"
+ ];
+ units = "si" ;
+ scan_interval = "00:30:00";
+ }
+ ]
diff --git a/makefu/2configs/ham/zigbee2mqtt/default.nix b/makefu/2configs/ham/zigbee2mqtt/default.nix
new file mode 100644
index 000000000..7c55326f9
--- /dev/null
+++ b/makefu/2configs/ham/zigbee2mqtt/default.nix
@@ -0,0 +1,20 @@
+{config, pkgs, lib, ...}:
+
+
+{
+ # symlink the zigbee controller
+ services.udev.extraRules = ''
+ SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout"
+ '';
+
+ system.activationScripts.installZigbee = ''
+ install -d /var/lib/zigbee2mqtt
+ '';
+
+ docker-containers.zigbee2mqtt = {
+ image = "koenkk/zigbee2mqtt";
+ extraDockerOptions = [ "--device=/dev/cc2531:/dev/cc2531" ];
+ volumes = ["/var/lib/zigbee2mqtt:/app/data"];
+ };
+ state = [ "/var/lib/zigbee2mqtt/configuration.yaml" "/var/lib/zigbee2mqtt/state.json" ];
+}