shack/glados: utilize mergeable home-assistant config
This commit is contained in:
parent
9f2c161de0
commit
c370c87da3
|
@ -1,21 +1,24 @@
|
||||||
# needs:
|
# needs:
|
||||||
# light.fablab_led
|
# light.fablab_led
|
||||||
[
|
{
|
||||||
{ alias = "State on HA start-up";
|
services.home-assistant.config.automation =
|
||||||
trigger = {
|
[
|
||||||
platform = "homeassistant";
|
{ alias = "State on HA start-up";
|
||||||
event = "start";
|
trigger = {
|
||||||
};
|
platform = "homeassistant";
|
||||||
# trigger good/bad air
|
event = "start";
|
||||||
action = [
|
};
|
||||||
{ service = "light.turn_on";
|
# trigger good/bad air
|
||||||
data = {
|
action = [
|
||||||
entity_id = "light.fablab_led";
|
{ service = "light.turn_on";
|
||||||
effect = "Rainbow";
|
data = {
|
||||||
color_name = "purple";
|
entity_id = "light.fablab_led";
|
||||||
};
|
effect = "Rainbow";
|
||||||
}
|
color_name = "purple";
|
||||||
];
|
};
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,24 +6,27 @@ let
|
||||||
disko_schalter = "switch.lounge_diskoschalter_relay";
|
disko_schalter = "switch.lounge_diskoschalter_relay";
|
||||||
player = "media_player.lounge";
|
player = "media_player.lounge";
|
||||||
in
|
in
|
||||||
[
|
{
|
||||||
{ alias = "Party um 21 Uhr";
|
services.home-assistant.config.automation =
|
||||||
trigger = {
|
[
|
||||||
platform = "sun";
|
{ alias = "Party um 21 Uhr";
|
||||||
event = "sunset";
|
trigger = {
|
||||||
};
|
platform = "sun";
|
||||||
action =
|
event = "sunset";
|
||||||
( glados.say.kiosk "Die Sonne geht unter. Und jetzt geht die Party im shack erst richtig los. Partybeleuchtung, aktiviert!" )
|
};
|
||||||
++
|
action =
|
||||||
[
|
( glados.say.kiosk "Die Sonne geht unter. Und jetzt geht die Party im shack erst richtig los. Partybeleuchtung, aktiviert!" )
|
||||||
{
|
++
|
||||||
service = "homeassistant.turn_on";
|
[
|
||||||
entity_id = disko_schalter;
|
{
|
||||||
}
|
service = "homeassistant.turn_on";
|
||||||
{
|
entity_id = disko_schalter;
|
||||||
service = "media_player.turn_on";
|
}
|
||||||
data.entity_id = player;
|
{
|
||||||
} # TODO: also start playlist if nothing is running?
|
service = "media_player.turn_on";
|
||||||
];
|
data.entity_id = player;
|
||||||
}
|
} # TODO: also start playlist if nothing is running?
|
||||||
]
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -13,85 +13,88 @@
|
||||||
let
|
let
|
||||||
glados = import ../lib;
|
glados = import ../lib;
|
||||||
in
|
in
|
||||||
[
|
{
|
||||||
{
|
services.home-assistant.config.automation =
|
||||||
alias = "Bedanken bei Übernahme von Key";
|
[
|
||||||
initial_state = true;
|
{
|
||||||
trigger = {
|
alias = "Bedanken bei Übernahme von Key";
|
||||||
platform = "state";
|
initial_state = true;
|
||||||
entity_id = "sensor.keyholder";
|
trigger = {
|
||||||
};
|
platform = "state";
|
||||||
condition = {
|
entity_id = "sensor.keyholder";
|
||||||
condition = "template";
|
};
|
||||||
value_template = "{{ (trigger.from_state.state != 'No Keyholder') and (trigger.from_state.state != 'No Keyholder') }}";
|
condition = {
|
||||||
};
|
condition = "template";
|
||||||
action = glados.say.kiosk "Danke {{ trigger.to_state.state }} für das Übernehmen des Keys von {{ trigger.from_state.state }}";
|
value_template = "{{ (trigger.from_state.state != 'No Keyholder') and (trigger.from_state.state != 'No Keyholder') }}";
|
||||||
}
|
};
|
||||||
{
|
action = glados.say.kiosk "Danke {{ trigger.to_state.state }} für das Übernehmen des Keys von {{ trigger.from_state.state }}";
|
||||||
alias = "Keyholder Begrüßen wenn MPD hoch fährt";
|
}
|
||||||
initial_state = true;
|
{
|
||||||
trigger = {
|
alias = "Keyholder Begrüßen wenn MPD hoch fährt";
|
||||||
platform = "state";
|
initial_state = true;
|
||||||
from = "unavailable";
|
trigger = {
|
||||||
entity_id = "media_player.kiosk";
|
platform = "state";
|
||||||
};
|
from = "unavailable";
|
||||||
action = glados.say.kiosk (builtins.readFile ./announcement.j2);
|
entity_id = "media_player.kiosk";
|
||||||
}
|
};
|
||||||
{
|
action = glados.say.kiosk (builtins.readFile ./announcement.j2);
|
||||||
alias = "Start Music on portal lock on";
|
}
|
||||||
trigger = {
|
{
|
||||||
platform = "state";
|
alias = "Start Music on portal lock on";
|
||||||
entity_id = "binary_sensor.portal_lock";
|
trigger = {
|
||||||
to = "on";
|
platform = "state";
|
||||||
for.seconds = 30;
|
entity_id = "binary_sensor.portal_lock";
|
||||||
};
|
to = "on";
|
||||||
condition = {
|
for.seconds = 30;
|
||||||
condition = "and";
|
};
|
||||||
conditions =
|
condition = {
|
||||||
[
|
condition = "and";
|
||||||
{ # only start if a keyholder opened the door and if the lounge mpd is currently not playing anything
|
conditions =
|
||||||
condition = "template";
|
[
|
||||||
value_template = "{{ state('sensor.keyholder') != 'No Keyholder' }}";
|
{ # only start if a keyholder opened the door and if the lounge mpd is currently not playing anything
|
||||||
}
|
condition = "template";
|
||||||
{
|
value_template = "{{ state('sensor.keyholder') != 'No Keyholder' }}";
|
||||||
condition = "state";
|
}
|
||||||
entity_id = "media_player.lounge";
|
{
|
||||||
state = "idle";
|
condition = "state";
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
action = [
|
|
||||||
{
|
|
||||||
service = "media_player.volume_set";
|
|
||||||
data = {
|
|
||||||
entity_id = "media_player.lounge";
|
entity_id = "media_player.lounge";
|
||||||
volume_level = 1.0;
|
state = "idle";
|
||||||
};
|
}
|
||||||
}
|
];
|
||||||
{
|
};
|
||||||
service = "media_player.play_media";
|
action = [
|
||||||
data = {
|
{
|
||||||
entity_id = "media_player.lounge";
|
service = "media_player.volume_set";
|
||||||
media_content_type = "playlist";
|
data = {
|
||||||
media_content_id = "ansage";
|
entity_id = "media_player.lounge";
|
||||||
};
|
volume_level = 1.0;
|
||||||
}
|
};
|
||||||
{ delay.seconds = 8.5; }
|
}
|
||||||
{
|
{
|
||||||
service = "media_player.volume_set";
|
service = "media_player.play_media";
|
||||||
data = {
|
data = {
|
||||||
entity_id = "media_player.lounge";
|
entity_id = "media_player.lounge";
|
||||||
volume_level = 0.6;
|
media_content_type = "playlist";
|
||||||
};
|
media_content_id = "ansage";
|
||||||
}
|
};
|
||||||
{
|
}
|
||||||
service = "media_player.play_media";
|
{ delay.seconds = 8.5; }
|
||||||
data = {
|
{
|
||||||
entity_id = "media_player.lounge";
|
service = "media_player.volume_set";
|
||||||
media_content_type = "playlist";
|
data = {
|
||||||
media_content_id = "lassulus";
|
entity_id = "media_player.lounge";
|
||||||
};
|
volume_level = 0.6;
|
||||||
}
|
};
|
||||||
];
|
}
|
||||||
}
|
{
|
||||||
]
|
service = "media_player.play_media";
|
||||||
|
data = {
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
media_content_type = "playlist";
|
||||||
|
media_content_id = "lassulus";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
shackopen = import ./multi/shackopen.nix;
|
|
||||||
wasser = import ./multi/wasser.nix;
|
|
||||||
badair = import ./multi/schlechte_luft.nix;
|
|
||||||
rollos = import ./multi/rollos.nix;
|
|
||||||
in {
|
in {
|
||||||
services.nginx.virtualHosts."hass.shack" = {
|
services.nginx.virtualHosts."hass.shack" = {
|
||||||
serverAliases = [ "glados.shack" ];
|
serverAliases = [ "glados.shack" ];
|
||||||
|
@ -21,14 +17,28 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
imports = [
|
||||||
|
./multi/shackopen.nix
|
||||||
|
./multi/wasser.nix
|
||||||
|
./multi/schlechte_luft.nix
|
||||||
|
./multi/rollos.nix
|
||||||
|
|
||||||
|
./switch/power.nix
|
||||||
|
|
||||||
|
./sensors/power.nix
|
||||||
|
./sensors/mate.nix
|
||||||
|
./sensors/darksky.nix
|
||||||
|
./sensors/spaceapi.nix
|
||||||
|
./sensors/sensemap.nix
|
||||||
|
|
||||||
|
./automation/shack-startup.nix
|
||||||
|
./automation/party-time.nix
|
||||||
|
./automation/hass-restart.nix
|
||||||
|
|
||||||
|
];
|
||||||
services.home-assistant =
|
services.home-assistant =
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.home-assistant.override {
|
|
||||||
extraPackages = ps: with ps; [
|
|
||||||
python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts
|
|
||||||
];
|
|
||||||
};
|
|
||||||
autoExtraComponents = true;
|
autoExtraComponents = true;
|
||||||
config = {
|
config = {
|
||||||
homeassistant = {
|
homeassistant = {
|
||||||
|
@ -85,9 +95,6 @@ in {
|
||||||
retain = true;
|
retain = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
switch =
|
|
||||||
(import ./switch/power.nix)
|
|
||||||
;
|
|
||||||
light = [];
|
light = [];
|
||||||
media_player = [
|
media_player = [
|
||||||
{ platform = "mpd";
|
{ platform = "mpd";
|
||||||
|
@ -100,34 +107,23 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
sensor =
|
|
||||||
(import ./sensors/power.nix)
|
|
||||||
++ (import ./sensors/mate.nix)
|
|
||||||
++ (import ./sensors/darksky.nix { inherit lib;})
|
|
||||||
++ shackopen.sensor
|
|
||||||
++ wasser.sensor
|
|
||||||
;
|
|
||||||
air_quality = (import ./sensors/sensemap.nix );
|
|
||||||
|
|
||||||
binary_sensor =
|
|
||||||
shackopen.binary_sensor
|
|
||||||
++ (import ./sensors/spaceapi.nix)
|
|
||||||
;
|
|
||||||
|
|
||||||
camera = [];
|
camera = [];
|
||||||
|
|
||||||
frontend = { };
|
frontend = { };
|
||||||
config = { };
|
config = { };
|
||||||
|
sun = {};
|
||||||
http = {
|
http = {
|
||||||
base_url = "http://hass.shack";
|
base_url = "http://hass.shack";
|
||||||
use_x_forwarded_for = true;
|
use_x_forwarded_for = true;
|
||||||
trusted_proxies = "127.0.0.1";
|
trusted_proxies = "127.0.0.1";
|
||||||
};
|
};
|
||||||
#conversation = {};
|
#conversation = {};
|
||||||
# history = {};
|
|
||||||
#logbook = {};
|
history = {};
|
||||||
logger.default = "info";
|
logbook = {};
|
||||||
#recorder = {};
|
#recorder = {};
|
||||||
|
|
||||||
|
logger.default = "info";
|
||||||
|
|
||||||
tts = [
|
tts = [
|
||||||
{ platform = "google_translate";
|
{ platform = "google_translate";
|
||||||
service_name = "say";
|
service_name = "say";
|
||||||
|
@ -136,15 +132,6 @@ in {
|
||||||
time_memory = 57600;
|
time_memory = 57600;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
sun = {};
|
|
||||||
|
|
||||||
automation = wasser.automation
|
|
||||||
++ badair.automation
|
|
||||||
++ rollos.automation
|
|
||||||
++ (import ./automation/shack-startup.nix)
|
|
||||||
++ (import ./automation/party-time.nix)
|
|
||||||
++ (import ./automation/hass-restart.nix);
|
|
||||||
|
|
||||||
device_tracker = [];
|
device_tracker = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,46 +11,49 @@ let
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
automation =
|
services.home-assistant.config =
|
||||||
[
|
{
|
||||||
{ alias = "Rollos fahren Runter";
|
automation =
|
||||||
trigger = [
|
[
|
||||||
{
|
{ alias = "Rollos fahren Runter";
|
||||||
platform = "numeric_state";
|
trigger = [
|
||||||
entity_id = tempsensor;
|
|
||||||
above = 25;
|
|
||||||
for = "00:30:00";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
condition =
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
condition = "state";
|
platform = "numeric_state";
|
||||||
entity_id = "sun.sun";
|
entity_id = tempsensor;
|
||||||
state = "above_horizon";
|
above = 25;
|
||||||
}
|
for = "00:30:00";
|
||||||
];
|
|
||||||
action =
|
|
||||||
[
|
|
||||||
{ service = "cover.close_cover";
|
|
||||||
entity_id = all_covers;
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
condition =
|
||||||
{ alias = "Rollos fahren Hoch";
|
[
|
||||||
trigger = [
|
{
|
||||||
{
|
condition = "state";
|
||||||
platform = "sun";
|
entity_id = "sun.sun";
|
||||||
event = "sunset";
|
state = "above_horizon";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
condition = [ ];
|
action =
|
||||||
action =
|
[
|
||||||
[
|
{ service = "cover.close_cover";
|
||||||
{ service = "cover.open_cover";
|
entity_id = all_covers;
|
||||||
entity_id = all_covers;
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{ alias = "Rollos fahren Hoch";
|
||||||
|
trigger = [
|
||||||
|
{
|
||||||
|
platform = "sun";
|
||||||
|
event = "sunset";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
condition = [ ];
|
||||||
];
|
action =
|
||||||
|
[
|
||||||
|
{ service = "cover.open_cover";
|
||||||
|
entity_id = all_covers;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,103 +4,106 @@ let
|
||||||
ledring = "light.fablab_led_ring";
|
ledring = "light.fablab_led_ring";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
automation =
|
services.home-assistant.config =
|
||||||
[
|
{
|
||||||
{ alias = "Gute Luft Fablab";
|
automation =
|
||||||
trigger = [
|
[
|
||||||
{
|
{ alias = "Gute Luft Fablab";
|
||||||
platform = "numeric_state";
|
trigger = [
|
||||||
entity_id = feinstaub_sensor;
|
{
|
||||||
below = 3;
|
platform = "numeric_state";
|
||||||
}
|
entity_id = feinstaub_sensor;
|
||||||
];
|
below = 3;
|
||||||
action =
|
|
||||||
[
|
|
||||||
{ service = "light.turn_on";
|
|
||||||
data = {
|
|
||||||
entity_id = ledring;
|
|
||||||
effect = "Twinkle";
|
|
||||||
color_name = "green";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
action =
|
||||||
{ alias = "mäßige Luft Fablab";
|
[
|
||||||
trigger = [
|
{ service = "light.turn_on";
|
||||||
{
|
data = {
|
||||||
platform = "numeric_state";
|
entity_id = ledring;
|
||||||
above = 3;
|
effect = "Twinkle";
|
||||||
below = 10;
|
color_name = "green";
|
||||||
entity_id = feinstaub_sensor;
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
action =
|
}
|
||||||
[
|
{ alias = "mäßige Luft Fablab";
|
||||||
{ service = "light.turn_on";
|
trigger = [
|
||||||
data = {
|
{
|
||||||
entity_id = ledring;
|
platform = "numeric_state";
|
||||||
effect = "Twinkle";
|
above = 3;
|
||||||
color_name = "yellow";
|
below = 10;
|
||||||
};
|
entity_id = feinstaub_sensor;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
action =
|
||||||
{ alias = "schlechte Luft Fablab";
|
[
|
||||||
trigger = [
|
{ service = "light.turn_on";
|
||||||
{
|
data = {
|
||||||
platform = "numeric_state";
|
entity_id = ledring;
|
||||||
above = 10;
|
effect = "Twinkle";
|
||||||
entity_id = feinstaub_sensor;
|
color_name = "yellow";
|
||||||
}
|
};
|
||||||
];
|
}
|
||||||
action =
|
];
|
||||||
[
|
}
|
||||||
{ service = "light.turn_on";
|
{ alias = "schlechte Luft Fablab";
|
||||||
data = {
|
trigger = [
|
||||||
entity_id = ledring;
|
{
|
||||||
effect = "Fireworks";
|
platform = "numeric_state";
|
||||||
color_name = "red";
|
above = 10;
|
||||||
};
|
entity_id = feinstaub_sensor;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
action =
|
||||||
{ alias = "Luft Sensor nicht verfügbar";
|
[
|
||||||
trigger = [
|
{ service = "light.turn_on";
|
||||||
{
|
data = {
|
||||||
platform = "state";
|
entity_id = ledring;
|
||||||
to = "unavailable";
|
effect = "Fireworks";
|
||||||
entity_id = feinstaub_sensor;
|
color_name = "red";
|
||||||
}
|
};
|
||||||
];
|
}
|
||||||
action =
|
];
|
||||||
[
|
}
|
||||||
{ service = "light.turn_on";
|
{ alias = "Luft Sensor nicht verfügbar";
|
||||||
data = {
|
trigger = [
|
||||||
entity_id = ledring;
|
{
|
||||||
effect = "Rainbow";
|
platform = "state";
|
||||||
color_name = "blue";
|
to = "unavailable";
|
||||||
};
|
entity_id = feinstaub_sensor;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
action =
|
||||||
{ alias = "Fablab Licht Reboot";
|
[
|
||||||
trigger = [
|
{ service = "light.turn_on";
|
||||||
{
|
data = {
|
||||||
platform = "state";
|
entity_id = ledring;
|
||||||
from = "unavailable";
|
effect = "Rainbow";
|
||||||
entity_id = ledring;
|
color_name = "blue";
|
||||||
}
|
};
|
||||||
];
|
}
|
||||||
action =
|
];
|
||||||
[
|
}
|
||||||
{ service = "light.turn_on";
|
{ alias = "Fablab Licht Reboot";
|
||||||
data = {
|
trigger = [
|
||||||
entity_id = ledring;
|
{
|
||||||
effect = "Rainbow";
|
platform = "state";
|
||||||
color_name = "orange";
|
from = "unavailable";
|
||||||
};
|
entity_id = ledring;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
action =
|
||||||
];
|
[
|
||||||
|
{ service = "light.turn_on";
|
||||||
|
data = {
|
||||||
|
entity_id = ledring;
|
||||||
|
effect = "Rainbow";
|
||||||
|
color_name = "orange";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,26 @@
|
||||||
{
|
{
|
||||||
binary_sensor = [
|
services.home-assistant.config =
|
||||||
{ platform = "mqtt";
|
{
|
||||||
name = "Portal Lock";
|
binary_sensor = [
|
||||||
device_class = "door";
|
{ platform = "mqtt";
|
||||||
state_topic = "portal/gateway/status";
|
name = "Portal Lock";
|
||||||
availability_topic = "portal/gateway/lwt";
|
device_class = "door";
|
||||||
payload_on = "open";
|
state_topic = "portal/gateway/status";
|
||||||
payload_off = "closed";
|
availability_topic = "portal/gateway/lwt";
|
||||||
payload_available = "online";
|
payload_on = "open";
|
||||||
payload_not_available = "offline";
|
payload_off = "closed";
|
||||||
}
|
payload_available = "online";
|
||||||
];
|
payload_not_available = "offline";
|
||||||
sensor = [
|
}
|
||||||
{ platform = "mqtt";
|
];
|
||||||
name = "Keyholder";
|
sensor = [
|
||||||
state_topic = "portal/gateway/keyholder";
|
{ platform = "mqtt";
|
||||||
availability_topic = "portal/gateway/lwt";
|
name = "Keyholder";
|
||||||
payload_available = "online";
|
state_topic = "portal/gateway/keyholder";
|
||||||
payload_not_available = "offline";
|
availability_topic = "portal/gateway/lwt";
|
||||||
}
|
payload_available = "online";
|
||||||
];
|
payload_not_available = "offline";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,100 +11,103 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
sensor = map ( entity_id: {
|
services.home-assistant.config =
|
||||||
platform = "statistics";
|
{
|
||||||
name = "Statistics for ${entity_id}";
|
sensor = map ( entity_id: {
|
||||||
inherit entity_id;
|
platform = "statistics";
|
||||||
max_age.minutes = "60";
|
name = "Statistics for ${entity_id}";
|
||||||
sampling_size = 1000;
|
inherit entity_id;
|
||||||
}) ["sensor.crafting_brotbox_soil_moisture"];
|
max_age.minutes = "60";
|
||||||
|
sampling_size = 1000;
|
||||||
|
}) ["sensor.crafting_brotbox_soil_moisture"];
|
||||||
|
|
||||||
|
|
||||||
automation =
|
automation =
|
||||||
[
|
[
|
||||||
### Brotbox #####
|
### Brotbox #####
|
||||||
#{ alias = "Brotbox: water for ${toString brotbox.minutes} minutes every hour";
|
#{ alias = "Brotbox: water for ${toString brotbox.minutes} minutes every hour";
|
||||||
# trigger =
|
# trigger =
|
||||||
# { # Trigger once every hour at :42
|
# { # Trigger once every hour at :42
|
||||||
# platform = "time_pattern";
|
# platform = "time_pattern";
|
||||||
# minutes = 42;
|
# minutes = 42;
|
||||||
# };
|
# };
|
||||||
# condition = {
|
# condition = {
|
||||||
# condition = "numeric_state";
|
# condition = "numeric_state";
|
||||||
# entity_id = brotbox.sensor;
|
# entity_id = brotbox.sensor;
|
||||||
# value_template = "{{ state_attr('${brotbox.sensor}', 'median') }}";
|
# value_template = "{{ state_attr('${brotbox.sensor}', 'median') }}";
|
||||||
# below = 75;
|
# below = 75;
|
||||||
# };
|
# };
|
||||||
# action =
|
# action =
|
||||||
# [
|
# [
|
||||||
# {
|
# {
|
||||||
# service = "homeassistant.turn_on";
|
# service = "homeassistant.turn_on";
|
||||||
# entity_id = brotbox.pump;
|
# entity_id = brotbox.pump;
|
||||||
# }
|
# }
|
||||||
# { delay.minutes = brotbox.minutes; }
|
# { delay.minutes = brotbox.minutes; }
|
||||||
# {
|
# {
|
||||||
# service = "homeassistant.turn_off";
|
# service = "homeassistant.turn_off";
|
||||||
# entity_id = brotbox.pump ;
|
# entity_id = brotbox.pump ;
|
||||||
# }
|
# }
|
||||||
# ];
|
# ];
|
||||||
#}
|
#}
|
||||||
{ alias = "Brotbox: Always turn off water after ${toString (brotbox.minutes * 2)} minutes";
|
{ alias = "Brotbox: Always turn off water after ${toString (brotbox.minutes * 2)} minutes";
|
||||||
trigger =
|
trigger =
|
||||||
{
|
|
||||||
platform = "state";
|
|
||||||
entity_id = brotbox.pump;
|
|
||||||
to = "on";
|
|
||||||
for.minutes = brotbox.minutes*2;
|
|
||||||
};
|
|
||||||
action =
|
|
||||||
{
|
|
||||||
service = "homeassistant.turn_off";
|
|
||||||
entity_id = brotbox.pump;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
##### Kaffeemaschine
|
|
||||||
{ alias = "Water the plant for ${toString seconds} seconds";
|
|
||||||
trigger = [
|
|
||||||
{ # trigger at 20:00 no matter what
|
|
||||||
# TODO: retry or run only if switch.wasser is available
|
|
||||||
platform = "time";
|
|
||||||
at = "20:00:00";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
action =
|
|
||||||
[
|
|
||||||
{
|
|
||||||
service = "homeassistant.turn_on";
|
|
||||||
entity_id = [
|
|
||||||
wasser
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ delay.seconds = seconds; }
|
|
||||||
{
|
|
||||||
service = "homeassistant.turn_off";
|
|
||||||
entity_id = [
|
|
||||||
wasser
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ alias = "Always turn off water after ${toString (seconds * 2)}seconds";
|
|
||||||
trigger = [
|
|
||||||
{
|
{
|
||||||
platform = "state";
|
platform = "state";
|
||||||
entity_id = wasser;
|
entity_id = brotbox.pump;
|
||||||
to = "on";
|
to = "on";
|
||||||
for.seconds = seconds*2;
|
for.minutes = brotbox.minutes*2;
|
||||||
}
|
};
|
||||||
];
|
action =
|
||||||
action =
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
service = "homeassistant.turn_off";
|
service = "homeassistant.turn_off";
|
||||||
entity_id = [ wasser ];
|
entity_id = brotbox.pump;
|
||||||
}
|
};
|
||||||
];
|
}
|
||||||
}
|
|
||||||
];
|
##### Kaffeemaschine
|
||||||
|
{ alias = "Water the plant for ${toString seconds} seconds";
|
||||||
|
trigger = [
|
||||||
|
{ # trigger at 20:00 no matter what
|
||||||
|
# TODO: retry or run only if switch.wasser is available
|
||||||
|
platform = "time";
|
||||||
|
at = "20:00:00";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
action =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
service = "homeassistant.turn_on";
|
||||||
|
entity_id = [
|
||||||
|
wasser
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{ delay.seconds = seconds; }
|
||||||
|
{
|
||||||
|
service = "homeassistant.turn_off";
|
||||||
|
entity_id = [
|
||||||
|
wasser
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{ alias = "Always turn off water after ${toString (seconds * 2)}seconds";
|
||||||
|
trigger = [
|
||||||
|
{
|
||||||
|
platform = "state";
|
||||||
|
entity_id = wasser;
|
||||||
|
to = "on";
|
||||||
|
for.seconds = seconds*2;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
action =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
service = "homeassistant.turn_off";
|
||||||
|
entity_id = [ wasser ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
{lib,...}:
|
{lib,...}:
|
||||||
[
|
{
|
||||||
{ platform = "darksky";
|
services.home-assistant.config.sensor =
|
||||||
api_key = lib.removeSuffix "\n"
|
[
|
||||||
(builtins.readFile <secrets/hass/darksky.apikey>);
|
{ platform = "darksky";
|
||||||
language = "de";
|
api_key = lib.removeSuffix "\n"
|
||||||
monitored_conditions = [
|
(builtins.readFile <secrets/hass/darksky.apikey>);
|
||||||
"summary" "icon"
|
language = "de";
|
||||||
"nearest_storm_distance" "precip_probability"
|
monitored_conditions = [
|
||||||
"precip_intensity"
|
"summary" "icon"
|
||||||
"temperature" # "temperature_high" "temperature_low"
|
"nearest_storm_distance" "precip_probability"
|
||||||
"apparent_temperature"
|
"precip_intensity"
|
||||||
"hourly_summary" # next 24 hours text
|
"temperature" # "temperature_high" "temperature_low"
|
||||||
"humidity"
|
"apparent_temperature"
|
||||||
"pressure"
|
"hourly_summary" # next 24 hours text
|
||||||
"uv_index"
|
"humidity"
|
||||||
];
|
"pressure"
|
||||||
units = "si" ;
|
"uv_index"
|
||||||
scan_interval = "00:15:00";
|
];
|
||||||
}
|
units = "si" ;
|
||||||
]
|
scan_interval = "00:15:00";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -6,11 +6,15 @@ let
|
||||||
name = "Füllstand ${name}";
|
name = "Füllstand ${name}";
|
||||||
value_template = "{{ value_json.fuellstand }}";
|
value_template = "{{ value_json.fuellstand }}";
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
(fuellstand "Wasser" 1)
|
{
|
||||||
(fuellstand "Mate Cola" 2)
|
services.home-assistant.config.sensor =
|
||||||
(fuellstand "Apfelschorle" 3)
|
[
|
||||||
(fuellstand "Zitronensprudel" 4)
|
(fuellstand "Wasser" 1)
|
||||||
(fuellstand "Mate 1" 26)
|
(fuellstand "Mate Cola" 2)
|
||||||
(fuellstand "Mate 2" 27)
|
(fuellstand "Apfelschorle" 3)
|
||||||
]
|
(fuellstand "Zitronensprudel" 4)
|
||||||
|
(fuellstand "Mate 1" 26)
|
||||||
|
(fuellstand "Mate 2" 27)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,10 @@ let
|
||||||
power_watt = (power_x "Power") ;
|
power_watt = (power_x "Power") ;
|
||||||
power_curr = power_x "Current";
|
power_curr = power_x "Current";
|
||||||
in
|
in
|
||||||
|
{
|
||||||
|
services.home-assistant.config.sensor =
|
||||||
(map power_volt [ "L1" "L2" "L3" ])
|
(map power_volt [ "L1" "L2" "L3" ])
|
||||||
++ (map (x: ((power_watt x) // { device_class = "power"; })) [ "L1" "L2" "L3" ])
|
++ (map (x: ((power_watt x) // { device_class = "power"; })) [ "L1" "L2" "L3" ])
|
||||||
++ (map power_curr [ "L1" "L2" "L3" ])
|
++ (map power_curr [ "L1" "L2" "L3" ])
|
||||||
++ [ power_consumed ]
|
++ [ power_consumed ];
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
[
|
{
|
||||||
{
|
services.home-assistant.config.air_quality =
|
||||||
platform = "opensensemap";
|
[
|
||||||
station_id = "56a0de932cb6e1e41040a68b";
|
{
|
||||||
}
|
platform = "opensensemap";
|
||||||
]
|
station_id = "56a0de932cb6e1e41040a68b";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -1,52 +1,55 @@
|
||||||
[
|
{
|
||||||
{
|
services.home-assistant.config.binary_sensor =
|
||||||
platform = "rest";
|
[
|
||||||
resource = "https://spaceapi.afra-berlin.de/v1/status.json";
|
{
|
||||||
method = "GET";
|
platform = "rest";
|
||||||
name = "Door AFRA Berlin";
|
resource = "https://spaceapi.afra-berlin.de/v1/status.json";
|
||||||
device_class = "door";
|
method = "GET";
|
||||||
value_template = "{{ value_json.open }}";
|
name = "Door AFRA Berlin";
|
||||||
}
|
device_class = "door";
|
||||||
{
|
value_template = "{{ value_json.open }}";
|
||||||
platform = "rest";
|
}
|
||||||
resource = "http://club.entropia.de/spaceapi";
|
{
|
||||||
method = "GET";
|
platform = "rest";
|
||||||
name = "Door Entropia";
|
resource = "http://club.entropia.de/spaceapi";
|
||||||
device_class = "door";
|
method = "GET";
|
||||||
value_template = "{{ value_json.open }}";
|
name = "Door Entropia";
|
||||||
}
|
device_class = "door";
|
||||||
{
|
value_template = "{{ value_json.open }}";
|
||||||
platform = "rest";
|
}
|
||||||
resource = "http://www.c-base.org/status.json";
|
{
|
||||||
method = "GET";
|
platform = "rest";
|
||||||
name = "Door C-Base Berlin";
|
resource = "http://www.c-base.org/status.json";
|
||||||
device_class = "door";
|
method = "GET";
|
||||||
value_template = "{{ value_json.open }}";
|
name = "Door C-Base Berlin";
|
||||||
}
|
device_class = "door";
|
||||||
{
|
value_template = "{{ value_json.open }}";
|
||||||
platform = "rest";
|
}
|
||||||
resource = "https://status.raumzeitlabor.de/api/full.json";
|
{
|
||||||
method = "GET";
|
platform = "rest";
|
||||||
name = "Door RZL";
|
resource = "https://status.raumzeitlabor.de/api/full.json";
|
||||||
device_class = "door";
|
method = "GET";
|
||||||
value_template = "{{ value_json.status }}";
|
name = "Door RZL";
|
||||||
}
|
device_class = "door";
|
||||||
{
|
value_template = "{{ value_json.status }}";
|
||||||
platform = "rest";
|
}
|
||||||
resource = "https://datenobservatorium.de/";
|
{
|
||||||
method = "GET";
|
platform = "rest";
|
||||||
name = "Door Datenobservatorium";
|
resource = "https://datenobservatorium.de/";
|
||||||
device_class = "door";
|
method = "GET";
|
||||||
value_template = "false";
|
name = "Door Datenobservatorium";
|
||||||
scan_interval = 2592000;
|
device_class = "door";
|
||||||
}
|
value_template = "false";
|
||||||
{
|
scan_interval = 2592000;
|
||||||
platform = "rest";
|
}
|
||||||
resource = "https://infuanfu.de/";
|
{
|
||||||
method = "GET";
|
platform = "rest";
|
||||||
name = "Door Infuanfu";
|
resource = "https://infuanfu.de/";
|
||||||
device_class = "door";
|
method = "GET";
|
||||||
value_template = "false";
|
name = "Door Infuanfu";
|
||||||
scan_interval = 2592000;
|
device_class = "door";
|
||||||
}
|
value_template = "false";
|
||||||
]
|
scan_interval = 2592000;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -15,18 +15,30 @@ let
|
||||||
power = nodelight "power";
|
power = nodelight "power";
|
||||||
light = ident: name: { icon = "mdi:lightbulb";} // nodelight "light" ident name;
|
light = ident: name: { icon = "mdi:lightbulb";} // nodelight "light" ident name;
|
||||||
in
|
in
|
||||||
[
|
{
|
||||||
(power 1 "Hauptschalter")
|
services.home-assistant.config.switch =
|
||||||
(power 2 "Dusche")
|
[
|
||||||
(power 3 "Warmwasser")
|
# These commands we see with a shutdown:
|
||||||
(power 4 "Optionsräume")
|
# power/143/state on
|
||||||
(power 5 "Küche")
|
# power/142/state on
|
||||||
(light 1 "Decke Lounge 1")
|
# power/141/state on
|
||||||
(light 2 "Decke Lounge 2")
|
# power/142/state off
|
||||||
(light 3 "Decke Lounge 3")
|
# power/141/state off
|
||||||
(light 4 "Decke Lounge 4")
|
# power/10/state off
|
||||||
(light 5 "Decke Lounge 5")
|
# power/main/state off
|
||||||
(light 6 "Decke Lounge 6")
|
|
||||||
(light 7 "Decke Lounge 7")
|
(power "10" "Hauptschalter")
|
||||||
(light 8 "Decke Lounge 8")
|
(power 1 "Dusche") # ???
|
||||||
]
|
(power 2 "Warmwasser") # ???
|
||||||
|
(power 3 "Optionsräume") # ???
|
||||||
|
(power 4 "Küche") # ???
|
||||||
|
(light 1 "Decke Lounge 1")
|
||||||
|
(light 2 "Decke Lounge 2")
|
||||||
|
(light 3 "Decke Lounge 3")
|
||||||
|
(light 4 "Decke Lounge 4")
|
||||||
|
(light 5 "Decke Lounge 5")
|
||||||
|
(light 6 "Decke Lounge 6")
|
||||||
|
(light 7 "Decke Lounge 7")
|
||||||
|
(light 8 "Decke Lounge 8")
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user