summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/bureautomation')
-rw-r--r--makefu/2configs/bureautomation/default.nix14
-rw-r--r--makefu/2configs/bureautomation/device_tracker/openwrt.nix3
-rw-r--r--makefu/2configs/bureautomation/dwd_pollen.nix32
-rw-r--r--makefu/2configs/bureautomation/gtts-token.nix27
-rw-r--r--makefu/2configs/bureautomation/hass.nix43
-rw-r--r--makefu/2configs/bureautomation/sensor/pollen.nix7
6 files changed, 113 insertions, 13 deletions
diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix
index 1782becd8..56c845744 100644
--- a/makefu/2configs/bureautomation/default.nix
+++ b/makefu/2configs/bureautomation/default.nix
@@ -24,22 +24,20 @@ in {
./ota.nix
];
services.logstash = {
- package = pkgs.logstash5;
+ package = pkgs.logstash7;
+ plugins = [ pkgs.logstash-output-exec ];
enable = true;
inputConfig = ''
http {
port => ${toString port}
host => "127.0.0.1"
+ type => "schlechteluft"
}
'';
- filterConfig = ''
- '';
outputConfig = ''
- stdout { codec => json }
- exec { command => "${runit} '%{ruleName}' '%{state}'" }
- '';
- extraSettings = ''
- path.plugins: [ "${pkgs.logstash-output-exec}" ]
+ if [type] == "schlechteluft" {
+ exec { command => "${runit} '%{ruleName}' '%{state}'" }
+ }
'';
};
}
diff --git a/makefu/2configs/bureautomation/device_tracker/openwrt.nix b/makefu/2configs/bureautomation/device_tracker/openwrt.nix
index 0db9821a1..d32eab60f 100644
--- a/makefu/2configs/bureautomation/device_tracker/openwrt.nix
+++ b/makefu/2configs/bureautomation/device_tracker/openwrt.nix
@@ -1,3 +1,6 @@
+# requires `opkg install luci-mod-rpc` on router
+# see https://www.home-assistant.io/components/luci/
+
[
{ platform = "luci";
name = "router";
diff --git a/makefu/2configs/bureautomation/dwd_pollen.nix b/makefu/2configs/bureautomation/dwd_pollen.nix
new file mode 100644
index 000000000..39d9c3069
--- /dev/null
+++ b/makefu/2configs/bureautomation/dwd_pollen.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, python
+, voluptuous
+}:
+
+buildPythonPackage rec {
+ format = "other";
+ pname = "dwd_pollen";
+ version = "0.1";
+
+ src = fetchFromGitHub {
+ owner = "marcschumacher";
+ repo = "dwd_pollen";
+ rev = version;
+ sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
+ };
+ propagatedBuildInputs = [
+ voluptuous
+ ];
+ installPhase = ''
+ install -D -t $out/${python.sitePackages}/homeassistant/components/sensor/dwd_pollen *
+ '';
+
+ meta = with lib; {
+ description = "Home Assistant component to retrieve Pollen data from DWD (Germany)";
+ homepage = https://github.com/marcschumacher/dwd_pollen;
+ license = licenses.mit;
+ maintainers = [ maintainers.makefu ];
+ };
+}
diff --git a/makefu/2configs/bureautomation/gtts-token.nix b/makefu/2configs/bureautomation/gtts-token.nix
new file mode 100644
index 000000000..69640f03d
--- /dev/null
+++ b/makefu/2configs/bureautomation/gtts-token.nix
@@ -0,0 +1,27 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, requests
+}:
+
+buildPythonPackage rec {
+ pname = "gtts-token";
+ version = "1.1.3";
+
+ src = fetchPypi {
+ pname = "gTTS-token";
+ inherit version;
+ sha256 = "9d6819a85b813f235397ef931ad4b680f03d843c9b2a9e74dd95175a4bc012c5";
+ };
+
+ propagatedBuildInputs = [
+ requests
+ ];
+
+ meta = with lib; {
+ description = "Calculates a token to run the Google Translate text to speech";
+ homepage = https://github.com/boudewijn26/gTTS-token;
+ license = licenses.mit;
+ # maintainers = [ maintainers. ];
+ };
+}
diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix
index ace1d10ce..ed9cb0905 100644
--- a/makefu/2configs/bureautomation/hass.nix
+++ b/makefu/2configs/bureautomation/hass.nix
@@ -1,12 +1,32 @@
-{ pkgs, lib, ... }:
+{ config, pkgs, lib, ... }:
let
kodi-host = "192.168.8.11";
+
in {
networking.firewall.allowedTCPPorts = [ 8123 ];
state = [ "/var/lib/hass/known_devices.yaml" ];
- services.home-assistant = {
+ services.home-assistant = let
+ dwd_pollen = pkgs.fetchFromGitHub {
+ owner = "marcschumacher";
+ repo = "dwd_pollen";
+ rev = "0.1";
+ sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
+ };
+ in {
enable = true;
- package = pkgs.home-assistant.override { python3 = pkgs.python36; };
+ package = (pkgs.home-assistant.overrideAttrs (old: {
+ # TODO: find correct python package
+ postInstall = ''
+ cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen
+ '';
+ })).override {
+ extraPackages = ps: with ps; [
+ pkgs.pico2wave
+ python-forecastio jsonrpc-async jsonrpc-websocket
+ (callPackage ./gtts-token.nix { })
+ ];
+ };
+ autoExtraComponents = true;
config = {
homeassistant = {
name = "Bureautomation";
@@ -84,6 +104,7 @@ in {
(import ./binary_sensor/motion.nix);
sensor =
+ (import ./sensor/pollen.nix) ++
(import ./sensor/espeasy.nix) ++
((import ./sensor/outside.nix) {inherit lib;}) ++
(import ./sensor/influxdb.nix) ++
@@ -99,6 +120,7 @@ in {
frontend = { };
http = {
# TODO: https://github.com/home-assistant/home-assistant/issues/16149
+ base_url = "http://192.168.8.11:8123";
api_password = "sistemas";
trusted_networks = [
"127.0.0.1/32"
@@ -110,7 +132,18 @@ in {
conversation = {};
history = {};
logbook = {};
- tts = [ { platform = "google";} ];
+ tts = [
+ { platform = "google";
+ language = "de";
+ }
+ { platform = "voicerss";
+ api_key = builtins.readFile <secrets/hass/voicerss.apikey>;
+ language = "de-de";
+ }
+ { platform = "picotts";
+ language = "de-DE";
+ }
+ ];
recorder = {};
sun = {};
telegram_bot = [
@@ -147,6 +180,7 @@ in {
"device_tracker.daniel_phone"
"device_tracker.carsten_phone"
"device_tracker.thierry_phone"
+ "device_tracker.frank_phone"
# "person.thorsten"
# "person.felix"
# "person.ecki"
@@ -181,7 +215,6 @@ in {
"sensor.dark_sky_uv_index"
# "sensor.dark_sky_pressure"
"sensor.dark_sky_hourly_summary"
- "device_tracker.router"
];
};
# only for automation
diff --git a/makefu/2configs/bureautomation/sensor/pollen.nix b/makefu/2configs/bureautomation/sensor/pollen.nix
new file mode 100644
index 000000000..506dbf123
--- /dev/null
+++ b/makefu/2configs/bureautomation/sensor/pollen.nix
@@ -0,0 +1,7 @@
+[ {
+ platform = "dwd_pollen";
+ partsregion_ids = [
+ 112
+ ];
+}
+]