2018-09-13 20:29:29 +00:00
|
|
|
{ pkgs, config, ... }:
|
2018-09-18 00:16:12 +00:00
|
|
|
|
|
|
|
# Ideas:
|
|
|
|
## wake-on-lan server
|
|
|
|
##
|
2018-09-13 20:29:29 +00:00
|
|
|
let
|
|
|
|
firetv = "192.168.1.238";
|
2018-09-18 00:16:12 +00:00
|
|
|
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";
|
|
|
|
}
|
|
|
|
];
|
2018-09-13 20:29:29 +00:00
|
|
|
in {
|
2018-09-17 19:52:41 +00:00
|
|
|
imports = [
|
|
|
|
./mqtt.nix
|
|
|
|
];
|
2018-09-13 20:29:29 +00:00
|
|
|
systemd.services.firetv = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
User = "nobody";
|
|
|
|
ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
nixpkgs.config.permittedInsecurePackages = [
|
|
|
|
"homeassistant-0.65.5"
|
|
|
|
];
|
|
|
|
services.home-assistant = {
|
|
|
|
config = {
|
|
|
|
homeassistant = {
|
|
|
|
name = "Home"; time_zone = "Europe/Berlin";
|
|
|
|
latitude = "48.7687";
|
|
|
|
longitude = "9.2478";
|
2018-09-18 00:16:12 +00:00
|
|
|
elevation = 247;
|
2018-09-13 20:29:29 +00:00
|
|
|
};
|
2018-09-18 00:16:12 +00:00
|
|
|
discovery = {};
|
|
|
|
conversation = {};
|
|
|
|
history = {};
|
|
|
|
logbook = {};
|
|
|
|
tts = [
|
|
|
|
{ platform = "google";}
|
|
|
|
];
|
|
|
|
sun.elevation = 247;
|
|
|
|
recorder = {};
|
2018-09-13 20:29:29 +00:00
|
|
|
media_player = [
|
|
|
|
{ platform = "kodi";
|
|
|
|
host = firetv;
|
|
|
|
}
|
|
|
|
{ platform = "firetv";
|
|
|
|
# assumes python-firetv running
|
|
|
|
}
|
|
|
|
];
|
2018-09-18 00:16:12 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
2018-09-13 20:29:29 +00:00
|
|
|
sensor = [
|
2018-09-18 00:16:12 +00:00
|
|
|
{ platform = "speedtest";
|
|
|
|
monitored_conditions = [ "ping" "download" "upload" ];
|
|
|
|
}
|
2018-09-13 20:29:29 +00:00
|
|
|
{ platform = "luftdaten";
|
|
|
|
name = "Ditzingen";
|
|
|
|
sensorid = "663";
|
|
|
|
monitored_conditions = [ "P1" "P2" ];
|
|
|
|
}
|
|
|
|
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
|
|
|
|
{ platform = "darksky";
|
|
|
|
api_key = "c73619e6ea79e553a585be06aacf3679";
|
|
|
|
language = "de";
|
|
|
|
monitored_conditions = [ "summary" "icon"
|
|
|
|
"nearest_storm_distance" "precip_probability"
|
|
|
|
"precip_intensity"
|
|
|
|
"temperature" # "temperature_high" "temperature_low"
|
|
|
|
"hourly_summary"
|
|
|
|
"uv_index" ];
|
|
|
|
units = "si" ;
|
|
|
|
update_interval = {
|
|
|
|
days = 0;
|
|
|
|
hours = 0;
|
|
|
|
minutes = 10;
|
|
|
|
seconds = 0;
|
|
|
|
};
|
|
|
|
}
|
2018-09-18 00:16:12 +00:00
|
|
|
] ++ (tasmota_bme "Schlafzimmer" "schlafzimmer");
|
2018-09-13 20:29:29 +00:00
|
|
|
frontend = { };
|
2018-09-18 00:16:12 +00:00
|
|
|
#group = [
|
|
|
|
# { default_view = { view = "yes"; entities = [
|
|
|
|
# "sensor.luftdaten"
|
|
|
|
# ]}
|
|
|
|
#];
|
2018-09-13 20:29:29 +00:00
|
|
|
http = { };
|
2018-09-18 00:16:12 +00:00
|
|
|
switch = [
|
|
|
|
(tasmota_plug "Lichterkette Schlafzimmer" "schlafzimmer")
|
|
|
|
];
|
2018-09-13 20:29:29 +00:00
|
|
|
};
|
|
|
|
enable = true;
|
|
|
|
#configDir = "/var/lib/hass";
|
|
|
|
};
|
|
|
|
}
|