2019-10-24 02:20:38 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
2019-12-20 05:54:26 +01:00
|
|
|
let unstablePkgs = import <nixpkgs-unstable> { };
|
2019-10-24 02:20:38 +02:00
|
|
|
in {
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
./home-assistant/chaospott.nix
|
|
|
|
./home-assistant/holiday.nix
|
|
|
|
./home-assistant/mpd.nix
|
|
|
|
./home-assistant/sonoff.nix
|
|
|
|
./home-assistant/mqtt.nix
|
|
|
|
./home-assistant/dayOfWeek.nix
|
|
|
|
./home-assistant/timer.nix
|
|
|
|
./home-assistant/kodi.nix
|
|
|
|
./home-assistant/zigbee2mqtt.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
services.homeAssistantConfig = {
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
# turn on to edit GUI
|
|
|
|
# lovelace = {};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
homeassistant = {
|
|
|
|
latitude = 51.444847;
|
|
|
|
longitude = 6.967006;
|
|
|
|
elevation = 116;
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
auth_providers = [{
|
|
|
|
type = "trusted_networks";
|
|
|
|
trusted_networks =
|
|
|
|
[ config.module.cluster.services.tinc."private".networkSubnet ];
|
|
|
|
}];
|
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
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";
|
|
|
|
# }
|
|
|
|
# ];
|
|
|
|
#}
|
|
|
|
|
|
|
|
#{
|
|
|
|
# alias = "Küchen Sensor An";
|
|
|
|
# trigger = {
|
|
|
|
# platform = "state";
|
|
|
|
# entity_id = [ "binary_sensor.motion_1" ];
|
|
|
|
# to = "on";
|
|
|
|
# };
|
|
|
|
# action = {
|
|
|
|
# service = "switch.turn_on";
|
|
|
|
# entity_id = "group.kitchen";
|
|
|
|
# };
|
|
|
|
#}
|
|
|
|
|
|
|
|
#{
|
|
|
|
# alias = "Küchen Sensor aus";
|
|
|
|
# trigger = {
|
|
|
|
# platform = "state";
|
|
|
|
# entity_id = [ "binary_sensor.motion_1" ];
|
|
|
|
# to = "off";
|
|
|
|
# for = "00:00:25";
|
|
|
|
# };
|
|
|
|
# action = {
|
|
|
|
# service = "switch.turn_off";
|
|
|
|
# entity_id = "group.kitchen";
|
|
|
|
# };
|
|
|
|
#}
|
|
|
|
];
|
|
|
|
|
|
|
|
group = {
|
|
|
|
bed_room = {
|
|
|
|
name = "Schlafzimmer";
|
|
|
|
view = false;
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
2019-12-20 05:54:26 +01:00
|
|
|
tv = {
|
|
|
|
name = "TV";
|
|
|
|
view = false;
|
|
|
|
};
|
|
|
|
living_room = {
|
|
|
|
name = "Wohnzimmer";
|
|
|
|
view = false;
|
|
|
|
};
|
|
|
|
kitchen = {
|
|
|
|
name = "Küche";
|
|
|
|
view = false;
|
|
|
|
};
|
|
|
|
today = {
|
|
|
|
control = "hidden";
|
|
|
|
name = "Today";
|
|
|
|
view = false;
|
|
|
|
entities = [ "sensor.weather_temperature" "sun.sun" ];
|
|
|
|
};
|
|
|
|
all_lights = {
|
|
|
|
name = "All Lights";
|
|
|
|
view = false;
|
|
|
|
};
|
|
|
|
unknown = {
|
|
|
|
control = "hidden";
|
|
|
|
name = "Not Used";
|
|
|
|
view = false;
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
view_rooms = {
|
|
|
|
name = "Räume";
|
|
|
|
view = true;
|
|
|
|
entities = [
|
|
|
|
"group.all_lights"
|
|
|
|
"group.bed_room"
|
|
|
|
"group.living_room"
|
|
|
|
"group.kitchen"
|
|
|
|
"group.tv"
|
|
|
|
];
|
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
view_overview = {
|
|
|
|
name = "Übersicht";
|
|
|
|
view = true;
|
|
|
|
entities = [ "group.today" ];
|
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
sun = { };
|
|
|
|
|
|
|
|
script.turn_all_off.sequence = [ ];
|
|
|
|
|
|
|
|
script.turn_all_on.sequence = [ ];
|
|
|
|
|
|
|
|
sensor = [
|
|
|
|
# Weather prediction
|
|
|
|
{
|
|
|
|
platform = "zamg";
|
|
|
|
name = "Weather";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
# todo: add holidays package to home-assiatnt
|
|
|
|
binary_sensor = [
|
|
|
|
{
|
|
|
|
name = "before_workday";
|
|
|
|
platform = "workday";
|
|
|
|
country = "DE";
|
|
|
|
province = "NW";
|
|
|
|
workdays = [ "mon" "tue" "wed" "thu" "fri" ];
|
|
|
|
days_offset = 1;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "workday";
|
|
|
|
platform = "workday";
|
|
|
|
country = "DE";
|
|
|
|
province = "NW";
|
|
|
|
workdays = [ "mon" "tue" "wed" "thu" "fri" ];
|
|
|
|
}
|
|
|
|
];
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
services.home-assistant = {
|
|
|
|
enable = true;
|
2019-12-20 05:54:26 +01:00
|
|
|
package = unstablePkgs.home-assistant.override {
|
2019-10-24 02:20:38 +02:00
|
|
|
python3 = unstablePkgs.python36;
|
|
|
|
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
|
2019-12-20 05:54:26 +01:00
|
|
|
(python.buildPythonPackage rec {
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
pname = "holidays";
|
|
|
|
version = "0.9.10";
|
|
|
|
|
|
|
|
src = python.fetchPypi {
|
|
|
|
inherit pname version;
|
2019-12-20 05:54:26 +01:00
|
|
|
sha256 =
|
|
|
|
"9f06d143eb708e8732230260636938f2f57114e94defd8fa2082408e0d422d6f";
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
buildInputs = [ pkgs.dateutils ];
|
2019-12-20 05:54:26 +01:00
|
|
|
propagatedBuildInputs = [ python."python-dateutil" python."six" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|