Hi. I am after reading the XML data from the following URL: https://uvdata.arpansa.gov.au/xml/uvvalues.xml and display only the UV index value for a certain city, say “Sydney”
Anyone can help how can I achieve this?
Hi. I am after reading the XML data from the following URL: https://uvdata.arpansa.gov.au/xml/uvvalues.xml and display only the UV index value for a certain city, say “Sydney”
Anyone can help how can I achieve this?
Have a look at the scrape sensor.
It should be able to do what you want
Or
'curl -k --silent "https://uvdata.arpansa.gov.au/xml/uvvalues.xml" | sed -n '122p' | cut -c 12-14'
will work as a command line sensor, although it will break if any changes are made to the page
DW i got it to work. If anyone else wants here is the code
- platform: scrape
resource: https://uvdata.arpansa.gov.au/xml/uvvalues.xml
name: UV Index Sydney ARPANSA
select: "location > index"
index: 15
unit_of_measurement: "UV Index"
Thanks @vijaykbhatia I never came back to this post. But your code also works for me:
sensor:
- platform: scrape
resource: https://uvdata.arpansa.gov.au/xml/uvvalues.xml
name: UV Index Sydney ARPANSA
select: "location > index"
index: 15
unit_of_measurement: "UV Index"
This also worked for me:
sensor:
- platform: rest
name: ARPANSA UV Melbourne
resource: https://uvdata.arpansa.gov.au/xml/uvvalues.xml
state_class: measurement
unique_id: arpansa_uv_melbourne
value_template: "{{ value_json.stations.location[12].index }}"