Hello,
is it possible to get this scraped?
I tried it but…
so hab ichs:
command_line:
- sensor:
name: oemag_marktpreis
command: echo $(curl https://www.oem-ag.at/de/marktpreis/ | grep -Po "<strong>([\d,]+) ct/kWh<\/strong>" | grep -Po "[0-9,]{3,7}" | sed 's/,/./g')
#https://www.libe.net/oemag
unit_of_measurement: 'ct/kWh'
scan_interval: 21600
icon: mdi:cash
I ended up with this, just if someone prefers multiscrape:
multiscrape:
- name: HA scraper for e-control
resource: https://www.e-control.at/de/marktteilnehmer/oeko-energie/marktpreis
scan_interval: 86400
sensor:
- unique_id: energie_marktpreis
name: Energie Marktpreis
unit_of_measurement: EUR/kWh
select: ".journal-content-article > table:nth-child(9) > tbody:nth-child(1) > tr:nth-child(8) > td:nth-child(2)"
value_template: '{{ value | replace (",", "") | float(default=0.0) | int / 100000 | round(2) }}'
- name: HA scraper for oem-ag
resource: https://www.oem-ag.at/de/marktpreis/
scan_interval: 21600
sensor:
- unique_id: oemag_marktpreis
name: OeMAG Marktpreis
unit_of_measurement: EUR/kWh
select: "#c1048 > table > tbody:nth-child(1) > tr:nth-last-child(1) > td:nth-child(2) > strong"
value_template: '{{ value | select("in",",.0123456789") | join | replace(",",".") | float(0) / 100 }}'
Hi all,
the Website changed a little bit and so I tried to correct the multiscrape entry in my yaml.
Before the value on the site to be read was within <strong> -tag. Now this is removed and *) is inserted after the energy price.
So i tried to replace this to nothing with | replace("*)","") right after the value-variable
- name: HA scraper for oem-ag
resource: https://www.oem-ag.at/de/marktpreis/
scan_interval: 21600
sensor:
- unique_id: oemag_marktpreis
name: OeMAG Marktpreis
unit_of_measurement: EUR/kWh
select: "#c1048 > table > tbody:nth-child(1) > tr:nth-last-child(1) > td:nth-child(2)"
value_template: '{{ value | replace("*)","") | select("in",",.0123456789") | join | replace(",",".") | float(0) / 100 }}'
In developer Tools all is fine … (BTW: {{ becomes {!{ in developer tools read the multiscrape documentation)
… but not in yaml, and I can’t find the error. The sensor becomes unavailable.
Can someone pint me to the mistake, pls?
Thank you in advance
ask chatgpt
- it solved it for me.
command_line:
- sensor:
unique_id: einpeiseverguetung
name: "Einspeisevergütung"
command: echo $(curl https://www.oem-ag.at/de/marktpreis/ | grep -Po "([\d,]+) ct/kWh" | grep -Po "[0-9,]{3,7}" | sed 's/,/./g')
#https://www.libe.net/oemag
unit_of_measurement: "ct/kWh"
scan_interval: 21600
icon: mdi:cash
Interesting, suddenly the select didn’t work (?). I replaced it with regex regex_findall("[\d,.]+")
Hello,
vielen Dank dafür - ich hab deinen code in die configuration.yaml eingefügt.
Bekomme leider eine Fehlermeldung:
Diese Entität wird nicht mehr von der „command_line"-Integration bereitgestellt. Wenn die Entität nicht mehr verwendet wird, lösche sie in den Einstellungen
Hi, seams oem-ag.at changed some parts on their website, also changed the url from
https://www.oem-ag.at/de/marktpreis/ to https://www.oem-ag.at/marktpreis/
Below my updated, working multiscrape:
multiscrape:
- name: HA scraper for oem-ag
resource: https://www.oem-ag.at/marktpreis/
scan_interval: 21600
sensor:
- unique_id: oemag_marktpreis
name: OeMAG Marktpreis
unit_of_measurement: EUR/kWh
select: "table.table-bordered > tbody > tr:last-child > td:nth-child(2)"
value_template: '{{ value | regex_findall_index("[\\d,]+") | replace(",", ".") | float(0) / 100 }}'