Weather forecast plot (meta
and nested attributes)
#213
Replies: 6 comments 17 replies
-
This is awesome! I use it to display the forecast for three different weather stations since they're all so different. I have temperature, humidity, dew point and precipitation probability. (I know, not the prettiest way to display, but I like it). Question. What will become of this with the new weather entities that no longer have a "forecast" attribute, and instead needs to call a service? Any known workaround? |
Beta Was this translation helpful? Give feedback.
-
Hi @dbuezas the pirate weather integration provides individual sensors for forecast - the sensor name then appended with _1d, _2d etc up to _7d and _1h, _2h etc up to _48h. I feel this should be easy to map into a forecast in plotly but the filter fn coding is beyond me. Do you have any insight how to vary your above example please? |
Beta Was this translation helpful? Give feedback.
-
Here's what I've done In configuration.yaml - trigger:
- platform: state
entity_id:
- weather.weather_channel
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.weather_channel
response_variable: hourly In the chart card - entity: sensor.weather_channel_forecast_hourly
showlegend: false
legendgroup: 1
line:
color: '#ffcfb2'
width: 1
unit_of_measurement: °F
filters:
- fn: |-
({ meta, vars }) => ({
xs: [...meta.forecast.map(({ datetime }) => new Date(datetime))],
ys: [...meta.forecast.map(({ temperature }) => temperature)],
}) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I've got @Arrow-hub's method of forecast working - I want to plot 120 hourly datapoints into the future so even with @dbuezas's streamlined version of my code it gets a bit too chunky.
I've tried all variations of map_x and resample and !=null but to no avail.
Since I want to plot vars.solar.ys onto vars.cloud.xs, I have made a rough equation that takes hass states of the various sun entities to give a y value with the only variable changing per data point the timestamp of the x value, but how would I plot that array for 120 datapoints provided by xs: [...meta.timelines[0].intervals.map(({ startTime }) => new Date(startTime))]? This is the code I would use to make y, and hopefully include in fn: ys::
|
Beta Was this translation helpful? Give feedback.
-
hi! Today I've updated home assistant to latest: And now I have an error in all the cards that I had with a forecast line on them... I receive this ERROR: Do you have the same issue? do you know how to solve it? |
Beta Was this translation helpful? Give feedback.
-
Update
In newer HA versions you'll need a template sensor since the forecast attributes are not stored automatically.
Beta Was this translation helpful? Give feedback.
All reactions