Ciprian
(Ciprian)
June 21, 2020, 8:02pm
1
Hello,
I have integrated Openweathermap and I want to have a sensor that shows me the current weather condition.
I created four sensors but only weather_code doesn’t work properly and I don’t understand why.
weather:
- platform: openweathermap
api_key: !secret openweather_api
owm_temperature:
friendly_name: 'Temperature'
unit_of_measurement: '°C'
value_template: "{{ state_attr('weather.openweathermap', 'temperature') }}"
device_class: temperature
owm_humidity:
friendly_name: 'Humidity'
unit_of_measurement: '%'
value_template: "{{ state_attr('weather.openweathermap', 'humidity') }}"
owm_weather_code:
friendly_name: 'Weather Code'
value_template: "{{ state_attr('weather.openweathermap', 'weather_code') }}"
owm_weather_wind_speed:
friendly_name: 'Wind Speed'
unit_of_measurement: 'km/h'
value_template: "{{ state_attr('weather.openweathermap', 'wind_speed') }}"
Thank you for help!
Ciprian
In dev tools have you checked the state and attributes for weather.openweathermap? What does it show for weather_code in there? Your yaml looks ok to me.
Ciprian
(Ciprian)
June 22, 2020, 11:19pm
3
DavidFW1960:
weather.openweathermap
Hello @DavidFW1960 ,
I forgot to check in dev tools.
This is how it looks:
Thx!
I don’t see a weather_code attribute there…
ZombiEd
(Edward Omiccioli)
June 23, 2020, 12:54am
5
Here is how I set openweathermap up
- platform: openweathermap
api_key: !secret openweather_api_key
monitored_conditions:
- weather
- temperature
- wind_speed
- humidity
- pressure
- clouds
- rain
- snow
- weather_code
You can add/remove what ever sensors you need. weather ends up being the text version of the weather_code
Ciprian
(Ciprian)
June 23, 2020, 7:20pm
6
Hi,
Now I tested your config and I receive the error:
Invalid config for [weather.openweathermap]: [monitored_conditions] is an invalid option for [weather.openweathermap]. Check: weather.openweathermap->monitored_conditions. (See ?, line ?).
My config:
weather:
- platform: openweathermap
api_key: !secret openweather_api
monitored_conditions:
- weather
- temperature
- wind_speed
- humidity
- pressure
- clouds
- rain
- snow
- weather_code
Thank you!
Ciprian
(Ciprian)
June 23, 2020, 7:51pm
7
Hi,
I had an error in the code, now everything is fine.
Correct code is looking like this:
weather:
- platform: openweathermap
api_key: !secret openweather_api
sensor:
- platform: openweathermap
api_key: !secret openweather_api
monitored_conditions:
- weather
- temperature
- wind_speed
- humidity
- pressure
- clouds
- rain
- snow
- weather_code```
Thank you!
ZombiEd
(Edward Omiccioli)
June 23, 2020, 9:47pm
8
Good! Glad it is working for you.