summaryrefslogtreecommitdiff
path: root/hostnix
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-07-06 03:31:01 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 07:17:05 -0400
commit0c0b48b5da2dcfa6d98d27050c623cd6aa860c5e (patch)
tree1beacf134d0e87aa80c5efe2155ff5ef26e1fbc6 /hostnix
parent4d186d04b5945a9c06c45cbab9c5d6c3e0b889e7 (diff)
HA: Check for rain
Diffstat (limited to 'hostnix')
-rw-r--r--hostnix/elmo/home-assistant.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/hostnix/elmo/home-assistant.nix b/hostnix/elmo/home-assistant.nix
index d17c41b..5648a0f 100644
--- a/hostnix/elmo/home-assistant.nix
+++ b/hostnix/elmo/home-assistant.nix
@@ -80,6 +80,7 @@ in
use_x_forwarded_for = true;
};
recorder.db_url = "postgresql://@/hass";
+
auth_oidc = {
client_id = "9332ad56-1917-4f12-a0ef-f6ff69994cf4";
discovery_url = "https://pi.mou.fo/.well-known/openid-configuration";
@@ -102,6 +103,13 @@ in
brightness_mode_time_light = 3 * 60 * 60;
};
+ input_boolean = {
+ rain_today = {
+ name = "Rain today";
+ icon = "mdi:weather-rainy";
+ };
+ };
+
template = [
{
switch = [
@@ -369,6 +377,44 @@ in
];
}
+ {
+ id = "check_rain_forecast";
+ alias = "Check rain forecast";
+ trigger = [ (ha.trigger.at "05:00") ];
+ action = [
+ {
+ action = "weather.get_forecasts";
+ target.entity_id = "weather.forecast_home";
+ data.type = "daily";
+ response_variable = "forecast";
+ }
+ {
+ "if" = [
+ {
+ condition = "template";
+ value_template = "{{ forecast['weather.forecast_home'].forecast[0].precipitation > 0 }}";
+ }
+ ];
+ "then" = [
+ {
+ action = "input_boolean.turn_on";
+ target.entity_id = "input_boolean.rain_today";
+ }
+ {
+ action = "notify.notify";
+ data.message = "Rain expected today ({{ forecast['weather.forecast_home'].forecast[0].precipitation }} inches)";
+ }
+ ];
+ "else" = [
+ {
+ action = "input_boolean.turn_off";
+ target.entity_id = "input_boolean.rain_today";
+ }
+ ];
+ }
+ ];
+ }
+
# The panel light can become unresponsive and need to be reboot.
{
id = "panel_light_reinitialize";