ma homeautomation: cleanup, add flurlicht
This commit is contained in:
parent
fab5c63e12
commit
01aac346b8
|
@ -1,67 +0,0 @@
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
firetv = "192.168.1.238";
|
|
||||||
in {
|
|
||||||
systemd.services.firetv = {
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
User = "nobody";
|
|
||||||
ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
services.home-assistant = {
|
|
||||||
#panel_iframe:
|
|
||||||
#configurator:
|
|
||||||
# title: Configurator
|
|
||||||
# icon: mdi:wrench
|
|
||||||
# url: http://hassio.local:3218
|
|
||||||
# sensor:
|
|
||||||
# - platform: random
|
|
||||||
enable = true;
|
|
||||||
config = {
|
|
||||||
homeassistant = {
|
|
||||||
name = "Bureautomation";
|
|
||||||
time_zone = "Europe/Berlin";
|
|
||||||
};
|
|
||||||
panel_iframe = {
|
|
||||||
euer_blog = {
|
|
||||||
title = "Euer Blog";
|
|
||||||
icon = "mdi:wrench";
|
|
||||||
url = "https://euer.krebsco.de";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
media_player = [
|
|
||||||
{ platform = "kodi";
|
|
||||||
host = firetv;
|
|
||||||
}
|
|
||||||
{ platform = "firetv";
|
|
||||||
# assumes python-firetv running
|
|
||||||
}
|
|
||||||
];
|
|
||||||
sensor = [
|
|
||||||
{
|
|
||||||
platform = "luftdaten";
|
|
||||||
name = "Shack 1";
|
|
||||||
sensorid = "50";
|
|
||||||
monitored_conditions = [ "P1" "P2" ];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
platform = "luftdaten";
|
|
||||||
name = "Shack 2";
|
|
||||||
sensorid = "658";
|
|
||||||
monitored_conditions = [ "P1" "P2" ];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
platform = "luftdaten";
|
|
||||||
name = "Ditzingen";
|
|
||||||
sensorid = "5341";
|
|
||||||
monitored_conditions = [ "P1" "P2" ];
|
|
||||||
}
|
|
||||||
{ platform = "random"; }
|
|
||||||
];
|
|
||||||
frontend = { };
|
|
||||||
http = { };
|
|
||||||
feedreader.urls = [ "https://nixos.org/blogs.xml" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,9 +1,60 @@
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
# Ideas:
|
# Ideas:
|
||||||
## wake-on-lan server
|
## wake-on-lan server
|
||||||
##
|
##
|
||||||
let
|
let
|
||||||
|
tasmota_rgb = name: topic:
|
||||||
|
# LED WS2812b
|
||||||
|
# effect_state_topic: "stat/led/Scheme"
|
||||||
|
# effect_command_topic: "cmnd/led/Scheme"
|
||||||
|
# effect_value_template: "{{ value_json.Scheme }}"
|
||||||
|
{ platform = "mqtt";
|
||||||
|
inherit name;
|
||||||
|
retain = false;
|
||||||
|
qos = 1;
|
||||||
|
optimistic = false;
|
||||||
|
# state
|
||||||
|
# TODO: currently broken, will not use the custom state topic
|
||||||
|
#state_topic = "/ham/${topic}/stat/POWER";
|
||||||
|
state_topic = "stat/${topic}/POWER";
|
||||||
|
command_topic = "/ham/${topic}/cmnd/POWER";
|
||||||
|
availability_topic = "/ham/${topic}/tele/LWT";
|
||||||
|
payload_on= "ON";
|
||||||
|
payload_off= "OFF";
|
||||||
|
payload_available= "Online";
|
||||||
|
payload_not_available= "Offline";
|
||||||
|
# brightness
|
||||||
|
brightness_state_topic = "/ham/${topic}/stat/Dimmer";
|
||||||
|
brightness_command_topic = "/ham/${topic}/cmnd/Dimmer";
|
||||||
|
brightness_value_template = "{{ value_json.Dimmer }}";
|
||||||
|
brightness_scale = 100;
|
||||||
|
# color
|
||||||
|
rgb_state_topic = "/ham/${topic}/stat/Color";
|
||||||
|
rgb_command_topic = "/ham/${topic}/cmnd/Color2";
|
||||||
|
rgb_command_mode = "hex";
|
||||||
|
rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}";
|
||||||
|
# effects
|
||||||
|
effect_state_topic = "/ham/${topic}/stat/Scheme";
|
||||||
|
effect_command_topic = "/ham/${topic}/cmnd/Scheme";
|
||||||
|
effect_value_template = "{{ value_json.Scheme }}";
|
||||||
|
effect_list = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 ];
|
||||||
|
};
|
||||||
|
# switchmode 1 - also toggle power
|
||||||
|
# switchtopic flurlicht
|
||||||
|
tasmota_motion = name: topic:
|
||||||
|
{ platform = "mqtt";
|
||||||
|
device_class = "motion";
|
||||||
|
inherit name;
|
||||||
|
# TODO: currently broken, will not use the custom state topic
|
||||||
|
state_topic = "stat/${topic}/POWER";
|
||||||
|
payload_on = "ON";
|
||||||
|
payload_off = "OFF";
|
||||||
|
availability_topic = "/ham/${topic}/tele/LWT";
|
||||||
|
payload_available = "Online";
|
||||||
|
payload_not_available = "Offline";
|
||||||
|
};
|
||||||
|
|
||||||
firetv = "192.168.1.238";
|
firetv = "192.168.1.238";
|
||||||
tasmota_plug = name: topic:
|
tasmota_plug = name: topic:
|
||||||
{ platform = "mqtt";
|
{ platform = "mqtt";
|
||||||
|
@ -40,16 +91,13 @@ in {
|
||||||
imports = [
|
imports = [
|
||||||
./mqtt.nix
|
./mqtt.nix
|
||||||
];
|
];
|
||||||
systemd.services.firetv = {
|
#systemd.services.firetv = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
# wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
# serviceConfig = {
|
||||||
User = "nobody";
|
# User = "nobody";
|
||||||
ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555";
|
# ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555";
|
||||||
};
|
# };
|
||||||
};
|
#};
|
||||||
nixpkgs.config.permittedInsecurePackages = [
|
|
||||||
"homeassistant-0.65.5"
|
|
||||||
];
|
|
||||||
services.home-assistant = {
|
services.home-assistant = {
|
||||||
config = {
|
config = {
|
||||||
homeassistant = {
|
homeassistant = {
|
||||||
|
@ -58,7 +106,7 @@ in {
|
||||||
longitude = "9.2478";
|
longitude = "9.2478";
|
||||||
elevation = 247;
|
elevation = 247;
|
||||||
};
|
};
|
||||||
discovery = {};
|
#discovery = {};
|
||||||
conversation = {};
|
conversation = {};
|
||||||
history = {};
|
history = {};
|
||||||
logbook = {};
|
logbook = {};
|
||||||
|
@ -71,16 +119,16 @@ in {
|
||||||
{ platform = "kodi";
|
{ platform = "kodi";
|
||||||
host = firetv;
|
host = firetv;
|
||||||
}
|
}
|
||||||
{ platform = "firetv";
|
#{ platform = "firetv";
|
||||||
# assumes python-firetv running
|
# # assumes python-firetv running
|
||||||
}
|
#}
|
||||||
];
|
];
|
||||||
mqtt = {
|
mqtt = {
|
||||||
broker = "localhost";
|
broker = "localhost";
|
||||||
port = 1883;
|
port = 1883;
|
||||||
client_id = "home-assistant";
|
client_id = "home-assistant";
|
||||||
username = "hass";
|
username = "hass";
|
||||||
password = builtins.readFile <secrets/mqtt/hass>;
|
password = lib.removeSuffix "\n" (builtins.readFile <secrets/mqtt/hass>);
|
||||||
keepalive = 60;
|
keepalive = 60;
|
||||||
protocol = 3.1;
|
protocol = 3.1;
|
||||||
birth_message = {
|
birth_message = {
|
||||||
|
@ -96,10 +144,14 @@ in {
|
||||||
retain = true;
|
retain = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
binary_sensor = [
|
||||||
|
(tasmota_motion "Flur Bewegung" "flurlicht")
|
||||||
|
];
|
||||||
sensor = [
|
sensor = [
|
||||||
{ platform = "speedtest";
|
# broken
|
||||||
monitored_conditions = [ "ping" "download" "upload" ];
|
#{ platform = "speedtest";
|
||||||
}
|
# monitored_conditions = [ "ping" "download" "upload" ];
|
||||||
|
#}
|
||||||
{ platform = "luftdaten";
|
{ platform = "luftdaten";
|
||||||
name = "Ditzingen";
|
name = "Ditzingen";
|
||||||
sensorid = "663";
|
sensorid = "663";
|
||||||
|
@ -107,7 +159,8 @@ in {
|
||||||
}
|
}
|
||||||
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
|
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
|
||||||
{ platform = "darksky";
|
{ platform = "darksky";
|
||||||
api_key = "c73619e6ea79e553a585be06aacf3679";
|
api_key = lib.removeSuffix "\n"
|
||||||
|
(builtins.readFile <secrets/hass/darksky.apikey>);
|
||||||
language = "de";
|
language = "de";
|
||||||
monitored_conditions = [ "summary" "icon"
|
monitored_conditions = [ "summary" "icon"
|
||||||
"nearest_storm_distance" "precip_probability"
|
"nearest_storm_distance" "precip_probability"
|
||||||
|
@ -125,15 +178,39 @@ in {
|
||||||
}
|
}
|
||||||
] ++ (tasmota_bme "Schlafzimmer" "schlafzimmer");
|
] ++ (tasmota_bme "Schlafzimmer" "schlafzimmer");
|
||||||
frontend = { };
|
frontend = { };
|
||||||
#group = [
|
group =
|
||||||
# { default_view = { view = "yes"; entities = [
|
{ default_view =
|
||||||
# "sensor.luftdaten"
|
{ view = "yes";
|
||||||
# ]}
|
entities = [
|
||||||
#];
|
"group.flur"
|
||||||
|
"group.schlafzimmer"
|
||||||
|
"group.draussen"
|
||||||
|
"group.wohnzimmer"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
flur = [
|
||||||
|
"light.flurlicht"
|
||||||
|
"binary_sensor.flur_bewegung"
|
||||||
|
];
|
||||||
|
wohnzimmer = [
|
||||||
|
"media_player.kodi"
|
||||||
|
];
|
||||||
|
draussen = [
|
||||||
|
"sensor.dark_sky_temperature"
|
||||||
|
"sensor.dark_sky_hourly_summary"
|
||||||
|
];
|
||||||
|
schlafzimmer = [
|
||||||
|
"sensor.schlafzimmer_temperatur"
|
||||||
|
"sensor.schlafzimmer_luftdruck"
|
||||||
|
"sensor.schlafzimmer_luftfeuchtigkeit"
|
||||||
|
"switch.lichterkette_schlafzimmer"
|
||||||
|
];
|
||||||
|
};
|
||||||
http = { };
|
http = { };
|
||||||
switch = [
|
switch = [
|
||||||
(tasmota_plug "Lichterkette Schlafzimmer" "schlafzimmer")
|
(tasmota_plug "Lichterkette Schlafzimmer" "schlafzimmer")
|
||||||
];
|
];
|
||||||
|
light = [ (tasmota_rgb "Flurlicht" "flurlicht" ) ];
|
||||||
};
|
};
|
||||||
enable = true;
|
enable = true;
|
||||||
#configDir = "/var/lib/hass";
|
#configDir = "/var/lib/hass";
|
||||||
|
|
Loading…
Reference in a new issue