228 lines
5.1 KiB
Nix
228 lines
5.1 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
let
|
|
unstablePkgs = import <nixpkgs-unstable> {};
|
|
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 = {
|
|
|
|
# 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";
|
|
# }
|
|
# ];
|
|
#}
|
|
|
|
#{
|
|
# 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;
|
|
};
|
|
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;
|
|
};
|
|
|
|
view_rooms = {
|
|
name = "Räume";
|
|
view = true;
|
|
entities = [
|
|
"group.all_lights"
|
|
"group.bed_room"
|
|
"group.living_room"
|
|
"group.kitchen"
|
|
"group.tv"
|
|
];
|
|
};
|
|
|
|
view_overview = {
|
|
name = "Übersicht";
|
|
view = true;
|
|
entities = [ "group.today" ];
|
|
};
|
|
|
|
};
|
|
|
|
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" ];
|
|
}
|
|
];
|
|
|
|
};
|
|
|
|
|
|
services.home-assistant = {
|
|
enable = true;
|
|
package = unstablePkgs.home-assistant.override{
|
|
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
|
|
(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 ];
|
|
};
|
|
|
|
})
|
|
];
|
|
};
|
|
|
|
};
|
|
|
|
}
|