This repository has no description
3.4 kB
126 lines
1{ config, lib, pkgs, ... }:
2with import ./lib.nix { inherit lib; };
3let
4 dwdwfsapi = pkgs.python3Packages.buildPythonPackage rec {
5 pname = "dwdwfsapi";
6 version = "1.0.3";
7
8 src = pkgs.python3Packages.fetchPypi {
9 inherit pname version;
10 sha256 = "0fcv79xiq0qr4kivhd68iqpgrsjc7djxqs2h543pyr0sdgb5nz9x";
11 };
12
13 buildInputs = with pkgs.python3Packages; [
14 requests ciso8601
15 ];
16
17 # LC_ALL = "en_US.UTF-8";
18 };
19
20in {
21 imports = [
22 ./pyscript
23 ./zigbee.nix
24 ./rooms/bett.nix
25 ./rooms/essen.nix
26 ./rooms/nass.nix
27 ];
28
29 krebs.iptables.tables.filter.INPUT.rules = [
30 { predicate = "-i int0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
31 { predicate = "-i docker0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
32 { predicate = "-i int0 -p tcp --dport 8123"; target = "ACCEPT"; } # hass
33 { predicate = "-i int0 -p tcp --dport 1337"; target = "ACCEPT"; } # zigbee2mqtt frontend
34 { predicate = "-i retiolum -p tcp --dport 8123"; target = "ACCEPT"; } # hass
35 { predicate = "-i retiolum -p tcp --dport 1337"; target = "ACCEPT"; } # zigbee2mqtt frontend
36 { predicate = "-i wiregrill -p tcp --dport 8123"; target = "ACCEPT"; } # hass
37 ];
38
39
40 services.home-assistant = {
41 enable = true;
42 configWritable = true;
43 lovelaceConfigWritable = true;
44 config = let
45 tasmota = name: topic: {
46 inherit name;
47 state_topic = "stat/${topic}/POWER";
48 command_topic = "cmnd/${topic}/POWER";
49 payload_on = "ON";
50 payload_off = "OFF";
51 };
52 in {
53 homeassistant = {
54 name = "Home";
55 time_zone = "Europe/Berlin";
56 latitude = "52.46187";
57 longitude = "13.41489";
58 elevation = 90;
59 unit_system = "metric";
60 # customize = friendly_names;
61 };
62 config = {};
63 sun.elevation = 66;
64 shopping_list = {};
65 discovery = {};
66 frontend = {};
67 http = {};
68 # mqtt = {
69 # broker = "localhost";
70 # port = 1883;
71 # client_id = "home-assistant";
72 # username = "gg23";
73 # password = "gg23-mqtt";
74 # keepalive = 60;
75 # protocol = 3.1;
76
77 # discovery = true;
78 # birth_message = {
79 # topic = "/hass/status";
80 # payload = "online";
81 # };
82 # will_message = {
83 # topic = "/hass/status";
84 # payload = "offline";
85 # };
86 # };
87 sensor = [
88 {
89 platform = "dwd_weather_warnings";
90 region_name = "Berlin";
91 }
92 ];
93 mqtt.switch = [
94 (tasmota "TV" "tv")
95 (tasmota "Drucker Strom" "drucker")
96 (tasmota "Waschmaschine" "wasch")
97 (tasmota "Stereo Anlage" "stereo")
98 (tasmota "Wohnzimmer Lampe" "wohn_lampe")
99 ];
100 mobile_app = {};
101 weather = [
102 {
103 platform = "openweathermap";
104 api_key = "XXX"; # TODO put into secrets
105 }
106 ];
107 system_health = {};
108 history = {};
109 shopping_list = {};
110 media_player = {
111 platform = "snapcast";
112 host = "127.0.0.1";
113 };
114 };
115 };
116
117 services.mosquitto = {
118 enable = true;
119 listeners = [{
120 acl = [ ];
121 users.gg23 = { acl = [ "readwrite #" ]; password = "gg23-mqtt"; };
122 }];
123 };
124
125 environment.systemPackages = [ pkgs.mosquitto ];
126}