summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/default.nix
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/default.nix
parentcab3be8a19d445d3292454099dbc1ca97bca60c5 (diff)
parent8e3cd9fcffc473706a3ebafa5cb80f7a75c29aa5 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs/ham/default.nix')
-rw-r--r--makefu/2configs/ham/default.nix152
1 files changed, 152 insertions, 0 deletions
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;
+ };
+
+}