nixos-config/configs/pepe/home-assistant.nix
2020-04-12 21:05:55 +02:00

178 lines
4 KiB
Nix

{ pkgs, config, lib, ... }:
let unstablePkgs = import <nixpkgs-unstable> { };
in {
imports = [
#./home-assistant/chaospott.nix
#./home-assistant/mpd.nix
#./home-assistant/timer.nix
./home-assistant/kodi.nix
./home-assistant/mqtt.nix
./home-assistant/sonoff.nix
./home-assistant/weather.nix
./home-assistant/workday.nix
./home-assistant/zigbee2mqtt.nix
];
services.homeAssistantConfig = {
# turn on to edit GUI
# lovelace = {};
homeassistant = {
latitude = 51.444847;
longitude = 6.967006;
elevation = 116;
auth_providers = [{
type = "trusted_networks";
trusted_networks =
[ config.module.cluster.services.tinc."private".networkSubnet ];
}];
};
prometheus.namespace = "hass";
automation = [
# todo when ich weis ich bin zuhause
#{
# alias = "Licht and wenn Dunkel";
# trigger = {
# platform = "state";
# entity_id = [ "binary_sensor.night" ];
# from = "off";
# to = "on";
# };
# action = [
# {
# service = "switch.turn_on";
# entity_id = "group.kitchen";
# }
# {
# service = "switch.turn_on";
# entity_id = "group.living_room";
# }
# ];
#}
];
group = {
# rooms
# -----
bed_room = {
name = "Schlafzimmer";
view = false;
};
living_room = {
name = "Wohnzimmer";
view = false;
};
kitchen_room = {
name = "Küche";
view = false;
};
view_rooms = {
name = "Räume";
view = true;
entities = [
"group.all_lights"
"group.bed_room"
"group.living_room"
"group.kitchen_room"
];
};
# overview
# --------
all_sensors = {
name = "Sensor Overview";
control = "hidden";
};
today = {
control = "hidden";
name = "Today";
view = false;
};
view_overview = {
name = "Übersicht";
view = true;
entities = [ "group.today" "group.all_sensors" ];
};
# other stuff
# -----------
tv = {
name = "TV";
view = false;
};
all_lights = {
name = "All Lights";
view = false;
};
unknown = {
control = "hidden";
name = "Not Used";
view = false;
};
};
script.turn_all_off.sequence = [ ];
script.turn_all_on.sequence = [ ];
};
services.home-assistant = {
enable = true;
package = unstablePkgs.home-assistant.override {
python3 = unstablePkgs.python37;
extraPackages = python: [
# todo : check which is still needed
python.netdisco
python.xmltodict
python.mpd2
# for mqtt
python.hbmqtt
python.paho-mqtt
# needed for platform workday
#(python.buildPythonPackage rec {
# pname = "holidays";
# version = "0.9.10";
# src = python.fetchPypi {
# inherit pname version;
# sha256 =
# "9f06d143eb708e8732230260636938f2f57114e94defd8fa2082408e0d422d6f";
# };
# doCheck = false;
# buildInputs = [ pkgs.dateutils ];
# propagatedBuildInputs = [ python."python-dateutil" python."six" ];
# meta = with pkgs.stdenv.lib; {
# homepage = "https://github.com/dr-prodigy/python-holidays";
# license = licenses.mit;
# description = "Generate and work with holidays in Python";
# maintainers = with maintainers; [ mrVanDalo ];
# };
#})
];
};
};
# host nginx setup
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"iot.pepe.private" = {
serverAliases = [ "hass.pepe.private" "home.pepe.private" ];
locations."/" = { proxyPass = "http://pepe.private:8123"; };
};
};
};
}