cool… thank you!
same issue here… Now , I’ve created the new sensor that includes the forecast info. it has all the data
But how do you replace the code you mentioned at the beginning with “new version” to keep Plotly working as before?
filters:
- fn: |-
({ meta, vars }) => ({
xs: […meta.forecast.map(({ datetime }) => new Date(datetime))],
ys: […meta.forecast.map(({ temperature }) => temperature)],
})
(note that since the get_forecasts service places the forecast under hourly > ‘weather.weather_channel’ which itself contains a period, I have to use square bracket indexing [ … ] instead of the dot (.) operator to access the forecast list. “hourly.weather.weather_channel.forecast” will not work)
In the chart card
- entity: sensor.weather_channel_forecast_hourly
unit_of_measurement: °F
filters:
- fn: |-
({ meta, vars }) => ({
xs: [...meta.forecast.map(({ datetime }) => new Date(datetime))],
ys: [...meta.forecast.map(({ temperature }) => temperature)],
})
I’m quite new to HA and I’m fighting with basic things. I can’t place the yaml code in the configuration.yaml because I have automations.yaml and templates.yaml. How could I split this code in both files?
Finally I was able to add the code to templates.yaml. but I´m getting this error:
Error: at [entities.1.filters.0]: Error in filter: TypeError: Cannot read properties of undefined (reading ‘map’)
Error: at [entities.3.filters.0]: Error in filter: TypeError: Cannot read properties of undefined (reading ‘map’)