diff options
Diffstat (limited to 'makefu/2configs/home/ham/sensor')
-rw-r--r-- | makefu/2configs/home/ham/sensor/dwd.nix | 10 | ||||
-rw-r--r-- | makefu/2configs/home/ham/sensor/outside.nix | 55 | ||||
-rw-r--r-- | makefu/2configs/home/ham/sensor/pollen.nix | 65 |
3 files changed, 0 insertions, 130 deletions
diff --git a/makefu/2configs/home/ham/sensor/dwd.nix b/makefu/2configs/home/ham/sensor/dwd.nix deleted file mode 100644 index 623f099a3..000000000 --- a/makefu/2configs/home/ham/sensor/dwd.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - services.home-assistant.config.sensor = - [ - { platform = "dwd_weather_warnings"; - region_name = "Stadt Stuttgart"; - } - { platform = "nina"; - } - ]; -} diff --git a/makefu/2configs/home/ham/sensor/outside.nix b/makefu/2configs/home/ham/sensor/outside.nix deleted file mode 100644 index 061c4e981..000000000 --- a/makefu/2configs/home/ham/sensor/outside.nix +++ /dev/null @@ -1,55 +0,0 @@ -{lib,...}: - -{ - services.home-assistant.config.sensor = - [ - { platform = "darksky"; - api_key = "!secret darksky"; - language = "de"; - monitored_conditions = [ - "summary" "icon" - "nearest_storm_distance" "precip_probability" - "precip_intensity" - "temperature" # "temperature_high" "temperature_low" - "apparent_temperature" - "hourly_summary" # next 24 hours text - "humidity" - "pressure" - "uv_index" - ]; - units = "si" ; - scan_interval = "00:30:00"; - } - { - platform = "open_meteo"; - } - { - platform = "met"; - } - { - platform = "openweathermap"; - api_key = "!secret openweathermap"; - language = "de"; - mode = "hourly"; - } - { - platform = "tomorrowio"; - api_key = "!secret tomorrowio"; - } - { platform = "octoprint"; } - { platform = "accuweather"; - api_key = "!secret accuweather"; - } - { platform = "scrape"; - resource = "https://www.swr.de/wetter/wetter-liste-swr-100.html"; - name = "SWR Prognose"; - select = "p[data-refresh=\"weather-headline\"]"; - } - { platform = "scrape"; - resource = "https://www.swr.de/wetter/wetter-liste-swr-100.html"; - name = "SWR Prognose Langtext"; - select = "p[data-refresh=\"weather-text\"]"; - } - - ]; -} diff --git a/makefu/2configs/home/ham/sensor/pollen.nix b/makefu/2configs/home/ham/sensor/pollen.nix deleted file mode 100644 index d95c199bf..000000000 --- a/makefu/2configs/home/ham/sensor/pollen.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ 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)) ; - } - ]; -} |