Forecast attribute in array
-
Good morning,
I'm sorry if this has been asked (I did search, but couldn't find anything), I've run into a bit of a snag in some of my reactions using OpenWeatherMap. I made the assumption (you know what they say about assume), that the Forecast Temperature value was the Daily High, when in fact it's the current Temperature. It turns out you can get that information from OpenWeatherMap, but it's a on paid tier API.I am looking at alternatives, such as the haas>weather_forcast_home value from Home Assistant, as well as Pirate Weather, however, the value of those Forecast High is in an array.
How do I pull the values in that array out and make them useful in MSR?
I'm running latest-23078-d592d400 and HA 2023.3.5 on RPI4
-
Good morning,
I'm sorry if this has been asked (I did search, but couldn't find anything), I've run into a bit of a snag in some of my reactions using OpenWeatherMap. I made the assumption (you know what they say about assume), that the Forecast Temperature value was the Daily High, when in fact it's the current Temperature. It turns out you can get that information from OpenWeatherMap, but it's a on paid tier API.I am looking at alternatives, such as the haas>weather_forcast_home value from Home Assistant, as well as Pirate Weather, however, the value of those Forecast High is in an array.
How do I pull the values in that array out and make them useful in MSR?
I'm running latest-23078-d592d400 and HA 2023.3.5 on RPI4
@tamorgen You can extract the values in an expression like
(getEntity( "hass>weather_forecast_home" ).attributes.x_hass_attr.forecast)[0].temperature
Where
[0]
is the first object in the array (tomorrow) and.temperature
is the key you want to pull out. To get "lowtemp" simply change the key to.lowtemp
at the end of the expression. To get the next day after tomorrow, change to the second object in the array with[1]
.
The expression will result in the value for given key in given index.All available keys are exposed on the Entity page for your Hass forecast in the
x_hass_attr.forecast
attribute. -
@tamorgen You can extract the values in an expression like
(getEntity( "hass>weather_forecast_home" ).attributes.x_hass_attr.forecast)[0].temperature
Where
[0]
is the first object in the array (tomorrow) and.temperature
is the key you want to pull out. To get "lowtemp" simply change the key to.lowtemp
at the end of the expression. To get the next day after tomorrow, change to the second object in the array with[1]
.
The expression will result in the value for given key in given index.All available keys are exposed on the Entity page for your Hass forecast in the
x_hass_attr.forecast
attribute.