Hi all. I’d like to scrape my power usage from my energy supplier’s site, but I’m running into a bit of an issue.
They display the half hourly power usage in a heatmap that’s basically an html table with blank cell values. But the values I need are the attributes of those cells.
I’ve tried multiple ways to get these values, but I either only get the first values or nothing at all.
sensor:
- unique_id: powershop_heatmap_time
name: "Powershop Heatmap Time"
select_list: "table#heatmap tr:nth-child(1) > td:nth-child(n+3):nth-child(-n+50)"
attribute: data-time
- unique_id: powershop_heatmap_usage
name: "Powershop Heatmap Usage"
select_list: "table#heatmap tr:nth-child(1) > td:nth-child(n+3):nth-child(-n+50)"
attribute: data-usage
sensor:
- unique_id: powershop_heatmap_time
name: "Powershop Heatmap Time"
select_list: "table#heatmap tr:nth-child(1) > td"
attribute: data-time
- unique_id: powershop_heatmap_usage
name: "Powershop Heatmap Usage"
select_list: "table#heatmap tr:nth-child(1) > td"
attribute: data-usage
sensor:
- unique_id: powershop_heatmap_time
name: "Powershop Heatmap Time"
select_list: "table#heatmap tr:nth-child(1) td"
value_template: "{{ value | regex_findall_index('data-time=\"([^\"]+)\"') }}"
- unique_id: powershop_heatmap_usage
name: "Powershop Heatmap Usage"
select_list: "table#heatmap tr:nth-child(1) td"
value_template: "{{ value | regex_findall_index('data-usage=\"([^\"]+)\"') }}"
I assumed I could just extract the raw html using multiscraper, but it doesn’t seem to work either.
Any help would be appreciated.