Hi,
I think i’ve looked through so many examples to figure out how to get Open Meteo’s soil moisture data to display on Plotly Graph but just can’t seem to figure out how to input the array of data for each measurement.
I’ve managed to get the current weather working, but the forecast or history seems to be difficult to work out being in an array.
Open Meteo API call for data used
{
"latitude": -33.75,
"longitude": 151.125,
"generationtime_ms": 0.0450611114501953,
"utc_offset_seconds": 0,
"timezone": "GMT",
"timezone_abbreviation": "GMT",
"elevation": 51,
"hourly_units": {
"time": "iso8601",
"temperature_2m": "°C",
"precipitation": "mm",
"soil_moisture_0_to_1cm": "m³/m³"
},
"hourly": {
"time": [
"2024-06-22T00:00",
"2024-06-22T01:00",
#..... Multiple lines of time stamp removed .....
"2024-06-25T22:00",
"2024-06-25T23:00"
],
"temperature_2m": [11, 13.4, 14, 14.2, 14.2, 13.9, 13.6, 12.9, 12.2, 11.7, 11.4, 11.1, 11, 10.9, 10.7, 10.7, 10.6, 10.5, 10.1, 10, 9.8, 9.7, 9.8, 10.5, 11.8, 13.3, 14.7, 15.2, 15.5, 15.3, 14.7, 13.3, 12.1, 11.5, 11, 10.6, 10.2, 9.6, 8.8, 8.4, 7, 7, 6.8, 6.7, 6.7, 6.7, 6.9, 8.2, 10.2, 12.5, 14.3, 15.6, 16.1, 16, 15.4, 13.9, 12.4, 11.5, 10.5, 9.4, 8.6, 8, 7.6, 7.4, 7.6, 7.6, 7.8, 7.6, 7.3, 7.3, 7.7, 8.9, 12.1, 15, 17, 17.8, 17.6, 17.3, 16.5, 14.8, 13.4, 13.3, 13.2, 13.1, 12.7, 12.2, 11.5, 10.8, 10.1, 9.7, 9.3, 9, 8.8, 8.6, 9, 11.7],
"precipitation": [0, 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0.3, 0.2, 0, 0, 0, 0, 0, 0, 0.2, 0.3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"soil_moisture_0_to_1cm": [0.264, 0.26, 0.256, 0.254, 0.252, 0.251, 0.253, 0.252, 0.252, 0.253, 0.255, 0.264, 0.269, 0.279, 0.282, 0.276, 0.272, 0.27, 0.269, 0.268, 0.267, 0.275, 0.283, 0.278, 0.276, 0.275, 0.27, 0.266, 0.262, 0.26, 0.259, 0.259, 0.261, 0.262, 0.262, 0.263, 0.263, 0.263, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.262, 0.26, 0.256, 0.253, 0.25, 0.249, 0.249, 0.251, 0.253, 0.254, 0.255, 0.256, 0.256, 0.257, 0.257, 0.258, 0.258, 0.259, 0.259, 0.259, 0.259, 0.259, 0.259, 0.259, 0.257, 0.254, 0.249, 0.244, 0.24, 0.237, 0.237, 0.239, 0.241, 0.243, 0.244, 0.245, 0.246, 0.246, 0.247, 0.248, 0.249, 0.25, 0.25, 0.251, 0.251, 0.252, 0.252, 0.251]
}
}
My configuration.yaml which shows a value of 0 on each item at least on the graph.
rest:
scan_interval: 60
resource: "https://api.open-meteo.com/v1/forecast?latitude=-33.8678&longitude=151.2073&hourly=temperature_2m,precipitation,soil_moisture_0_to_1cm&past_days=1&forecast_days=3"
sensor:
- name: omhtime
value_template: "{{ value_json.hourly.time[] }}"
- name: omhtemp
value_template: "{{ value_json.hourly.temperature_2m[] }}"
- name: omhprecipitation
value_template: "{{ value_json.hourly.precipitation[] }}"
- name: omhsoilmoisture01
value_template: "{{ value_json.hourly.soil_moisture_0_to_1cm[] }}"
I’ve seen some examples of looping through data in array, but can’t quite seem to get any of them to work.
I’m hoping to use this data to get a general idea of soil moisture readings over time and precipitation to turn on sprinklers accordingly. Saves me getting my own weather sensors at home for the time being. Open Meteo have a good range of measurements that i’d like to be able to display / use that aren’t in the custom card.
Thanks in advance.