summaryrefslogtreecommitdiffstats
path: root/lass/2configs/hass/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-04-21 21:50:59 +0200
committermakefu <github@syntax-fehler.de>2020-04-21 21:50:59 +0200
commitc96504d9a0f8f9f5c80c9630906c177ff3667e55 (patch)
tree7b763ca595967bfcc5d8307751091f373fd38e47 /lass/2configs/hass/default.nix
parent4fc2235ab0a8a11ea21965c86e5ba17279384db4 (diff)
parentcabaf519b5970cbe5c1e57832d3bd12da4f47371 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/hass/default.nix')
-rw-r--r--lass/2configs/hass/default.nix86
1 files changed, 86 insertions, 0 deletions
diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix
new file mode 100644
index 000000000..ef9361102
--- /dev/null
+++ b/lass/2configs/hass/default.nix
@@ -0,0 +1,86 @@
+{ config, lib, pkgs, ... }:
+{
+ imports = [
+ ./zigbee.nix
+ ./rooms/bett.nix
+ ];
+
+ krebs.iptables.tables.filter.INPUT.rules = [
+ { predicate = "-i int0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
+ { predicate = "-i docker0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
+ { predicate = "-i int0 -p tcp --dport 8123"; target = "ACCEPT"; } # hass
+ { predicate = "-i retiolum -p tcp --dport 8123"; target = "ACCEPT"; } # hass
+ ];
+
+ services.home-assistant = {
+ enable = true;
+ package = pkgs.home-assistant.override {
+ # extraComponents = [ "hue" ];
+ };
+ configWritable = true;
+ };
+
+ lass.hass.config = let
+ tasmota_s20 = name: topic: {
+ platform = "mqtt";
+ inherit name;
+ state_topic = "stat/${topic}/POWER";
+ command_topic = "cmnd/${topic}/POWER";
+ payload_on = "ON";
+ payload_off = "OFF";
+ };
+ in {
+ homeassistant = {
+ name = "Home";
+ time_zone = "Europe/Berlin";
+ latitude = "48.7687";
+ longitude = "9.2478";
+ elevation = 247;
+ };
+ config = {};
+ sun.elevation = 66;
+ discovery = {};
+ frontend = {};
+ mqtt = {
+ broker = "localhost";
+ port = 1883;
+ client_id = "home-assistant";
+ username = "gg23";
+ password = "gg23-mqtt";
+ keepalive = 60;
+ protocol = 3.1;
+
+ discovery = true;
+ birth_message = {
+ topic = "/hass/status";
+ payload = "online";
+ };
+ will_message = {
+ topic = "/hass/status";
+ payload = "offline";
+ };
+ };
+ sensor = [
+ ];
+ switch = [
+ (tasmota_s20 "TV" "tv")
+ (tasmota_s20 "Drucker Strom" "drucker")
+ (tasmota_s20 "Waschmaschine" "wasch")
+ (tasmota_s20 "Stereo Anlage" "stereo")
+ ];
+ mobile_app = {};
+ };
+
+ services.mosquitto = {
+ enable = true;
+ host = "0.0.0.0";
+ allowAnonymous = false;
+ checkPasswords = true;
+ users.gg23 = {
+ password = "gg23-mqtt";
+ acl = [ "topic readwrite #" ];
+ };
+ };
+
+ environment.systemPackages = [ pkgs.mosquitto ];
+}