nckslater
(Nckslater)
August 12, 2023, 2:26pm
1
I am using scrape to get the wave heights in my local area. The website that I’m scraping from changes the data every 6 hours (as you can see in the history graph).
The wave height data is on the right labeled Index 0 - 6, the hours (pulled in as string) are on the left.
I would like to name Index 0-6 with the right times.
Is there a way I can change the friendly name with an automation or a script every 6 hours?
Thanks
myle
(StePhan McKillen (Other kiwi Here))
August 12, 2023, 5:06pm
2
What about showing us the code so far
nckslater
(Nckslater)
August 12, 2023, 9:42pm
3
Hi,
This is what I managed to put together. I’m a total noob to scrape.
Ideally, I would like to pull in the time text ie 11 AM as a timestamp rather than string then combine it with the wave height in HA.
As you can see I tried naming the wave height as the time string but it didn’t work. When the website updated the times (this is every 6 hours) the sensor became unknown in HA
#############1ST Wave Height#########################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time
select: ".forecast-table__cell.forecast-table-time__cell"
index: 0
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 0 #"{{states('sensor.waves_time') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 0
icon: "mdi:wave"
#############2ND Wave Height#########################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time 1
select: ".forecast-table__cell.forecast-table-time__cell"
index: 1
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 1 #"{{states('sensor.waves_time_1') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 1
icon: "mdi:wave"
###################3RD Wave Height########################################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time 2
select: ".forecast-table__cell.forecast-table-time__cell"
index: 2
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 2 #"{{states('sensor.waves_time_2') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 2
icon: "mdi:wave"
#######################4th Wave Height ##################################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time 3
select: ".forecast-table__cell.forecast-table-time__cell"
index: 3
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 3 #"{{states('sensor.waves_time_3') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 3
icon: "mdi:wave"
#######################5th Wave Height ##################################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time 4
select: ".forecast-table__cell.forecast-table-time__cell"
index: 4
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 4 #"{{states('sensor.waves_time_4') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 4
icon: "mdi:wave"
########################6th Wave Height####################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time 5
select: ".forecast-table__cell.forecast-table-time__cell"
index: 5
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 5 #"{{states('sensor.waves_time_5') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 5
icon: "mdi:wave"
########################7th Wave Height####################
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Waves Time 6
select: ".forecast-table__cell.forecast-table-time__cell"
index: 6
icon: "mdi:wave"
- resource: https://www.surf-forecast.com/breaks/Largos/forecasts/latest
sensor:
- name: Index 6 #"{{states('sensor.waves_time_6') | string }}"
select: ".swell-icon__val"
unit_of_measurement: "m"
index: 6
icon: "mdi:wave"