Merge remote-tracking branch 'gum/master'

This commit is contained in:
lassulus 2019-04-08 17:13:47 +02:00
commit 8df36824c3
26 changed files with 277 additions and 153 deletions

View File

@ -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

View File

@ -0,0 +1 @@
""

View File

@ -0,0 +1,5 @@
{
"platform": "polling",
"api_key": "1:A",
"allowed_chat_ids": [ 0, 1 ]
}

View File

@ -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";
@ -127,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 = [

View File

@ -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";
entity_id = "group.team";
from = "not_home";
to = "home";
};
action = {
service = "homeassistant.turn_on";
@ -13,28 +14,38 @@
];
};
}
{ 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;
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";
}
];
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 = [
@ -44,10 +55,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";
}
];
};

View File

@ -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" ];
};
}
]

View File

@ -0,0 +1,14 @@
[
{ platform = "luci";
name = "router";
host = "192.168.8.1";
username = "root";
password = import <secrets/hass/router.nix>;
interval_seconds = 30; # instead of 12seconds
consider_home = 300; # 5 minutes timeout
new_device_defaults = {
track_new_devices = true;
hide_if_away = false;
};
}
]

View File

@ -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
}

View File

@ -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 = {
@ -53,8 +55,20 @@ in {
notify = [
{
platform = "kodi";
name = "wbob";
host = "192.168.8.11";
name = "wbob-kodi";
host = kodi-host;
}
{
platform = "telegram";
name = "telegrambot";
chat_id = builtins.elemAt
(builtins.fromJSON (builtins.readFile
<secrets/hass/telegram-bot.json>)).allowed_chat_ids 0;
}
];
media_player = [
{ platform = "kodi";
host = kodi-host;
}
];
script = (import ./script/multi_blink.nix) {inherit lib;};
@ -70,6 +84,10 @@ in {
camera =
(import ./camera/verkehrskamera.nix);
# not yet released
#person =
# (import ./person/team.nix );
frontend = { };
http = { };
conversation = {};
@ -77,41 +95,63 @@ in {
logbook = {};
tts = [ { platform = "google";} ];
recorder = {};
telegram_bot = [
(builtins.fromJSON
(builtins.readFile <secrets/hass/telegram-bot.json>))
];
group =
{ default_view =
{ view = "yes";
entities = [
"group.sensors"
"group.camera"
"group.outside"
"group.team"
"group.nachtlicht"
"group.switches"
"group.automation"
# "group.camera"
];
};
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 +160,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 +170,7 @@ in {
automation = (import ./automation/bureau-shutdown.nix) ++
(import ./automation/nachtlicht.nix) ++
(import ./automation/10h_timer.nix);
device_tracker = (import ./device_tracker/openwrt.nix );
};
};
}

View File

@ -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

View File

@ -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"
];
}
]

View File

@ -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")
]

View File

@ -2,18 +2,21 @@ 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")
(tasmota_plug "Blitzdings" "plug2")
(tasmota_plug "Fernseher" "plug3")
(tasmota_plug "Feuer" "plug4")
(tasmota_plug "Nachtlicht" "plug5")
(tasmota_plug "Blaulicht" "plug5")
]

View File

@ -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\$"; }

View File

@ -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 <F6> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> gh :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
nnoremap <silent> gr :call LanguageClient_textDocument_references()<CR>
nnoremap <silent> gs :call LanguageClient_textDocument_documentSymbol()<CR>
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
nnoremap <silent> gf :call LanguageClient_textDocument_formatting()<CR>

View File

@ -10,6 +10,7 @@
./games.nix
./media.nix
./mobility.nix
./pcmanfm-extra.nix
./scanner-tools.nix
./sec.nix
./sec-gui.nix

View File

@ -6,7 +6,7 @@
chromium
feh
clipit
firefox
# firefox
keepassx
pcmanfm
evince

View File

@ -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 {})
];
}

View File

@ -14,5 +14,6 @@
saleae-logic
gitAndTools.gitFull
signal-desktop
rambox
];
}

View File

@ -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;
}

View File

@ -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;
};
}

View File

@ -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

View File

@ -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 ];
}

View File

@ -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 ];
};
}

View File

@ -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";
};
}