summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/home/ham')
-rw-r--r--makefu/2configs/home/ham/automation/buttonboard.nix4
-rw-r--r--makefu/2configs/home/ham/automation/check-in.nix77
-rw-r--r--makefu/2configs/home/ham/automation/daily_speedtext.nix17
-rw-r--r--makefu/2configs/home/ham/automation/fenster_auf.nix55
-rw-r--r--makefu/2configs/home/ham/automation/firetv_restart.nix22
-rw-r--r--makefu/2configs/home/ham/automation/flurlicht.nix12
-rw-r--r--makefu/2configs/home/ham/automation/shutdown_button.nix11
-rw-r--r--makefu/2configs/home/ham/automation/urlaub.nix7
-rw-r--r--makefu/2configs/home/ham/default.nix58
-rw-r--r--makefu/2configs/home/ham/lib/default.nix11
-rw-r--r--makefu/2configs/home/ham/light/tint_wohnzimmer.nix12
-rw-r--r--makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix14
-rw-r--r--makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix50
-rw-r--r--makefu/2configs/home/ham/sensor/dwd.nix8
-rw-r--r--makefu/2configs/home/ham/sensor/pollen.nix65
-rw-r--r--makefu/2configs/home/ham/signal-rest/service.nix2
-rw-r--r--makefu/2configs/home/ham/zigbee2mqtt.nix87
17 files changed, 321 insertions, 191 deletions
diff --git a/makefu/2configs/home/ham/automation/buttonboard.nix b/makefu/2configs/home/ham/automation/buttonboard.nix
new file mode 100644
index 000000000..533311fc5
--- /dev/null
+++ b/makefu/2configs/home/ham/automation/buttonboard.nix
@@ -0,0 +1,4 @@
+# good, bad radio
+# stop
+# start radio
+# lauter, leister
diff --git a/makefu/2configs/home/ham/automation/check-in.nix b/makefu/2configs/home/ham/automation/check-in.nix
index d589a6971..db051757e 100644
--- a/makefu/2configs/home/ham/automation/check-in.nix
+++ b/makefu/2configs/home/ham/automation/check-in.nix
@@ -7,6 +7,21 @@ let
in
{
services.home-assistant.config.input_boolean.felix_at_work.name = "Felix auf Arbeit";
+ services.home-assistant.config.timer.felix_at_work = {
+ name = "Felix auf Arbeit Timer";
+ duration = "10:00:00";
+ };
+ services.home-assistant.config.sensor = [
+ {
+ platform = "history_stats";
+ name = "Felix at work today";
+ entity_id = "input_boolean.felix_at_work";
+ state = "on";
+ type = "time";
+ start = "{{ now().replace(hour=0, minute=0, second=0) }}";
+ end = "{{ now() }}";
+ }
+ ];
services.home-assistant.config.script.start_office_radio.sequence =
[
{ service = "media_player.play_media";
@@ -19,13 +34,41 @@ in
];
services.home-assistant.config.automation =
[
- { service = "media_player.play_media";
- data = {
- media_content_id = "http://radio.lassul.us:8000/radio.mp3";
- media_content_type = "music";
- };
- target.entity_id = "media_player.office";
- }
+ { alias = "Zu lange Felix!";
+ trigger =
+ { platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_at_work";
+ };
+
+ condition =
+ {
+ condition = "state";
+ entity_id = at_work;
+ state = "off";
+ };
+
+ action = (say "Felix, die zehn Stunden sind um, aufhören jetzt");
+ }
+ { alias = "Turn off at work sensor";
+ trigger = [
+ { platform = "time"; at = "00:00:00"; }
+ ];
+ condition =
+ {
+ condition = "state";
+ entity_id = at_work;
+ state = "off";
+ };
+ action =
+ [
+ # felix forgot to stamp out ...
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ at_work ];
+ }
+ ];
+ }
{ alias = "Push Check-in Button Felix with button";
trigger = [
{
@@ -54,15 +97,12 @@ in
{ service = "homeassistant.turn_on";
entity_id = at_work;
}
- ] ++ (say "Willkommen auf Arbeit") ++
- [
- { service = "media_player.play_media";
- data = {
- media_content_id = "http://radio.lassul.us:8000/radio.mp3";
- media_content_type = "music";
- };
- target.entity_id = "media_player.office";
+ { service = "timer.start";
+ entity_id = [ "timer.felix_at_work" ] ;
}
+ ] ++ (say (builtins.readFile ./welcome.txt.j2)) ++
+ [
+ { service = "script.start_office_radio"; }
];
}
{
@@ -78,7 +118,12 @@ in
{ service = "homeassistant.turn_off";
entity_id = at_work;
}
- ] ++ (say "Endlich ist Pappa fertig mit arbeit!");
+ ] ++ (say (builtins.readFile ./bye.txt.j2)) ++
+ [
+ { service = "timer.stop";
+ entity_id = [ "timer.felix_at_work" ] ;
+ }
+ ];
}
];
}
diff --git a/makefu/2configs/home/ham/automation/daily_speedtext.nix b/makefu/2configs/home/ham/automation/daily_speedtext.nix
new file mode 100644
index 000000000..70d59f6e1
--- /dev/null
+++ b/makefu/2configs/home/ham/automation/daily_speedtext.nix
@@ -0,0 +1,17 @@
+{
+ services.home-assistant.config.automation =
+ [
+ {
+ trigger = [
+ { platform = "time"; at = "03:21"; }
+ ];
+ action =
+ [
+ {
+ service = "speedtestdotnet.speedtest";
+ }
+ ];
+ }
+ ];
+
+}
diff --git a/makefu/2configs/home/ham/automation/fenster_auf.nix b/makefu/2configs/home/ham/automation/fenster_auf.nix
index fa2052be8..b3682fe0c 100644
--- a/makefu/2configs/home/ham/automation/fenster_auf.nix
+++ b/makefu/2configs/home/ham/automation/fenster_auf.nix
@@ -4,6 +4,11 @@
# binary_sensor.badezimmer_fenster_contact
# binary_sensor.dusche_fenster_contact
let
+ hlib = import ../lib;
+ say = hlib.say.office;
+ draussen = "sensor.wohnzimmer_temp_temperature";
+ draussen_diff = "sensor.unterschied_draussen_drinnen";
+ draussen_heiss = 23;
min = 20;
fenster_offen = name: entity:
{ alias = "${name} seit ${toString min} Minuten offen";
@@ -16,10 +21,6 @@ let
}
];
condition = [
- { condition = "state";
- entity_id = "input_boolean.ist_sommer";
- state = "off";
- }
];
action =
[
@@ -67,6 +68,17 @@ let
};
in {
services.home-assistant.config = {
+ template = [
+ { sensor = {
+ name = "Unterschied Draussen Drinnen";
+ unit_of_measurement = "°C";
+ state = ''
+ {% set inside = states("${draussen}") | float | round(2) -%}
+ {% set outside = states("sensor.dark_sky_temperature") | float | round(2) -%}
+ {{ ((outside - inside) | round(1) )}}'';
+ };
+ }
+ ];
sensor = [
{ platform = "season"; type = "meteorological";}
];
@@ -86,6 +98,41 @@ in {
(fenster_offen "Badezimmerfenster" "binary_sensor.badezimmer_fenster_contact")
(fenster_offen "Duschfenster" "binary_sensor.dusche_fenster_contact")
+
+ { alias = "Draussen ist wieder kaelter";
+ trigger = [
+ {
+ platform = "numeric_state";
+ entity_id = draussen_diff;
+ below = 0;
+ for.minutes = 20;
+ }
+ ];
+ condition = [
+ { condition = "numeric_state";
+ entity_id = draussen;
+ above = draussen_heiss;
+ }
+ ];
+ action = (say "Draussen ist es endlich kühler, jetzt kann man die Fenster auf machen");
+ }
+ { alias = "Draussen ist zu warm";
+ trigger = [
+ {
+ platform = "numeric_state";
+ entity_id = draussen_diff;
+ above = 0;
+ for.minutes = 20;
+ }
+ ];
+ condition = [
+ { condition = "numeric_state";
+ entity_id = draussen;
+ above = draussen_heiss;
+ }
+ ];
+ action = (say "Draussen wird es jetzt zu warm, besser das fenster schliessen");
+ }
];
};
}
diff --git a/makefu/2configs/home/ham/automation/firetv_restart.nix b/makefu/2configs/home/ham/automation/firetv_restart.nix
index 12e0e845a..01d1ba6e9 100644
--- a/makefu/2configs/home/ham/automation/firetv_restart.nix
+++ b/makefu/2configs/home/ham/automation/firetv_restart.nix
@@ -20,17 +20,17 @@ in
action = [
(cmd "reboot")
(sec 90) # go to my music because apparently select_source does not seem to always work
- (cmd "HOME")
- (sec 2)
- (cmd "DOWN")
- (sec 2)
- (cmd "DOWN")
- (sec 2)
- (cmd "ENTER")
- (sec 4)
- (cmd "RIGHT")
- (sec 2)
- (cmd "RIGHT")
+ #(cmd "HOME")
+ #(sec 2)
+ #(cmd "DOWN")
+ #(sec 2)
+ #(cmd "DOWN")
+ #(sec 2)
+ #(cmd "ENTER")
+ #(sec 4)
+ #(cmd "RIGHT")
+ #(sec 2)
+ #(cmd "RIGHT")
];
}
];
diff --git a/makefu/2configs/home/ham/automation/flurlicht.nix b/makefu/2configs/home/ham/automation/flurlicht.nix
index aa62ab9e4..bb4877100 100644
--- a/makefu/2configs/home/ham/automation/flurlicht.nix
+++ b/makefu/2configs/home/ham/automation/flurlicht.nix
@@ -32,12 +32,16 @@ in
[
{ choose = [
(lightcond "Badezimmer Fenster Auf"
- { condition = "state"; entity_id = "binary_sensor.badezimmer_fenster_contact"; state = "on"; }
- [ 64 207 255 ] 255 # helblau
+ [ { condition = "state"; entity_id = "binary_sensor.badezimmer_fenster_contact"; state = "on"; }
+ { condition = "state"; entity_id = "input_boolean.ist_sommer"; state = "off"; }
+
+ ]
+ [ 64 207 255 ] 128 # hellblau
)
(lightcond "Duschenster auf"
- { condition = "state"; entity_id = "binary_sensor.dusche_fenster_contact"; state = "on"; }
- [ 64 207 255 ] 255 # helblau
+ [ { condition = "state"; entity_id = "binary_sensor.dusche_fenster_contact"; state = "on"; }
+ { condition = "state"; entity_id = "input_boolean.ist_sommer"; state = "off"; } ]
+ [ 64 207 255 ] 128 # hellblau
)
(lightcond "Nachtlicht"
{ condition = "state"; entity_id = "sun.sun"; state = "below_horizon"; }
diff --git a/makefu/2configs/home/ham/automation/shutdown_button.nix b/makefu/2configs/home/ham/automation/shutdown_button.nix
index 4c12be277..ec1a25567 100644
--- a/makefu/2configs/home/ham/automation/shutdown_button.nix
+++ b/makefu/2configs/home/ham/automation/shutdown_button.nix
@@ -1,5 +1,8 @@
let
btn = "sensor.arbeitszimmer_btn1_action";
+ lib = import ../lib;
+ say = lib.say.living_room;
+
all_lights = [
# Wohnzimmer
"light.wled"
@@ -21,6 +24,8 @@ let
all_media_player = [
"media_player.living_room"
"media_player.office"
+ "media_player.bedroom"
+
];
in {
services.home-assistant.config.automation =
@@ -30,13 +35,13 @@ in {
{
platform = "state";
entity_id = btn;
- to = "on";
+ to = "single";
}
];
condition = [ ];
- action = [
+ action = (say "Alles Aus" )++ [
{
- service = "home_assistant.turn_off";
+ service = "light.turn_off";
target.entity_id = all_lights;
}
{ service = "media_player.media_stop";
diff --git a/makefu/2configs/home/ham/automation/urlaub.nix b/makefu/2configs/home/ham/automation/urlaub.nix
index c11c589cf..7f47c9da5 100644
--- a/makefu/2configs/home/ham/automation/urlaub.nix
+++ b/makefu/2configs/home/ham/automation/urlaub.nix
@@ -4,7 +4,10 @@
# "all" lights
let
- schranklicht = "light.wohnzimmer_schrank_osram";
+ schranklicht = [
+ "light.wohnzimmer_schrank_osram"
+ "light.wohnzimmer_komode_osram"
+ ];
weihnachtslicht = "light.wohnzimmer_fenster_lichterkette_licht";
fernsehlicht = "light.wled";
@@ -24,7 +27,7 @@ let
turn_on = entity_id: offset:
# negative offset => before sunset
- { alias = "Turn on ${entity_id} at sunset ${offset}";
+ { alias = "Turn on ${toString entity_id} at sunset ${offset}";
trigger = [
{ platform = "sun"; event = "sunset"; inherit offset; }
];
diff --git a/makefu/2configs/home/ham/default.nix b/makefu/2configs/home/ham/default.nix
index f54fd32f7..b08152935 100644
--- a/makefu/2configs/home/ham/default.nix
+++ b/makefu/2configs/home/ham/default.nix
@@ -24,13 +24,17 @@ in {
./device_tracker/tile.nix
./sensor/outside.nix
+ ./sensor/pollen.nix
+ ./sensor/dwd.nix
./calendar/nextcloud.nix
./media/firetv.nix
./media/sonos.nix
+ ./media/schlafzimmer_music_remote.nix
./media/remote_sound_wohnzimmer.nix
./media/remote_sound_arbeitszimmer.nix
+ ./media/arbeitszimmer_matrix.nix
./automation/check-in.nix
./automation/fenster_auf.nix
@@ -41,9 +45,12 @@ in {
./automation/flurlicht.nix
./automation/giesskanne.nix
./automation/pflanzen_giessen_erinnerung.nix
- ./automation/urlaub.nix
+ # ./automation/urlaub.nix
./automation/moodlight.nix
./automation/shutdown_button.nix
+ ./automation/project_tracker.nix
+ ./automation/daily_speedtext.nix
+
./light/arbeitszimmer.nix
./light/schlafzimmer.nix
@@ -53,18 +60,14 @@ in {
];
services.home-assistant = {
- package = (pkgs.home-assistant.overrideAttrs (old: {
- doInstallCheck = false;
- })).override {
- extraPackages = p: [
- (p.callPackage ./deps/dwdwfsapi.nix {})
- # (p.callPackage ./signal-rest/pkg.nix {})
- (p.callPackage ./deps/pykodi.nix {})
- ];
- };
+ extraComponents = [ "mobile_app" ];
+ extraPackages = python3Packages: with python3Packages; [ pytz ];
config = {
+ default_config = {}; # for sonos aiodiscover
+
influxdb = {
+ api_version = 1;
database = "ham";
host = "localhost";
tags = {
@@ -87,6 +90,25 @@ in {
{ type = "homeassistant"; }
];
};
+ binary_sensor = [
+ { platform = "workday";
+ name = "Arbeitstag";
+ country = "DE";
+ province = "BW";
+ }
+ { platform = "workday";
+ name = "Arbeitstag Morgen";
+ country = "DE";
+ province = "BW";
+ days_offset = 1;
+ }
+ { platform = "workday";
+ name = "Arbeitstag Gestern";
+ country = "DE";
+ province = "BW";
+ days_offset = 1;
+ }
+ ];
discovery = {};
conversation = {};
history = {};
@@ -141,22 +163,19 @@ in {
retain = true;
};
};
- #luftdaten = {
- # show_on_map = true;
- # sensor_id = 10529;
- # sensors.monitored_conditions = [ "P1" "P2" ];
- #};
+ luftdaten = {
+ # show_on_map = true;
+ sensor_id = 72935;
+ # sensors.monitored_conditions = [ "P1" "P2" ];
+ };
#binary_sensor =
# flurlicht.binary_sensor;
sensor = [
- { platform = "speedtestdotnet";
- scan_interval.hours = 6;
- monitored_conditions = [ "ping" "download" "upload" ];
- }
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
];
frontend = { };
+ speedtestdotnet = { };
http = {
use_x_forwarded_for = true;
#server_host = "127.0.0.1";
@@ -167,6 +186,7 @@ in {
switch = [];
automation = [];
script = { };
+ media_source = {};
};
enable = true;
configDir = hassdir;
diff --git a/makefu/2configs/home/ham/lib/default.nix b/makefu/2configs/home/ham/lib/default.nix
index 67e8e902d..cf1c32abd 100644
--- a/makefu/2configs/home/ham/lib/default.nix
+++ b/makefu/2configs/home/ham/lib/default.nix
@@ -14,7 +14,7 @@ in
{
service = "tts.google_say";
data = {
- entity_id = entity;
+ entity_id = entity;
inherit message;
language = "de";
};
@@ -27,10 +27,7 @@ in
#}
{ delay.seconds = 1; }
{ delay = ''
- {% set duration = states.${entity}.attributes.media_duration %}
- {% if duration > 0 %}
- {% set duration = duration - 1 %}
- {% endif %}
+ {% set duration = state_attr("${entity}","media_duration") %}
{% set seconds = duration % 60 %}
{% set minutes = (duration / 60)|int % 60 %}
{% set hours = (duration / 3600)|int %}
@@ -53,6 +50,10 @@ in
inherit message;
entity = "media_player.office";
};
+ bedroom = message: tts {
+ inherit message;
+ entity = "media_player.bedroom";
+ };
};
zigbee.prefix = "/ham/zigbee";
diff --git a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix b/makefu/2configs/home/ham/light/tint_wohnzimmer.nix
index 474bf5c99..243243816 100644
--- a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix
+++ b/makefu/2configs/home/ham/light/tint_wohnzimmer.nix
@@ -21,24 +21,26 @@ let
group_id_2 = 16389;
group_id_3 = 16390;
remote = "sensor.schlafzimmer_remote1_action";
- main_light_1 = "light.wled";
+ main_light_1 = "light.wled"; # fernseher
+ main_light_2 = "light.wled_2"; #fernsehwand
+
default_scene_1 = "Solid";
default_color_1 = "Default";
main_color_select_1 = "select.wled_color_palette";
light_group_1.entity_id = [
main_light_1
+ main_light_2
];
# contains only the actually changeable lights
- light_group_2 = { entity_id = [
+ light_group_2.entity_id = [
"light.wohnzimmer_komode_osram"
"light.wohnzimmer_schrank_osram"
"light.wohnzimmer_fenster_lichterkette_licht"
];
- };
- light_group_3 = { entity_id = [
+ light_group_3.entity_id = [
"light.wohnzimmer_stehlampe_osram"
- ]; };
+ ];
statecond = cond: { # cond must be a list
condition = "template";
diff --git a/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix b/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix
index bd36f02cd..26fec370f 100644
--- a/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix
+++ b/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix
@@ -32,10 +32,12 @@ in
services.home-assistant.config.automation =
[
{ alias = "Arbeitszimmer Matrix music action";
+ mode = "queued";
trigger = [
{
platform = "state";
entity_id = all_buttons;
+ to = "on"; # ignore 'unavailable'
}
];
action =
@@ -59,17 +61,11 @@ in
}
)
- (remote_action "b9"
- ((say "Guter Song {{ states.sensor.the_playlist_song.state }}") ++ [
- { service = "rest_command.good_song"; }
- ]))
+ (remote_action "b9" [ { service = "rest_command.good_song"; } ])
+ (remote_action "b10" [ { service = "rest_command.bad_song"; } ])
- (remote_action "b10"
- ((say "Schlechter Song {{ states.sensor.the_playlist_song.state }}") ++ [
- { service = "rest_command.bad_song"; }
- ]))
(remote_action "3"
- ((say "Starte Lassulus Super Radio") ++ [
+ ((say "Starte Lass") ++ [
{ service = "media_player.play_media";
data = {
media_content_id = "http://radio.lassul.us:8000/radio.mp3";
diff --git a/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix b/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix
index 55b1fd8f5..438ce6bda 100644
--- a/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix
+++ b/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix
@@ -3,7 +3,8 @@ let
remote = "sensor.schlafzimmer_music_remote_action";
hlib = import ../lib;
step = 0.03;
- room = "bedroom";
+ #room = "bedroom";
+ room = "living_room";
#room = "office";
player = "media_player.${room}";
@@ -68,6 +69,7 @@ in
services.home-assistant.config.automation =
[
{ alias = "Schlafzimmer music action";
+ mode = "queued";
trigger = [
{
platform = "state";
@@ -79,20 +81,27 @@ in
action =
[
{ choose = [
- (remote_action "on" { #also called by hold right and left
- service = "media_player.media_play";
- target.entity_id = player;
- })
- (remote_action "off"
- {
- service = "media_player.volume_mute";
+ (remote_action "on"
+ ((say "Starte Essensmusik") ++ [
+ { service = "media_player.play_media";
+ data = {
+ media_content_id = "https://listen.openstream.co/4457/audio.mp3";
+ media_content_type = "music";
+ };
target.entity_id = player;
- data.is_volume_muted = ''{{ not state_attr('${player}' , 'is_volume_muted') }}'';
}
+ ]))
+ (remote_action "off"
+ [
+ {
+ service = "media_player.media_stop";
+ target.entity_id = player;
+ }
+ ]
)
(remote_action "arrow_right_hold"
- ((say "Starte Lassulus Super Radio") ++ [
+ ((say "Starte Lass") ++ [
{ service = "media_player.play_media";
data = {
media_content_id = "http://radio.lassul.us:8000/radio.mp3";
@@ -101,7 +110,7 @@ in
target.entity_id = player;
}
]))
- (remote_action "arrow_left_hold"
+ (remote_action "arrow_left_hold"
((say "Starte Deep House Music") ++ [
{ service = "media_player.play_media";
data = {
@@ -111,12 +120,7 @@ in
target.entity_id = player;
}
]))
- #(remote_action "arrow_left_release" {
-
- #})
- #(remote_action "arrow_left_release" {
-
- #})
+
# TODO: choose random kindermusik?
(remote_action "brightness_move_up"
((say "Starte Liam Album") ++ [
@@ -130,14 +134,8 @@ in
}
])
)
- (remote_action "brightness_move_down"
- ((say "Stoppe Musik") ++ [
- {
- service = "media_player.media_stop";
- target.entity_id = player;
- }
- ])
- )
+ #(remote_action "brightness_move_down"
+ #)
(remote_action "arrow_right_click" {
service = "media_player.volume_set";
@@ -157,4 +155,4 @@ in
}
];
-} \ No newline at end of file
+}
diff --git a/makefu/2configs/home/ham/sensor/dwd.nix b/makefu/2configs/home/ham/sensor/dwd.nix
new file mode 100644
index 000000000..c1d55d03c
--- /dev/null
+++ b/makefu/2configs/home/ham/sensor/dwd.nix
@@ -0,0 +1,8 @@
+{
+ services.home-assistant.config.sensor =
+ [
+ { platform = "dwd_weather_warnings";
+ region_name = "Stadt Stuttgart";
+ }
+ ];
+}
diff --git a/makefu/2configs/home/ham/sensor/pollen.nix b/makefu/2configs/home/ham/sensor/pollen.nix
new file mode 100644
index 000000000..d95c199bf
--- /dev/null
+++ b/makefu/2configs/home/ham/sensor/pollen.nix
@@ -0,0 +1,65 @@
+{ pkgs, lib, ... }:
+with lib;
+let
+ region = "112";
+ types = [
+ "Erle"
+ "Beifuss"
+ "Ambrosia"
+ "Birke"
+ "Esche"
+ "Hasel"
+ "Graeser"
+ "Roggen"
+ ];
+ gen_tomorrow_sensor = type: {
+ name = "dwd_pollenbelastung_${toLower type}_tomorrow";
+ value = {
+ icon_template = "mdi:grass";
+ friendly_name = "${type} Morgen";
+ value_template = "{{ state_attr('sensor.dwd_pollenbelastung_${toLower type}', 'tomorrow') }}";
+ };
+ };
+ gen_sensor = type: {
+ name = "dwd_pollenbelastung_${toLower type}";
+ value = {
+ icon_template = "mdi:tree-outline";
+ friendly_name = type;
+ value_template = ''
+ {% set dwd_state = state_attr('sensor.dwd_pollenbelastung_stuttgart', '${type}')['today'] %}
+ {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %}
+ '';
+ attribute_templates.today = ''
+ {% set dwd_state = state_attr('sensor.dwd_pollenbelastung_stuttgart', '${type}')['today'] %}
+ {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %}
+ '';
+ attribute_templates.tomorrow = ''
+ {% set dwd_state = state_attr('sensor.dwd_pollenbelastung_stuttgart', '${type}')['tomorrow'] %}
+ {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %}
+ '';
+ # -1 == unknown
+ #attribute_templates.dayafter = ''
+ # {% set dwd_state = state_attr('sensor.dwd_pollenbelastung', '${type}')['dayafter_to'] %}
+ # {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% elif dwd_state == "-1"%}-1{% else %}0{% endif %}
+ #'';
+ };
+ };
+in
+ {
+ services.home-assistant.config.sensor = [
+ {
+ platform = "rest";
+ scan_interval = 3600;
+ name = "DWD Pollenbelastung Stuttgart";
+ resource = "https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json";
+ json_attributes_path = "$..content[?(@.partregion_id==${region})].Pollen";
+ json_attributes = types;
+ value_template = "{{ value_json.last_update }}";
+ }
+ {
+ platform = "template";
+ sensors = (listToAttrs (map gen_sensor types)) //
+ (listToAttrs (map gen_tomorrow_sensor types)) ;
+ }
+ ];
+}
diff --git a/makefu/2configs/home/ham/signal-rest/service.nix b/makefu/2configs/home/ham/signal-rest/service.nix
index 250a3596d..1f718efa5 100644
--- a/makefu/2configs/home/ham/signal-rest/service.nix
+++ b/makefu/2configs/home/ham/signal-rest/service.nix
@@ -14,5 +14,7 @@ in {
volumes = [
"${config}:/home/.local/share/signal-cli"
];
+ environment.MODE ="json-rpc";
+ #environment.MODE ="native"; # only required for reigstration
};
}
diff --git a/makefu/2configs/home/ham/zigbee2mqtt.nix b/makefu/2configs/home/ham/zigbee2mqtt.nix
index 7809dbb51..efcbb0d00 100644
--- a/makefu/2configs/home/ham/zigbee2mqtt.nix
+++ b/makefu/2configs/home/ham/zigbee2mqtt.nix
@@ -38,93 +38,6 @@ in
icon = "mdi:chip";
}
];
- switch = [
- {
- platform = "mqtt";
- name = "Zigbee2mqtt Main join";
- state_topic = "${prefix}/bridge/config/permit_join";
- command_topic = "${prefix}/bridge/config/permit_join";
- payload_on = "true";
- payload_off = "false";
- }
- ];
- automation = [
- {
- alias = "Zigbee2mqtt Log Level";
- initial_state = "on";
- trigger = {
- platform = "state";
- entity_id = "input_select.zigbee2mqtt_log_level";
- };
- action = [
- {
- service = "mqtt.publish";
- data = {
- payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}";
- topic = "${prefix}/bridge/config/log_level";
- };
- }
- ];
- }
- # Automation to start timer when enable join is turned on
- {
- id = "zigbee_join_enabled";
- alias = "Zigbee Join Enabled";
- trigger =
- {
- platform = "state";
- entity_id = "switch.zigbee2mqtt_main_join";
- to = "on";
- };
- action =
- {
- service = "timer.start";
- entity_id = "timer.zigbee_permit_join";
- };
- }
- # # Automation to stop timer when switch turned off and turn off switch when timer finished
- {
- id = "zigbee_join_disabled";
- alias = "Zigbee Join Disabled";
- trigger = [
- {
- platform = "event";
- event_type = "timer.finished";
- event_data.entity_id = "timer.zigbee_permit_join";
- }
- {
- platform = "state";
- entity_id = "switch.zigbee2mqtt_main_join";
- to = "off";
- }
- ];
- action = [
- { service = "timer.cancel";
- data.entity_id = "timer.zigbee_permit_join";
- }
- { service = "switch.turn_off";
- entity_id = "switch.zigbee2mqtt_main_join";
- }
- ];
- }
- ];
- input_select.zigbee2mqtt_log_level =
- {
- name = "Zigbee2mqtt Log Level";
- options = [
- "debug"
- "info"
- "warn"
- "error"
- ];
- initial = "info";
- icon = "mdi:format-list-bulleted";
- };
- timer.zigbee_permit_join =
- {
- name = "Zigbee Time remaining";