summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/homeautomation/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-09-18 02:16:12 +0200
committermakefu <github@syntax-fehler.de>2018-09-18 02:16:12 +0200
commit884c73d2c0542a303a8af93e522fc17e3578e622 (patch)
treefb011f6b60333e8cda0e963fea29124a0ef22f19 /makefu/2configs/deployment/homeautomation/default.nix
parent20eebf0ca30f7fabf5cd818a81a9e60c487b0962 (diff)
ma homeautomation: add mqtt broker with acl
Diffstat (limited to 'makefu/2configs/deployment/homeautomation/default.nix')
-rw-r--r--makefu/2configs/deployment/homeautomation/default.nix79
1 files changed, 78 insertions, 1 deletions
diff --git a/makefu/2configs/deployment/homeautomation/default.nix b/makefu/2configs/deployment/homeautomation/default.nix
index bd87193e3..f2a3b36e2 100644
--- a/makefu/2configs/deployment/homeautomation/default.nix
+++ b/makefu/2configs/deployment/homeautomation/default.nix
@@ -1,6 +1,41 @@
{ pkgs, config, ... }:
+
+# Ideas:
+## wake-on-lan server
+##
let
firetv = "192.168.1.238";
+ tasmota_plug = name: topic:
+ { platform = "mqtt";
+ inherit name;
+ state_topic = "/ham/${topic}/stat/POWER1";
+ command_topic = "/ham/${topic}/cmnd/POWER1";
+ availability_topic = "/ham/${topic}/tele/LWT";
+ payload_on= "ON";
+ payload_off= "OFF";
+ payload_available= "Online";
+ payload_not_available= "Offline";
+ };
+ tasmota_bme = name: topic:
+ [ { platform = "mqtt";
+ name = "${name} Temperatur";
+ state_topic = "/ham/${topic}/tele/SENSOR";
+ value_template = "{{ value_json.BME280.Temperature }}";
+ unit_of_measurement = "°C";
+ }
+ { platform = "mqtt";
+ name = "${name} Luftfeuchtigkeit";
+ state_topic = "/ham/${topic}/tele/SENSOR";
+ value_template = "{{ value_json.BME280.Humidity }}";
+ unit_of_measurement = "%";
+ }
+ { platform = "mqtt";
+ name = "${name} Luftdruck";
+ state_topic = "/ham/${topic}/tele/SENSOR";
+ value_template = "{{ value_json.BME280.Pressure }}";
+ unit_of_measurement = "hPa";
+ }
+ ];
in {
imports = [
./mqtt.nix
@@ -21,7 +56,17 @@ in {
name = "Home"; time_zone = "Europe/Berlin";
latitude = "48.7687";
longitude = "9.2478";
+ elevation = 247;
};
+ discovery = {};
+ conversation = {};
+ history = {};
+ logbook = {};
+ tts = [
+ { platform = "google";}
+ ];
+ sun.elevation = 247;
+ recorder = {};
media_player = [
{ platform = "kodi";
host = firetv;
@@ -30,7 +75,31 @@ in {
# assumes python-firetv running
}
];
+ mqtt = {
+ broker = "localhost";
+ port = 1883;
+ client_id = "home-assistant";
+ username = "hass";
+ password = builtins.readFile <secrets/mqtt/hass>;
+ keepalive = 60;
+ protocol = 3.1;
+ birth_message = {
+ topic = "/ham/hass/tele/LWT";
+ payload = "Online";
+ qos = 1;
+ retain = true;
+ };
+ will_message = {
+ topic = "/ham/hass/tele/LWT";
+ payload = "Offline";
+ qos = 1;
+ retain = true;
+ };
+ };
sensor = [
+ { platform = "speedtest";
+ monitored_conditions = [ "ping" "download" "upload" ];
+ }
{ platform = "luftdaten";
name = "Ditzingen";
sensorid = "663";
@@ -54,9 +123,17 @@ in {
seconds = 0;
};
}
- ];
+ ] ++ (tasmota_bme "Schlafzimmer" "schlafzimmer");
frontend = { };
+ #group = [
+ # { default_view = { view = "yes"; entities = [
+ # "sensor.luftdaten"
+ # ]}
+ #];
http = { };
+ switch = [
+ (tasmota_plug "Lichterkette Schlafzimmer" "schlafzimmer")
+ ];
};
enable = true;
#configDir = "/var/lib/hass";