Thanks for pointing me in the right direction
(another post that also helped me alot: Mqtt sensor - how to load attributes - #6 by 123)
For the solution:
I got the MQTT broker installed and spent a few days working with node-red, but was still using automations from HA, so I skipped node-red because I couldn’t see the advantage?
So I ended up with a MQTT sensor with a forecast attribute that is a list (array) with 47 items, that each has temperature, precipitation and datetime and starts the day with being all blank.
From config.yaml:
mqtt:
sensor:
- name: "Vejret"
unique_id: "MQTT_Sensor_Vejret_2022_12_18"
state_topic: "outside/weather_sensor"
value_template: "{{ value_json.state }}"
json_attributes_topic: "outside/weather_sensor_attr"
json_attributes_template: >
{ "temperature": {{ value_json.forecast[0].temperature }},
"temperature": {{ value_json.forecast[1].temperature }},
"temperature": {{ value_json.forecast[2].temperature }},
"temperature": {{ value_json.forecast[3].temperature }},
"temperature": {{ value_json.forecast[4].temperature }},
"temperature": {{ value_json.forecast[5].temperature }},
"temperature": {{ value_json.forecast[6].temperature }},
"temperature": {{ value_json.forecast[7].temperature }},
"temperature": {{ value_json.forecast[8].temperature }},
"temperature": {{ value_json.forecast[9].temperature }},
"temperature": {{ value_json.forecast[10].temperature }},
"temperature": {{ value_json.forecast[11].temperature }},
"temperature": {{ value_json.forecast[12].temperature }},
"temperature": {{ value_json.forecast[13].temperature }},
"temperature": {{ value_json.forecast[14].temperature }},
"temperature": {{ value_json.forecast[15].temperature }},
"temperature": {{ value_json.forecast[16].temperature }},
"temperature": {{ value_json.forecast[17].temperature }},
"temperature": {{ value_json.forecast[18].temperature }},
"temperature": {{ value_json.forecast[19].temperature }},
"temperature": {{ value_json.forecast[20].temperature }},
"temperature": {{ value_json.forecast[21].temperature }},
"temperature": {{ value_json.forecast[22].temperature }},
"temperature": {{ value_json.forecast[23].temperature }},
"temperature": {{ value_json.forecast[24].temperature }},
"temperature": {{ value_json.forecast[25].temperature }},
"temperature": {{ value_json.forecast[26].temperature }},
"temperature": {{ value_json.forecast[27].temperature }},
"temperature": {{ value_json.forecast[28].temperature }},
"temperature": {{ value_json.forecast[29].temperature }},
"temperature": {{ value_json.forecast[30].temperature }},
"temperature": {{ value_json.forecast[31].temperature }},
"temperature": {{ value_json.forecast[32].temperature }},
"temperature": {{ value_json.forecast[33].temperature }},
"temperature": {{ value_json.forecast[34].temperature }},
"temperature": {{ value_json.forecast[35].temperature }},
"temperature": {{ value_json.forecast[36].temperature }},
"temperature": {{ value_json.forecast[37].temperature }},
"temperature": {{ value_json.forecast[38].temperature }},
"temperature": {{ value_json.forecast[39].temperature }},
"temperature": {{ value_json.forecast[40].temperature }},
"temperature": {{ value_json.forecast[41].temperature }},
"temperature": {{ value_json.forecast[42].temperature }},
"temperature": {{ value_json.forecast[43].temperature }},
"temperature": {{ value_json.forecast[44].temperature }},
"temperature": {{ value_json.forecast[45].temperature }},
"temperature": {{ value_json.forecast[46].temperature }},
"precipitation": {{ value_json.forecast[0].precipitation }},
"precipitation": {{ value_json.forecast[1].precipitation }},
"precipitation": {{ value_json.forecast[2].precipitation }},
"precipitation": {{ value_json.forecast[3].precipitation }},
"precipitation": {{ value_json.forecast[4].precipitation }},
"precipitation": {{ value_json.forecast[5].precipitation }},
"precipitation": {{ value_json.forecast[6].precipitation }},
"precipitation": {{ value_json.forecast[7].precipitation }},
"precipitation": {{ value_json.forecast[8].precipitation }},
"precipitation": {{ value_json.forecast[9].precipitation }},
"precipitation": {{ value_json.forecast[10].precipitation }},
"precipitation": {{ value_json.forecast[11].precipitation }},
"precipitation": {{ value_json.forecast[12].precipitation }},
"precipitation": {{ value_json.forecast[13].precipitation }},
"precipitation": {{ value_json.forecast[14].precipitation }},
"precipitation": {{ value_json.forecast[15].precipitation }},
"precipitation": {{ value_json.forecast[16].precipitation }},
"precipitation": {{ value_json.forecast[17].precipitation }},
"precipitation": {{ value_json.forecast[18].precipitation }},
"precipitation": {{ value_json.forecast[19].precipitation }},
"precipitation": {{ value_json.forecast[20].precipitation }},
"precipitation": {{ value_json.forecast[21].precipitation }},
"precipitation": {{ value_json.forecast[22].precipitation }},
"precipitation": {{ value_json.forecast[23].precipitation }},
"precipitation": {{ value_json.forecast[24].precipitation }},
"precipitation": {{ value_json.forecast[25].precipitation }},
"precipitation": {{ value_json.forecast[26].precipitation }},
"precipitation": {{ value_json.forecast[27].precipitation }},
"precipitation": {{ value_json.forecast[28].precipitation }},
"precipitation": {{ value_json.forecast[29].precipitation }},
"precipitation": {{ value_json.forecast[30].precipitation }},
"precipitation": {{ value_json.forecast[31].precipitation }},
"precipitation": {{ value_json.forecast[32].precipitation }},
"precipitation": {{ value_json.forecast[33].precipitation }},
"precipitation": {{ value_json.forecast[34].precipitation }},
"precipitation": {{ value_json.forecast[35].precipitation }},
"precipitation": {{ value_json.forecast[36].precipitation }},
"precipitation": {{ value_json.forecast[37].precipitation }},
"precipitation": {{ value_json.forecast[38].precipitation }},
"precipitation": {{ value_json.forecast[39].precipitation }},
"precipitation": {{ value_json.forecast[40].precipitation }},
"precipitation": {{ value_json.forecast[41].precipitation }},
"precipitation": {{ value_json.forecast[42].precipitation }},
"precipitation": {{ value_json.forecast[43].precipitation }},
"precipitation": {{ value_json.forecast[44].precipitation }},
"precipitation": {{ value_json.forecast[45].precipitation }},
"precipitation": {{ value_json.forecast[46].precipitation }},
"datetime": "{{ value_json.forecast[0].datetime }}",
"datetime": "{{ value_json.forecast[1].datetime }}",
"datetime": "{{ value_json.forecast[2].datetime }}",
"datetime": "{{ value_json.forecast[3].datetime }}",
"datetime": "{{ value_json.forecast[4].datetime }}",
"datetime": "{{ value_json.forecast[5].datetime }}",
"datetime": "{{ value_json.forecast[6].datetime }}",
"datetime": "{{ value_json.forecast[7].datetime }}",
"datetime": "{{ value_json.forecast[8].datetime }}",
"datetime": "{{ value_json.forecast[9].datetime }}",
"datetime": "{{ value_json.forecast[10].datetime }}",
"datetime": "{{ value_json.forecast[11].datetime }}",
"datetime": "{{ value_json.forecast[12].datetime }}",
"datetime": "{{ value_json.forecast[13].datetime }}",
"datetime": "{{ value_json.forecast[14].datetime }}",
"datetime": "{{ value_json.forecast[15].datetime }}",
"datetime": "{{ value_json.forecast[16].datetime }}",
"datetime": "{{ value_json.forecast[17].datetime }}",
"datetime": "{{ value_json.forecast[18].datetime }}",
"datetime": "{{ value_json.forecast[19].datetime }}",
"datetime": "{{ value_json.forecast[20].datetime }}",
"datetime": "{{ value_json.forecast[21].datetime }}",
"datetime": "{{ value_json.forecast[22].datetime }}",
"datetime": "{{ value_json.forecast[23].datetime }}",
"datetime": "{{ value_json.forecast[24].datetime }}",
"datetime": "{{ value_json.forecast[25].datetime }}",
"datetime": "{{ value_json.forecast[26].datetime }}",
"datetime": "{{ value_json.forecast[27].datetime }}",
"datetime": "{{ value_json.forecast[28].datetime }}",
"datetime": "{{ value_json.forecast[29].datetime }}",
"datetime": "{{ value_json.forecast[30].datetime }}",
"datetime": "{{ value_json.forecast[31].datetime }}",
"datetime": "{{ value_json.forecast[32].datetime }}",
"datetime": "{{ value_json.forecast[33].datetime }}",
"datetime": "{{ value_json.forecast[34].datetime }}",
"datetime": "{{ value_json.forecast[35].datetime }}",
"datetime": "{{ value_json.forecast[36].datetime }}",
"datetime": "{{ value_json.forecast[37].datetime }}",
"datetime": "{{ value_json.forecast[38].datetime }}",
"datetime": "{{ value_json.forecast[39].datetime }}",
"datetime": "{{ value_json.forecast[40].datetime }}",
"datetime": "{{ value_json.forecast[41].datetime }}",
"datetime": "{{ value_json.forecast[42].datetime }}",
"datetime": "{{ value_json.forecast[43].datetime }}",
"datetime": "{{ value_json.forecast[44].datetime }}",
"datetime": "{{ value_json.forecast[45].datetime }}",
"datetime": "{{ value_json.forecast[46].datetime }}" }
Then I have made 24 automations that trigger on state change on the original weather sensor (that only has 24h of weather data that updates hourly) with a condition on the time (between 00-01, 01-02 and so on)
The automation action is a MQTT: Publish with the following code: (this is the 00-01 automation)
service: mqtt.publish
data:
topic: outside/weather_sensor_attr
qos: "1"
payload: |-
{
"forecast" : [
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').0.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').0.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').0.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').1.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').1.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').1.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').2.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').2.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').2.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').3.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').3.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').3.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').4.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').4.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').4.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').5.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').5.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').5.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').6.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').6.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').6.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').7.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').7.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').7.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').8.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').8.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').8.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').9.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').9.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').9.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').10.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').10.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').10.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').11.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').11.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').11.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').12.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').12.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').12.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').13.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').13.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').13.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').14.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').14.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').14.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').15.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').15.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').15.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').16.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').16.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').16.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').17.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').17.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').17.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').18.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').18.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').18.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').19.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').19.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').19.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').20.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').20.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').20.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').21.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').21.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').21.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').22.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').22.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').22.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').23.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').23.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').23.datetime }}"
}
]
}
For the automations that trigger later (e.g. 08-09) I added the values from the sensor that recieves the update in the first positions that is the “historical” list (array) positions.
So the 08-09 automation looks like this:
service: mqtt.publish
data:
topic: outside/weather_sensor_attr
qos: "1"
payload: |-
{
"forecast" : [
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').0.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').0.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').0.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').1.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').1.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').1.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').2.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').2.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').2.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').3.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').3.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').3.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').4.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').4.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').4.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').5.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').5.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').5.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').6.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').6.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').6.datetime }}"
},
{
"temperature" : {{ state_attr('sensor.vejret', 'forecast').7.temperature }},
"precipitation" : {{ state_attr('sensor.vejret', 'forecast').7.precipitation }},
"datetime" : "{{ state_attr('sensor.vejret', 'forecast').7.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').0.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').0.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').0.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').1.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').1.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').1.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').2.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').2.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').2.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').3.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').3.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').3.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').4.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').4.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').4.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').5.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').5.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').5.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').6.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').6.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').6.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').7.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').7.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').7.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').8.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').8.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').8.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').9.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').9.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').9.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').10.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').10.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').10.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').11.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').11.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').11.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').12.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').12.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').12.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').13.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').13.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').13.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').14.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').14.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').14.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').15.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').15.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').15.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').16.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').16.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').16.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').17.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').17.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').17.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').18.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').18.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').18.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').19.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').19.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').19.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').20.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').20.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').20.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').21.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').21.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').21.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').22.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').22.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').22.datetime }}"
},
{
"temperature" : {{state_attr('weather.hjem_hourly', 'forecast').23.temperature }},
"precipitation" : {{state_attr('weather.hjem_hourly', 'forecast').23.precipitation }},
"datetime" : "{{state_attr('weather.hjem_hourly', 'forecast').23.datetime }}"
}
]
}
Finally, every day just before i load the first data, I delete the sensor data.