Hi guys.
I use met.mo integration for weather forecasting.
I would need to create a sensor in configuration file that shows the current temperature and the weather icon name.
I can’t figure out how to create the sensor with weather.get:forecast.
Give me a hand please.
Thank you
current is not equal to forecast
current: you could just create a template using the existing met.no and refer to its attribute(s)
forecast: you can use this
Template - Home Assistant (home-assistant.io)
and instead of hourly.forecast you can use e.g. the first one: hourly.forecast[0].temperature
thanks, I tried but the only one that doesn’t work is the current temperature.
I tried putting hourly in all positions but i could not get it to work. what is the correct syntax ?
- platform: template
sensors:
day1_cond:
friendly_name: "Day1 Condition"
value_template: "{{ state_attr('weather.forecast_home', 'forecast')[0].condition }}"
day1_temp:
friendly_name: "Day1 Temperature"
unit_of_measurement: '°C'
value_template: "{{ state_attr('weather.forecast_home', 'hourly')[0].temperature }}"
day1_temp_high:
friendly_name: "Day1 hight Temperature"
unit_of_measurement: '°C'
value_template: "{{ state_attr('weather.forecast_home', 'forecast')[0].temperature }}"
day1_temp_low:
friendly_name: "Day1 Low Temperature"
unit_of_measurement: '°C'
value_template: "{{ state_attr('weather.forecast_home', 'forecast')[0].templow }}"
You have multiple and the first one containt ‘hourly’ where I guess you have no attribute ‘hourly’
What met.no sensor are you using, the one displaying daily forecast or did you use the link I sent to create one for hourly figures?
I wonder if it is a good idea to start now using forecast Attributes if they are currently going to be removed. I would recommend to directly go the new way. See release thread and attribute Petition.
I am using weather card for data and with Meteorologisk institutt integration.