From 966620d6c64bbb2a375e2dc30d8a70c636cd8864 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 09:11:33 +0200 Subject: ma pkgs.prison-break: init at 0.1.0 --- makefu/5pkgs/prison-break/default.nix | 20 ++++++++++++++++++++ makefu/5pkgs/prison-break/straight-plugin.nix | 22 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 makefu/5pkgs/prison-break/default.nix create mode 100644 makefu/5pkgs/prison-break/straight-plugin.nix diff --git a/makefu/5pkgs/prison-break/default.nix b/makefu/5pkgs/prison-break/default.nix new file mode 100644 index 00000000..f86ac376 --- /dev/null +++ b/makefu/5pkgs/prison-break/default.nix @@ -0,0 +1,20 @@ +{pkgs, fetchFromGitHub}: +with pkgs.python3.pkgs; + +buildPythonPackage rec { + pname = "prison-break"; + version = "0.1.0"; + src = fetchFromGitHub { + owner = "makefu"; + repo = pname; + rev = "5eed6371e151e716faafa054e005bd98d77b4b5d"; + sha256 = "170zs9grbgkx83ghg6pm13v7vhi604y44j550ypp2x26nidaw63j"; + }; + propagatedBuildInputs = [ + docopt + requests + beautifulsoup4 + (callPackage ./straight-plugin.nix {}) + ]; + checkInputs = [ black ]; +} diff --git a/makefu/5pkgs/prison-break/straight-plugin.nix b/makefu/5pkgs/prison-break/straight-plugin.nix new file mode 100644 index 00000000..606c60b5 --- /dev/null +++ b/makefu/5pkgs/prison-break/straight-plugin.nix @@ -0,0 +1,22 @@ +{ lib +, buildPythonPackage +, fetchPypi +}: + +buildPythonPackage rec { + pname = "straight-plugin"; + version = "1.5.0"; + + src = fetchPypi { + pname = "straight.plugin"; + inherit version; + sha256 = "818a7641068932ed6436d0af0a3bb77bbbde29df0a7142c8bd1a249e7c2f0d38"; + }; + + meta = with lib; { + description = "A simple namespaced plugin facility"; + homepage = https://github.com/ironfroggy/straight.plugin; + license = licenses.mit; + maintainers = [ maintainers.makefu ]; + }; +} -- cgit v1.2.3 From f7a22959ca67c1426149b61b518fec663d81d0c1 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 09:14:03 +0200 Subject: gitlab-ci: trigger NUR update --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1946f269..6d2f1506 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,5 +15,6 @@ nur-packages makefu: - git filter-branch -f --prune-empty --subdirectory-filter makefu/5pkgs HEAD - git remote add deploy git@github.com:makefu/nur-packages.git || git remote set-url deploy git@github.com:makefu/nur-packages.git - git push --force deploy HEAD:master + - curl -XPOST http://nur-update.herokuapp.com/update?repo=makefu after_script: - rm -f deploy.key -- cgit v1.2.3 From bce8dd2348af3f15a6fe3c9cb91b5b7576c2bf99 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 09:18:10 +0200 Subject: ma editors/vim: try out languageClient --- makefu/2configs/editor/vim.nix | 1 + makefu/2configs/editor/vimrc | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/makefu/2configs/editor/vim.nix b/makefu/2configs/editor/vim.nix index d14a611b..8a58e44d 100644 --- a/makefu/2configs/editor/vim.nix +++ b/makefu/2configs/editor/vim.nix @@ -23,6 +23,7 @@ in { vimrcConfig.vam.pluginDictionaries = [ { names = [ "undotree" # "YouCompleteMe" + "LanguageClient-neovim" "vim-better-whitespace" ]; } # vim-nix handles indentation better but does not perform sanity { names = [ "vim-addon-nix" ]; ft_regex = "^nix\$"; } diff --git a/makefu/2configs/editor/vimrc b/makefu/2configs/editor/vimrc index 8cdab55d..96c505ba 100644 --- a/makefu/2configs/editor/vimrc +++ b/makefu/2configs/editor/vimrc @@ -96,3 +96,14 @@ augroup Binary au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin set nomod | endif augroup END + +let g:LanguageClient_serverCommands = { +\ 'python': ['pyls'] +\ } +nnoremap :call LanguageClient_contextMenu() +nnoremap gh :call LanguageClient_textDocument_hover() +nnoremap gd :call LanguageClient_textDocument_definition() +nnoremap gr :call LanguageClient_textDocument_references() +nnoremap gs :call LanguageClient_textDocument_documentSymbol() +nnoremap :call LanguageClient_textDocument_rename() +nnoremap gf :call LanguageClient_textDocument_formatting() -- cgit v1.2.3 From df60cdea0a5beb2df8046bc85b8789862ee8c040 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 09:50:16 +0200 Subject: ma bureautomation: remove faulty motion detector --- .../bureautomation/automation/10h_timer.nix | 5 +- .../bureautomation/automation/bureau-shutdown.nix | 27 ++++----- .../bureautomation/automation/nachtlicht.nix | 4 +- .../bureautomation/device_tracker/openwrt.nix | 14 +++++ makefu/2configs/bureautomation/devices/users.nix | 17 ++++++ makefu/2configs/bureautomation/hass.nix | 65 ++++++++++++++++------ makefu/2configs/bureautomation/person/team.nix | 29 ++++++++++ makefu/2configs/bureautomation/switch/rfbridge.nix | 17 ++++++ .../bureautomation/switch/tasmota_switch.nix | 2 +- 9 files changed, 144 insertions(+), 36 deletions(-) create mode 100644 makefu/2configs/bureautomation/device_tracker/openwrt.nix create mode 100644 makefu/2configs/bureautomation/devices/users.nix create mode 100644 makefu/2configs/bureautomation/person/team.nix create mode 100644 makefu/2configs/bureautomation/switch/rfbridge.nix diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix index a311d468..d86b4617 100644 --- a/makefu/2configs/bureautomation/automation/10h_timer.nix +++ b/makefu/2configs/bureautomation/automation/10h_timer.nix @@ -2,8 +2,9 @@ { alias = "start Felix 10h"; trigger = { platform = "state"; - entity_id = "binary_sensor.redbutton"; - to = "on"; + entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ]; + from = "not_home"; + to = "home"; }; condition = { condition = "and"; diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 9e657430..1def5f3a 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -1,9 +1,10 @@ [ - { alias = "Turn on Fernseher on movement"; + { alias = "Turn on Fernseher on group home"; trigger = { - platform = "state"; - entity_id = "binary_sensor.motion"; - to = "on"; + condition = "state"; + entity_id = "group.team"; + from = "not_home"; + to = "home"; }; action = { service = "homeassistant.turn_on"; @@ -13,15 +14,15 @@ ]; }; } - { alias = "Turn off Fernseher 10 minutes after last movement"; + { alias = "Turn off Fernseher after last in group left"; trigger = [ { # trigger when movement was detected at the time - platform = "state"; - entity_id = "binary_sensor.motion"; - to = "off"; - for.minutes = 10; + condition = "state"; + entity_id = "group.team"; + from = "home"; + to = "not_home"; } - { # trigger at 20:00 no matter what + { # trigger at 18:00 no matter what # to avoid 'everybody left before 18:00:00' platform = "time"; at = "18:00:00"; @@ -44,10 +45,10 @@ after = "18:00:00"; # weekday = [ "mon" "tue" "wed" "thu" "fri" ]; } - { + { # if anybody is still there condition = "state"; - entity_id = "binary_sensor.motion"; - state = "off"; + entity_id = "group.team"; + state = "not_home"; } ]; }; diff --git a/makefu/2configs/bureautomation/automation/nachtlicht.nix b/makefu/2configs/bureautomation/automation/nachtlicht.nix index 066e9b06..2becd4a3 100644 --- a/makefu/2configs/bureautomation/automation/nachtlicht.nix +++ b/makefu/2configs/bureautomation/automation/nachtlicht.nix @@ -9,7 +9,7 @@ action = { service = "homeassistant.turn_off"; - entity_id = [ "switch.nachtlicht" ]; + entity_id = [ "group.nachtlicht" ]; }; } @@ -37,7 +37,7 @@ action = { service = "homeassistant.turn_on"; - entity_id = [ "switch.nachtlicht" ]; + entity_id = [ "group.nachtlicht" ]; }; } ] diff --git a/makefu/2configs/bureautomation/device_tracker/openwrt.nix b/makefu/2configs/bureautomation/device_tracker/openwrt.nix new file mode 100644 index 00000000..0db9821a --- /dev/null +++ b/makefu/2configs/bureautomation/device_tracker/openwrt.nix @@ -0,0 +1,14 @@ +[ + { platform = "luci"; + name = "router"; + host = "192.168.8.1"; + username = "root"; + password = import ; + interval_seconds = 30; # instead of 12seconds + consider_home = 300; # 5 minutes timeout + new_device_defaults = { + track_new_devices = true; + hide_if_away = false; + }; + } +] diff --git a/makefu/2configs/bureautomation/devices/users.nix b/makefu/2configs/bureautomation/devices/users.nix new file mode 100644 index 00000000..305c0ca8 --- /dev/null +++ b/makefu/2configs/bureautomation/devices/users.nix @@ -0,0 +1,17 @@ +{ + thorsten-phone = { + name = "Thorsten"; + mac = "8c:f5:a3:bc:83:a0"; + track = true; + hide_if_away = true; + }; + felix-laptop = { + name = "Felix"; + mac = "6c:88:14:b4:43:9c"; + track = true; + hide_if_away = true; + }; + # b0:e5:ed:52:ee:43 - honor8 + # 38:94:96:b0:13:c7 - android-4ef03e4f4a14b6b9 + # ac:5f:3e:cc:b8:5e - Galaxy S7 +} diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix index 007d00b0..a104f0c4 100644 --- a/makefu/2configs/bureautomation/hass.nix +++ b/makefu/2configs/bureautomation/hass.nix @@ -1,8 +1,9 @@ { pkgs, lib, ... }: let + kodi-host = "192.168.8.11"; in { networking.firewall.allowedTCPPorts = [ 8123 ]; - + state = [ "/var/lib/hass/known_devices.yaml" ]; services.home-assistant = { enable = true; config = { @@ -33,7 +34,8 @@ in { retain = true; }; }; - switch = (import ./switch/tasmota_switch.nix); + switch = (import ./switch/tasmota_switch.nix) ++ + (import ./switch/rfbridge.nix); light = (import ./light/statuslight.nix) ++ (import ./light/buzzer.nix); timer = { @@ -54,7 +56,12 @@ in { { platform = "kodi"; name = "wbob"; - host = "192.168.8.11"; + host = kodi-host; + } + ]; + media_player = [ + { platform = "kodi"; + host = kodi-host; } ]; script = (import ./script/multi_blink.nix) {inherit lib;}; @@ -70,6 +77,10 @@ in { camera = (import ./camera/verkehrskamera.nix); + # not yet released + #person = + # (import ./person/team.nix ); + frontend = { }; http = { }; conversation = {}; @@ -82,36 +93,55 @@ in { { view = "yes"; entities = [ "group.sensors" + "group.camera" "group.outside" - "group.switches" - "group.automation" - # "group.camera" + "group.team" + "group.nachtlicht" + # "group.switches" ]; }; automation = [ - "timer.felix_10h" - "script.blitz_10s" - "script.buzz_red_led_fast" - "camera.Baumarkt" ]; switches = [ "switch.bauarbeiterlampe" "switch.blitzdings" "switch.fernseher" "switch.feuer" - "switch.nachtlicht" "light.status_felix" "light.status_daniel" "light.buslicht" "light.redbutton_buzzer" ]; - - camera = [ ]; + team = [ + "device_tracker.thorsten_phone" + "device_tracker.felix_phone" + "device_tracker.ecki_tablet" + "device_tracker.daniel_phone" + "device_tracker.carsten_phone" + # "person.thorsten" + # "person.felix" + # "person.ecki" + # "person.daniel" + ]; + camera = [ + "camera.Baumarkt" + "camera.Autobahn_Heilbronn" + "camera.Autobahn_Singen" + ]; + nachtlicht = [ + "switch.nachtlicht_a" + "switch.nachtlicht_b" + "switch.nachtlicht_c" + "switch.nachtlicht_d" + ]; sensors = [ - "binary_sensor.motion" - "binary_sensor.redbutton" + "media_player.kodi" + "script.blitz_10s" + "script.buzz_red_led_fast" + "timer.felix_10h" "sensor.easy2_dht22_humidity" "sensor.easy2_dht22_temperature" + # "binary_sensor.redbutton" ]; outside = [ # "sensor.ditzingen_pm10" @@ -120,8 +150,7 @@ in { "sensor.dark_sky_humidity" # "sensor.dark_sky_pressure" "sensor.dark_sky_hourly_summary" - "camera.Autobahn_Heilbronn" - "camera.Autobahn_Singen" + "device_tracker.router" ]; }; # only for automation @@ -131,7 +160,7 @@ in { automation = (import ./automation/bureau-shutdown.nix) ++ (import ./automation/nachtlicht.nix) ++ (import ./automation/10h_timer.nix); - + device_tracker = (import ./device_tracker/openwrt.nix ); }; }; } diff --git a/makefu/2configs/bureautomation/person/team.nix b/makefu/2configs/bureautomation/person/team.nix new file mode 100644 index 00000000..e18c4219 --- /dev/null +++ b/makefu/2configs/bureautomation/person/team.nix @@ -0,0 +1,29 @@ +[ + { name = "Thorsten"; + id = 1; + device_trackers = [ + "device_tracker.thorsten_phone" + "device_tracker.thorsten_arbeitphone" + ]; + } + { name = "Felix"; + id = 2; + device_trackers = [ + "device_tracker.felix_phone" + "device_tracker.felix_laptop" + ]; + } + { name = "Ecki"; + id = 3; + device_trackers = [ + "device_tracker.ecki_phone" + "device_tracker.ecki_tablet" + ]; + } + { name = "Daniel"; + id = 4; + device_trackers = [ + "device_tracker.daniel_phone" + ]; + } +] diff --git a/makefu/2configs/bureautomation/switch/rfbridge.nix b/makefu/2configs/bureautomation/switch/rfbridge.nix new file mode 100644 index 00000000..1336549a --- /dev/null +++ b/makefu/2configs/bureautomation/switch/rfbridge.nix @@ -0,0 +1,17 @@ +let + topic = "rfbridge"; + bridge = name: payload_on: payload_off: + { platform = "mqtt"; + inherit name payload_on payload_off; + command_topic = "/bam/${topic}/cmnd/rfcode"; + availability_topic = "/bam/${topic}/tele/LWT"; + payload_available= "Online"; + payload_not_available= "Offline"; + }; +in +[ + (bridge "Nachtlicht A" "#414551" "#414554") + (bridge "Nachtlicht B" "#415151" "#415154") + (bridge "Nachtlicht C" "#415451" "#415454") + (bridge "Nachtlicht D" "#41551F" "#415514") +] diff --git a/makefu/2configs/bureautomation/switch/tasmota_switch.nix b/makefu/2configs/bureautomation/switch/tasmota_switch.nix index b00a8e45..eb7b5fb8 100644 --- a/makefu/2configs/bureautomation/switch/tasmota_switch.nix +++ b/makefu/2configs/bureautomation/switch/tasmota_switch.nix @@ -15,5 +15,5 @@ in [ (tasmota_plug "Blitzdings" "plug2") (tasmota_plug "Fernseher" "plug3") (tasmota_plug "Feuer" "plug4") - (tasmota_plug "Nachtlicht" "plug5") + (tasmota_plug "Blaulicht" "plug5") ] -- cgit v1.2.3 From b162f79087cf0d02948a1cd76697e4958fd37e59 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 11:11:30 +0200 Subject: ma 0tests: add router secret --- makefu/0tests/data/secrets/hass/router.nix | 1 + 1 file changed, 1 insertion(+) create mode 100644 makefu/0tests/data/secrets/hass/router.nix diff --git a/makefu/0tests/data/secrets/hass/router.nix b/makefu/0tests/data/secrets/hass/router.nix new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/makefu/0tests/data/secrets/hass/router.nix @@ -0,0 +1 @@ + -- cgit v1.2.3 From 854bd37b06a4bddcf5d71e7c6a2264eaac66c928 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 15:37:35 +0200 Subject: ma pkgs.bento4: rip (upstreamed) init-host: put into configs to still be able to push to NUR --- makefu/2configs/tools/init-host/default.nix | 47 +++++++++++++++++++++++++++++ makefu/5pkgs/bento4/default.nix | 29 ------------------ makefu/5pkgs/default.nix | 2 +- makefu/5pkgs/init-host/default.nix | 47 ----------------------------- 4 files changed, 48 insertions(+), 77 deletions(-) create mode 100644 makefu/2configs/tools/init-host/default.nix delete mode 100644 makefu/5pkgs/bento4/default.nix delete mode 100644 makefu/5pkgs/init-host/default.nix diff --git a/makefu/2configs/tools/init-host/default.nix b/makefu/2configs/tools/init-host/default.nix new file mode 100644 index 00000000..d1d3f719 --- /dev/null +++ b/makefu/2configs/tools/init-host/default.nix @@ -0,0 +1,47 @@ +{ pkgs }: +pkgs.writeDashBin "generate-secrets" '' + set -euf + HOSTNAME="''${1?must provide hostname}" + TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d) + PASSWORD=$(${pkgs.pwgen}/bin/pwgen 25 1) + HASHED_PASSWORD=$(echo $PASSWORD | ${pkgs.hashPassword}/bin/hashPassword -s) > /dev/null + + ${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f $TMPDIR/ssh.id_ed25519 -P "" -C "" >/dev/null + ${pkgs.openssl}/bin/openssl genrsa -out $TMPDIR/retiolum.rsa_key.priv 4096 2>/dev/null > /dev/null + ${pkgs.openssl}/bin/openssl rsa -in $TMPDIR/retiolum.rsa_key.priv -pubout -out $TMPDIR/retiolum.rsa_key.pub 2>/dev/null > /dev/null + cat < $TMPDIR/hashedPasswords.nix + { + root = "$HASHED_PASSWORD"; + } + EOF + + cd $TMPDIR + for x in *; do + ${pkgs.coreutils}/bin/cat $x | secrets insert -m $HOSTNAME/$x > /dev/null + done + echo $PASSWORD | secrets insert -m $HOSTNAME/root > /dev/null + + cat <; + ssh.pubkey = "$(cat $TMPDIR/ssh.id_ed25519.pub)"; + }; + EOF + + rm -rf $TMPDIR +'' + diff --git a/makefu/5pkgs/bento4/default.nix b/makefu/5pkgs/bento4/default.nix deleted file mode 100644 index 6f5f1deb..00000000 --- a/makefu/5pkgs/bento4/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ stdenv, fetchFromGitHub -, cmake -}: -stdenv.mkDerivation rec { - name = "bento4-${version}"; - version = "1.5.1-624"; - - src = fetchFromGitHub { - owner = "axiomatic-systems"; - repo = "Bento4"; - rev = "v${version}"; - sha256 = "1cq6vhrq3n3lc1n454slbc66qdyqam2srxgdhfpyfxbq5c4y06nf"; - }; - - nativeBuildInputs = [ cmake ]; - installPhase = '' - mkdir -p $out/{lib,bin} - find -iname '*.so' -exec mv --target-directory="$out/lib" {} \; - find -maxdepth 1 -executable -type f -exec mv --target-directory="$out/bin" {} \; - ''; - - meta = with stdenv.lib; { - description = "Full-featured MP4 format and MPEG DASH library and tools"; - homepage = http://bento4.com; - license = licenses.gpl3; - maintainers = with maintainers; [ makefu ]; - platforms = with platforms; linux; - }; -} diff --git a/makefu/5pkgs/default.nix b/makefu/5pkgs/default.nix index 8ae41427..1ae10459 100644 --- a/makefu/5pkgs/default.nix +++ b/makefu/5pkgs/default.nix @@ -1,4 +1,4 @@ -self: super: +self: super: with super.lib; with builtins; let # This callPackage will try to detect obsolete overrides. callPackage = path: args: let diff --git a/makefu/5pkgs/init-host/default.nix b/makefu/5pkgs/init-host/default.nix deleted file mode 100644 index d1d3f719..00000000 --- a/makefu/5pkgs/init-host/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ pkgs }: -pkgs.writeDashBin "generate-secrets" '' - set -euf - HOSTNAME="''${1?must provide hostname}" - TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d) - PASSWORD=$(${pkgs.pwgen}/bin/pwgen 25 1) - HASHED_PASSWORD=$(echo $PASSWORD | ${pkgs.hashPassword}/bin/hashPassword -s) > /dev/null - - ${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f $TMPDIR/ssh.id_ed25519 -P "" -C "" >/dev/null - ${pkgs.openssl}/bin/openssl genrsa -out $TMPDIR/retiolum.rsa_key.priv 4096 2>/dev/null > /dev/null - ${pkgs.openssl}/bin/openssl rsa -in $TMPDIR/retiolum.rsa_key.priv -pubout -out $TMPDIR/retiolum.rsa_key.pub 2>/dev/null > /dev/null - cat < $TMPDIR/hashedPasswords.nix - { - root = "$HASHED_PASSWORD"; - } - EOF - - cd $TMPDIR - for x in *; do - ${pkgs.coreutils}/bin/cat $x | secrets insert -m $HOSTNAME/$x > /dev/null - done - echo $PASSWORD | secrets insert -m $HOSTNAME/root > /dev/null - - cat <; - ssh.pubkey = "$(cat $TMPDIR/ssh.id_ed25519.pub)"; - }; - EOF - - rm -rf $TMPDIR -'' - -- cgit v1.2.3 From f22610b839fb2c6535567d921a538f645439c65d Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 15:48:19 +0200 Subject: ma pkgs.targetcli: rip --- makefu/5pkgs/targetcli/default.nix | 64 -------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 makefu/5pkgs/targetcli/default.nix diff --git a/makefu/5pkgs/targetcli/default.nix b/makefu/5pkgs/targetcli/default.nix deleted file mode 100644 index 927c34c5..00000000 --- a/makefu/5pkgs/targetcli/default.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ pkgs, fetchFromGitHub, ... }: -with pkgs.python2Packages; -let - version = "2.1"; - rtslib = buildPythonPackage rec { - pname = "rtslib"; - inherit version; - src = fetchFromGitHub { - owner = "datera"; - repo = "rtslib"; - rev = version; - sha256 = "1d58k9i4xigfqgycyismsqzkz65ssjdri2v9fg0wpica1klyyv22"; - }; - propagatedBuildInputs = [ ipaddr netifaces configobj ]; - }; - configshell = buildPythonPackage rec { - pname = "configshell"; - version = "1.6"; - src = fetchFromGitHub { - owner = "datera"; - repo = "configshell"; - rev = version; - sha256 = "14n7xbcaicsvwajv1aihz727dlkn6zfaqjbnn7mcpns83c2hms7y"; - }; - propagatedBuildInputs = [ pyparsing ]; - }; - - tcm-py = buildPythonPackage rec { - pname = "tcm-py"; - version = "0ac9091c1ff7a52d5435a4f4449e82637142e06e"; - src = fetchFromGitHub { - owner = "datera"; - repo = "lio-utils"; - rev = "0ac9091c1ff7a52d5435a4f4449e82637142e06e"; - sha256 = "0fc922kxvgr7rwg1y875vqvkipcrixmlafsp5g8mipmq90i8zcq0"; - } + "/tcm-py"; - propagatedBuildInputs = [ ]; - }; - - lio-py = buildPythonPackage rec { - pname = "lio-py"; - version = "0ac9091c1ff7a52d5435a4f4449e82637142e06e"; - src = fetchFromGitHub { - owner = "datera"; - repo = "lio-utils"; - rev = "0ac9091c1ff7a52d5435a4f4449e82637142e06e"; - sha256 = "0fc922kxvgr7rwg1y875vqvkipcrixmlafsp5g8mipmq90i8zcq0"; - } + "/lio-py"; - propagatedBuildInputs = [ ]; - }; - -in buildPythonApplication rec { - pname = "targetcli"; - inherit version; - - propagatedBuildInputs = [ rtslib configshell lio-py tcm-py ]; - - src = fetchFromGitHub { - owner = "datera"; - repo = "targetcli"; - rev = version; - sha256 = "10nax7761g93qzky01y3hra8i4s11cgyy9w5w6l8781lj21lgi3d"; - }; -} -- cgit v1.2.3 From 521ddfb835fe430c70312a16466086dcaaef6dc1 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 22:53:57 +0200 Subject: ma bureautomation: fix automation config --- makefu/2configs/bureautomation/automation/bureau-shutdown.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 1def5f3a..28c65721 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -1,7 +1,7 @@ [ { alias = "Turn on Fernseher on group home"; trigger = { - condition = "state"; + platform = "state"; entity_id = "group.team"; from = "not_home"; to = "home"; @@ -17,7 +17,7 @@ { alias = "Turn off Fernseher after last in group left"; trigger = [ { # trigger when movement was detected at the time - condition = "state"; + platform = "state"; entity_id = "group.team"; from = "home"; to = "not_home"; -- cgit v1.2.3 From 197064cdba91649fd2e94e57d4ba54a0a3ea4b85 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 22:54:18 +0200 Subject: ma bureautomation: show switches again --- makefu/2configs/bureautomation/hass.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix index a104f0c4..f3a400ac 100644 --- a/makefu/2configs/bureautomation/hass.nix +++ b/makefu/2configs/bureautomation/hass.nix @@ -97,7 +97,7 @@ in { "group.outside" "group.team" "group.nachtlicht" - # "group.switches" + "group.switches" ]; }; automation = [ @@ -110,7 +110,6 @@ in { "light.status_felix" "light.status_daniel" "light.buslicht" - "light.redbutton_buzzer" ]; team = [ "device_tracker.thorsten_phone" -- cgit v1.2.3 From 5761d563f5db527fb0e82e226efa42d029d31d21 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2019 22:55:24 +0200 Subject: ma bureautomation: use tele/STATE instead of stat/POWER --- makefu/2configs/bureautomation/light/statuslight.nix | 19 ++++++++++--------- .../2configs/bureautomation/switch/tasmota_switch.nix | 5 ++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/makefu/2configs/bureautomation/light/statuslight.nix b/makefu/2configs/bureautomation/light/statuslight.nix index 3a9582f2..0acab728 100644 --- a/makefu/2configs/bureautomation/light/statuslight.nix +++ b/makefu/2configs/bureautomation/light/statuslight.nix @@ -8,20 +8,20 @@ let inherit name; retain = false; qos = 1; - optimistic = false; + #optimistic = true; # state - # TODO: currently broken, will not use the custom state topic - state_topic = "/bam/${topic}/stat/POWER"; command_topic = "/bam/${topic}/cmnd/POWER"; + state_topic = "/bam/${topic}/tele/STATE"; + value_template = "{{ value_json.POWER }}"; availability_topic = "/bam/${topic}/tele/LWT"; - payload_on= "ON"; - payload_off= "OFF"; + payload_on = "ON"; + payload_off = "OFF"; payload_available= "Online"; payload_not_available= "Offline"; # brightness - brightness_state_topic = "/bam/${topic}/stat/Dimmer"; + brightness_state_topic = "/bam/${topic}/tele/STATE"; + brightness_value_template = "{{value_json.Dimmer}}"; brightness_command_topic = "/bam/${topic}/cmnd/Dimmer"; - brightness_value_template = "{{ value_json.Dimmer }}"; brightness_scale = 100; # color rgb_state_topic = "/bam/${topic}/stat/Color"; @@ -29,10 +29,11 @@ let rgb_command_mode = "hex"; rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}"; # effects - effect_state_topic = "/bam/${topic}/stat/Scheme"; + effect_state_topic = "/bam/${topic}/tele/STATE"; + effects_value_template = "{{value_json.Scheme}}"; effect_command_topic = "/bam/${topic}/cmnd/Scheme"; effect_value_template = "{{ value_json.Scheme }}"; - effect_list = [ + effect_list = [ 0 # single color for LED light 1 # start wake up sequence (same as Wakeup) 2 # cycle up through colors using Speed option diff --git a/makefu/2configs/bureautomation/switch/tasmota_switch.nix b/makefu/2configs/bureautomation/switch/tasmota_switch.nix index eb7b5fb8..115bae0c 100644 --- a/makefu/2configs/bureautomation/switch/tasmota_switch.nix +++ b/makefu/2configs/bureautomation/switch/tasmota_switch.nix @@ -2,13 +2,16 @@ let tasmota_plug = name: topic: { platform = "mqtt"; inherit name; - state_topic = "/bam/${topic}/stat/POWER"; + state_topic = "/bam/${topic}/tele/STATE"; + value_template = "{{ value_json.POWER }}"; command_topic = "/bam/${topic}/cmnd/POWER"; availability_topic = "/bam/${topic}/tele/LWT"; payload_on= "ON"; payload_off= "OFF"; payload_available= "Online"; payload_not_available= "Offline"; + retain = false; + qos = 1; }; in [ (tasmota_plug "Bauarbeiterlampe" "plug") -- cgit v1.2.3 From 8172c6074419d9148fcab7b798e87f3168930bd7 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Apr 2019 01:44:29 +0200 Subject: bureautomation: enable telegram bot --- .../bureautomation/automation/10h_timer.nix | 8 ++++++- .../bureautomation/automation/bureau-shutdown.nix | 26 +++++++++++++++------- makefu/2configs/bureautomation/hass.nix | 13 ++++++++++- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix index d86b4617..dd747114 100644 --- a/makefu/2configs/bureautomation/automation/10h_timer.nix +++ b/makefu/2configs/bureautomation/automation/10h_timer.nix @@ -128,7 +128,13 @@ }; action = [ - # TODO: Pushbullet + { + service = "notify.telegrambot"; + data = { + title = "Zu lange Felix!"; + message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!"; + }; + } { service = "homeassistant.turn_on"; entity_id = [ diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 28c65721..c632a9e6 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -28,14 +28,24 @@ at = "18:00:00"; } ]; - action = { - service = "homeassistant.turn_off"; - entity_id = [ - "switch.fernseher" - "switch.feuer" - "light.status_felix" - ]; - }; + action = [ + { + service = "homeassistant.turn_off"; + entity_id = [ + "switch.fernseher" + "switch.feuer" + "light.status_felix" + "light.status_daniel" + ]; + } + { + service = "notify.telegrambot"; + data = { + title = "Bureau Shutdown"; + message = "All devices are turned off due to {{ trigger.platform }} - {{ trigger }}"; + }; + } + ]; condition = { condition = "and"; conditions = [ diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix index f3a400ac..4e5fe7b6 100644 --- a/makefu/2configs/bureautomation/hass.nix +++ b/makefu/2configs/bureautomation/hass.nix @@ -55,9 +55,16 @@ in { notify = [ { platform = "kodi"; - name = "wbob"; + name = "wbob-kodi"; host = kodi-host; } + { + platform = "telegram"; + name = "telegrambot"; + chat_id = builtins.elemAt + (builtins.fromJSON (builtins.readFile + )).allowed_chat_ids 0; + } ]; media_player = [ { platform = "kodi"; @@ -88,6 +95,10 @@ in { logbook = {}; tts = [ { platform = "google";} ]; recorder = {}; + telegram_bot = [ + (builtins.fromJSON + (builtins.readFile )) + ]; group = { default_view = { view = "yes"; -- cgit v1.2.3 From cec7e3124d2ef99f7acf42337ac3c53469c620cf Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Apr 2019 01:47:01 +0200 Subject: ma 0secrets: add telegram-bot.json --- makefu/0tests/data/secrets/hass/telegram-bot.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 makefu/0tests/data/secrets/hass/telegram-bot.json diff --git a/makefu/0tests/data/secrets/hass/telegram-bot.json b/makefu/0tests/data/secrets/hass/telegram-bot.json new file mode 100644 index 00000000..44217793 --- /dev/null +++ b/makefu/0tests/data/secrets/hass/telegram-bot.json @@ -0,0 +1,5 @@ +{ + "platform": "polling", + "api_key": "1:A", + "allowed_chat_ids": [ 0 1 ] +} -- cgit v1.2.3 From 8d3c776baf3b2e35a4cd76c9d33cdecda7122b7f Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Apr 2019 02:02:08 +0200 Subject: ma tools: enable init-host, rambox --- makefu/2configs/tools/all.nix | 1 + makefu/2configs/tools/core-gui.nix | 2 +- makefu/2configs/tools/dev.nix | 13 +++++++++---- makefu/2configs/tools/extra-gui.nix | 1 + makefu/2configs/tools/pcmanfm-extra.nix | 11 +++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 makefu/2configs/tools/pcmanfm-extra.nix diff --git a/makefu/2configs/tools/all.nix b/makefu/2configs/tools/all.nix index b6554e04..6844fdfe 100644 --- a/makefu/2configs/tools/all.nix +++ b/makefu/2configs/tools/all.nix @@ -10,6 +10,7 @@ ./games.nix ./media.nix ./mobility.nix + ./pcmanfm-extra.nix ./scanner-tools.nix ./sec.nix ./sec-gui.nix diff --git a/makefu/2configs/tools/core-gui.nix b/makefu/2configs/tools/core-gui.nix index 582d941a..41bfef27 100644 --- a/makefu/2configs/tools/core-gui.nix +++ b/makefu/2configs/tools/core-gui.nix @@ -6,7 +6,7 @@ chromium feh clipit - firefox + # firefox keepassx pcmanfm evince diff --git a/makefu/2configs/tools/dev.nix b/makefu/2configs/tools/dev.nix index fe25bd49..23da9d57 100644 --- a/makefu/2configs/tools/dev.nix +++ b/makefu/2configs/tools/dev.nix @@ -2,10 +2,15 @@ { users.users.makefu.packages = with pkgs;[ - python3 - python3Packages.pyserial + (python3.withPackages(ps: [ + ps.python-language-server + # the following plugins are optional, they provide type checking, import sorting and code formatting + ps.pyls-mypy ps.pyls-isort ps.pyls-black + ps.virtualenv + ])) picocom - python3Packages.virtualenv + python3.pkgs.pyserial + python3.pkgs.virtualenv # embedded gi flashrom @@ -26,6 +31,6 @@ nix-review # git-related tig - init-host + (pkgs.callPackage ./init-host {}) ]; } diff --git a/makefu/2configs/tools/extra-gui.nix b/makefu/2configs/tools/extra-gui.nix index 3d26cc57..dfb4183d 100644 --- a/makefu/2configs/tools/extra-gui.nix +++ b/makefu/2configs/tools/extra-gui.nix @@ -14,5 +14,6 @@ saleae-logic gitAndTools.gitFull signal-desktop + rambox ]; } diff --git a/makefu/2configs/tools/pcmanfm-extra.nix b/makefu/2configs/tools/pcmanfm-extra.nix new file mode 100644 index 00000000..2d5d20f8 --- /dev/null +++ b/makefu/2configs/tools/pcmanfm-extra.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +{ + users.users.makefu.packages = with pkgs; [ + pcmanfm + lxqt.lxqt-policykit + shared_mime_info + lxmenu-data + ]; + environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.gvfs}/lib/gio/modules" ]; + services.gnome3.gvfs.enable = true; +} -- cgit v1.2.3 From 8f285e407d560dd243b082d756f682fd15379cf4 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Apr 2019 02:03:39 +0200 Subject: ma 0tests: fix router.nix --- makefu/0tests/data/secrets/hass/router.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/0tests/data/secrets/hass/router.nix b/makefu/0tests/data/secrets/hass/router.nix index 8b137891..e16c76df 100644 --- a/makefu/0tests/data/secrets/hass/router.nix +++ b/makefu/0tests/data/secrets/hass/router.nix @@ -1 +1 @@ - +"" -- cgit v1.2.3 From 2f53271af0fda00bdc452c2bc5e569f064f562f6 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Apr 2019 07:50:57 +0200 Subject: ma 0tests: fix telegram-bot json file --- makefu/0tests/data/secrets/hass/telegram-bot.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/0tests/data/secrets/hass/telegram-bot.json b/makefu/0tests/data/secrets/hass/telegram-bot.json index 44217793..1e1857df 100644 --- a/makefu/0tests/data/secrets/hass/telegram-bot.json +++ b/makefu/0tests/data/secrets/hass/telegram-bot.json @@ -1,5 +1,5 @@ { "platform": "polling", "api_key": "1:A", - "allowed_chat_ids": [ 0 1 ] + "allowed_chat_ids": [ 0, 1 ] } -- cgit v1.2.3