I need the lowest temperature at night. I looked inside the API and found this at the daily section:
daily.temp.night = Night temperature.
Can this be implemented in the future?
I need the lowest temperature at night. I looked inside the API and found this at the daily section:
daily.temp.night = Night temperature.
Can this be implemented in the future?
I actually use the temperature_low. But this is not the lowest temperature at night
Hello!
I understand that this thread is old, but as I am curious if there is still some development going on, I would like to point to a blog where the lowest forecast temperature using OpenWeatherMap is calculated for a frost alert. The blog is in German but non-German speakers will understand the code.
BTW, I did some minor adjustments to the final code that I use in my HA:
/homeassistant/templates.yaml:
sensor:
### Frost alert
- name: Frost Alert
unique_id: frost_alert
state: >
{% set start = (now().date()+ timedelta(days=1)) | string + "T04:00:00+00:00"%}
{% set end = (now().date()+ timedelta(days=1)) | string + "T08:00:00+00:00"%}
{% set temp_frost_alert = (state_attr('weather.openweathermap_hourly', 'forecast') | selectattr("datetime", ">=", start) | selectattr("datetime", "<=", end) | map(attribute="temperature") | list | min)%}
{% set result_frost_alert = temp_frost_alert < 6 %}
{{result_frost_alert}}
- name: Frost Temperature
unique_id: frost_temperature
state: >
{% set start = (now().date()+ timedelta(days=1)) | string + "T04:00:00+00:00"%}
{% set end = (now().date()+ timedelta(days=1)) | string + "T08:00:00+00:00"%}
{% set temp_frost_alert = (state_attr('weather.openweathermap_hourly', 'forecast') | selectattr("datetime", ">=", start) | selectattr("datetime", "<=", end) | map(attribute="temperature") | list | min)%}
{{temp_frost_alert}}
- name: Frost Time
unique_id: frost_time
state: >
{% set start = (now().date()+ timedelta(days=1)) | string + "T04:00:00+00:00"%}
{% set end = (now().date()+ timedelta(days=1)) | string + "T08:00:00+00:00"%}
{% set temp_frost_alert = (state_attr('weather.openweathermap_hourly', 'forecast') | selectattr("datetime", ">=", start) | selectattr("datetime", "<=", end) | map(attribute="temperature") | list | min)%}
{% set result_frost_alert = temp_frost_alert < 6 %}
{% set time_frost_alert = (state_attr('weather.openweathermap_hourly', 'forecast') | selectattr("datetime", ">=", start) | selectattr("datetime", "<=", end) | selectattr("temperature", "eq", temp_frost_alert)| map(attribute="datetime") | list | first )%}
{{as_timestamp(time_frost_alert) | timestamp_custom("%H:%M") if time_frost_alert else ''}}
And the alert:
alias: Frost warning (OpenWeatherMap.org)
description: >-
Check in the evening if the min. temp. next day is below x °C and trigger warning if yes (incl. time and expected temp.)
trigger:
- platform: time
at: "17:00:00"
- platform: time
at: "18:00:00"
- platform: time
at: "19:00:00"
- platform: time
at: "20:00:00"
condition:
- condition: state
entity_id: sensor.frost_alert
state: "true"
action:
- service: notify.notify
data:
title: Frost warning (OWM.org)
message: >-
At {{states("sensor.frost_time")}} we will have
{{states("sensor.frost_temperature")}} °C.
mode: single
I’m not sure if it makes sense to trigger the checks 4 times (5 pm to 20 pm) or if just once suffices.
BTW:
Where does OWM store the API key and geo position in HA? Is it possible to place them elsewhere, i.e. in a secrets.yaml file?