My goal now is to be able to read the following node from the JSON and return it as a sensor: object►properties►timeseries►0►data►next_6_hours►details►air_temperature_max
After some research, my plan was to do this via a REST call. I then put together the following. I don’t run into any errors, but the sensor is always “unknown”. Does anyone have an idea where my error lies?
Rest:
- Ressource: https://api.met.no/weatherapi/locationforecast/2.0/complete?lat=51.17416597&lon=6.870996516&altitude=44
scan_interval: 60
sensor:
- name: "Name of my Sensor"
value_template: "{{ value_json.properties.timeseries[0].data.next_6_hours.details.air_temperature_max }}"
device_class: temperature
unit_of_measurement: "°C"
rest and resource should be lower-case, and only one s in resource. If the sensor is created but unknown, I’d suggest that the YAML config you have pasted above is not exactly what is in your configuration.yaml…
Careful with polling every 60s: you might get banned.
If this is your first use of the RESTful integration, you’ll need to do a full restart once you’ve corrected the rest: header.
Thank you for your quick feedback.
I think I just made a mistake with the copying. It looks as if the “German” terms came along with the copy. The two words are in lower case and there is only one s in resource. Here is another copy of the complete code as it appears in configuration.yaml - this time I made sure that it was copied correctly.
rest:
- resource: https://api.met.no/weatherapi/locationforecast/2.0/complete?lat=51.17416597&lon=6.870996516&altitude=44
scan_interval: 60
sensor:
- name: "Name of my Sensor"
value_template: "{{ value_json.properties.timeseries[0].data.next_6_hours.details.air_temperature_max }}"
device_class: temperature
unit_of_measurement: "°C"
I also restarted the system completely after saving.
Of course I should increase the interval, you’re right. I will do that immediately afterwards.
Yeah, that’s it - thank you very much for the help and also the complete solution.
In the next step, I will now familiarize myself better with the topic of “user agents”