I am using the REST sensor to retrieve from API sources and have done this successfully for a few sources. For one of the rainfall API source, the value_template that I am using looks as below:
value_template: '{{ states.sensor.rainfall.attributes["items"][0]["readings"][**47**]["value"] }}
My issue is that the API source changes and the 47 changes based on the number of weather stations that is available. The source looks as below:
from which I obtained from JSON parser the following, which I used in my value_template.
Is there anyway to identify the station based on the station_id instead of using the “row number” that the JSON parser is showing currently?