rossc719
(Charlie Ross)
August 11, 2024, 5:12am
1
I’m trying to get “today’s high temp”. I was hoping this would be easy, but it seems to be tricky for two reasons:
Accuweather seems to only want to give me “RealFeel” numbers which are not just temps, they are adjusted for humidity and such. I am looking for the actual real, what would be measured by a thermometer, temp.
It also seems to give numbers “For the next 24h period” not “today”.
Any advice on how to just get today’s forecasted high?
The weather entity should have high/low for the day in the forecasts.
rossc719
(Charlie Ross)
August 11, 2024, 9:05am
3
Then I must be missing something obvious. How can I access it? If my entity is called weather.foo, what can I put into my yaml template to get it?
You need to call the forecasts service and read the response. Gave it a quick shot for you since I’m also using accuweather, and temperature
matches the high for today.
Request:
service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.home_2
Response (truncated)
weather.home_2:
forecast:
- datetime: "2024-08-11T05:00:00+00:00"
cloud_coverage: 0
precipitation_probability: 0
uv_index: 10
wind_bearing: 315
condition: sunny
temperature: 33.8
apparent_temperature: 39.8
templow: 25.1
wind_gust_speed: 22.2
wind_speed: 9.3
precipitation: 0
humidity: 54
- datetime: "2024-08-12
...
temperature
and templow
match today’s forecast as shown in the more info in my weather card for today
rossc719
(Charlie Ross)
August 11, 2024, 11:13am
5
Thanks, this is exactly what I needed.
Using this,I ended up making a template with a bunch of sensors in it to expose the info for today and tomorrow. This lets me use these values in automations (e.g., keep the blinds closed all day if the high is greater than X° etc… )
Thanks!
template:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- action: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.home
response_variable: daily
sensor:
- name: Forecast Today Condition
unique_id: forecast_today_condition
state: "{{ daily['weather.home'].forecast[0].condition }}"
icon: mdi:weather-partly-rainy
- name: Forecast Today Temperature
unique_id: forecast_today_temperature
state: "{{ daily['weather.home'].forecast[0].temperature }}"
unit_of_measurement: °F
device_class: temperature
- name: Forecast Today Low Temperature
unique_id: forecast_today_templow
state: "{{ daily['weather.home'].forecast[0].templow }}"
unit_of_measurement: °F
device_class: temperature
- name: Forecast Today Apparent Temperature
unique_id: forecast_today_high_apparent_temperature
state: "{{ daily['weather.home'].forecast[0].apparent_temperature }}"
unit_of_measurement: °F
device_class: temperature
- name: Forecast Today Humidity
unique_id: forecast_today_humidity
state: "{{ daily['weather.home'].forecast[0].humidity }}"
unit_of_measurement: '%'
device_class: humidity
- name: Forecast Today Cloud Cover
unique_id: forecast_today_cloud_cover
state: "{{ daily['weather.home'].forecast[0].cloud_coverage }}"
unit_of_measurement: '%'
icon: mdi:cloud
- name: Forecast Today Precipitation Probability
unique_id: forecast_today_precipitation_probability
state: "{{ daily['weather.home'].forecast[0].precipitation_probability }}"
unit_of_measurement: '%'
icon: mdi:water-percent
- name: Forecast Today Precipitation
unique_id: forecast_today_precipitation
state: "{{ daily['weather.home'].forecast[0].precipitation }}"
unit_of_measurement: in
icon: mdi:water
- name: Forecast Today UV Index
unique_id: forecast_today_uv_index
state: "{{ daily['weather.home'].forecast[0].uv_index }}"
unit_of_measurement: 'UV index'
icon: mdi:sun-wireless
- name: Forecast Today Wind Bearing
unique_id: forecast_today_wind_bearing
state: "{{ daily['weather.home'].forecast[0].wind_bearing }}"
unit_of_measurement: °
icon: mdi:compass
- name: Forecast Today Wind Speed
unique_id: forecast_today_wind_speed
state: "{{ daily['weather.home'].forecast[0].wind_speed }}"
unit_of_measurement: mph
icon: mdi:weather-windy
- name: Forecast Today Wind Gust Speed
unique_id: forecast_today_wind_gust_speed
state: "{{ daily['weather.home'].forecast[0].wind_gust_speed }}"
unit_of_measurement: mph
icon: mdi:weather-windy
- name: Forecast Tomorrow Condition
unique_id: forecast_tomorrow_condition
state: "{{ daily['weather.home'].forecast[1].condition }}"
icon: mdi:weather-partly-rainy
- name: Forecast Tomorrow Temperature
unique_id: forecast_tomorrow_temperature
state: "{{ daily['weather.home'].forecast[1].temperature }}"
unit_of_measurement: °F
device_class: temperature
- name: Forecast Tomorrow Low Temperature
unique_id: forecast_tomorrow_templow
state: "{{ daily['weather.home'].forecast[1].templow }}"
unit_of_measurement: °F
device_class: temperature
- name: Forecast Tomorrow Apparent Temperature
unique_id: forecast_tomorrow_high_apparent_temperature
state: "{{ daily['weather.home'].forecast[1].apparent_temperature }}"
unit_of_measurement: °F
device_class: temperature
- name: Forecast Tomorrow Humidity
unique_id: forecast_tomorrow_humidity
state: "{{ daily['weather.home'].forecast[1].humidity }}"
unit_of_measurement: '%'
device_class: humidity
- name: Forecast Tomorrow Cloud Cover
unique_id: forecast_tomorrow_cloud_cover
state: "{{ daily['weather.home'].forecast[1].cloud_coverage }}"
unit_of_measurement: '%'
icon: mdi:cloud
- name: Forecast Tomorrow Precipitation Probability
unique_id: forecast_tomorrow_precipitation_probability
state: "{{ daily['weather.home'].forecast[1].precipitation_probability }}"
unit_of_measurement: '%'
icon: mdi:water-percent
- name: Forecast Tomorrow Precipitation
unique_id: forecast_tomorrow_precipitation
state: "{{ daily['weather.home'].forecast[1].precipitation }}"
unit_of_measurement: in
icon: mdi:water
- name: Forecast Tomorrow UV Index
unique_id: forecast_tomorrow_uv_index
state: "{{ daily['weather.home'].forecast[1].uv_index }}"
unit_of_measurement: 'UV index'
icon: mdi:sun-wireless
- name: Forecast Tomorrow Wind Bearing
unique_id: forecast_tomorrow_wind_bearing
state: "{{ daily['weather.home'].forecast[1].wind_bearing }}"
unit_of_measurement: °
icon: mdi:compass
- name: Forecast Tomorrow Wind Speed
unique_id: forecast_tomorrow_wind_speed
state: "{{ daily['weather.home'].forecast[1].wind_speed }}"
unit_of_measurement: mph
icon: mdi:weather-windy
- name: Forecast Tomorrow Wind Gust Speed
unique_id: forecast_tomorrow_wind_gust_speed
state: "{{ daily['weather.home'].forecast[1].wind_gust_speed }}"
unit_of_measurement: mph
icon: mdi:weather-windy
1 Like
I’m far from being an expert, but won’t that always show the icon as partly rainy?
If this is what you intended, then great. If not, you might run into the situation where it’s sunny and the icon will be incorrect.
(PS - before you ask, I have no idea how to return the correct icon depending on weather. I would just remove it and pray it handles it by itself)