I’m trying to read multiple values into a sensor’s attributes for weather forecasting, but I can’t figure it out.
I’ve tried various ways of doing this via stuff posted here and Github, but they always error or come back as unavailable
no matter which way I configure it.
- resource: https://www.myarea.weather
scan_interval: 864000
headers:
User-Agent: Mozilla/5.0
sensor:
- unique_id: templow_forecast
name: Temperature Forecast
value_template: "{{ value.split(':')[1]|replace('°C', ' ')|trim }}"
select: "#forecastContainer > li:nth-child(1) > span:nth-child(4)"
attributes:
- name: Day1_templow
select: "#forecastContainer > li:nth-child(1) > span:nth-child(4)"
value_template: "{{ value.split(':')[1]|replace('°C', ' ')|trim }}"
- name: Day2_templow
select: "#forecastContainer > li:nth-child(2) > span:nth-child(4)"
value_template: "{{ value.split(':')[1]|replace('°C', ' ')|trim }}"
- name: Day3_templow
select: "#forecastContainer > li:nth-child(3) > span:nth-child(4)"
value_template: "{{ value.split(':')[1]|replace('°C', ' ')|trim }}"
- name: Day4_templow
select: "#forecastContainer > li:nth-child(4) > span:nth-child(4)"
value_template: "{{ value.split(':')[1]|replace('°C', ' ')|trim }}"
- name: Day5_templow
select: "#forecastContainer > li:nth-child(5) > span:nth-child(4)"
value_template: "{{ value.split(':')[1]|replace('°C', ' ')|trim }}"
I was able to do it by reading each day into an individual sensor i.e. Day1_templow
, Day2_templow
but I’d rather it be one entity so I can use it on my weather card. It may not even work with the card, I always have issues with custom forecast data and I’m not sure how to get it set up to read properly, but that’s a separate issue.
How on earth do I do this?