Scrape Sensor not working

Hi guys,

I’m wondering why this scrape-sensor cofiguration is not working. Maybe you can help me out because I don’t know where I should go for debugging:

- platform: scrape
  resource: https://www.wassertemperaturen.net/kroatien/porec.html
  name: scraper_temperatur_adriaticsee_porec
  select: ".strandtemp"
  value_template: '{{ value.split("&")[0] }}'
  unit_of_measurement: "°C"
  scan_interval: 3600

I just tested something like that with nodered →

[{"id":"4cf84951.21d288","type":"inject","z":"d2384e5b.cfc94","g":"6522b5f9.dc744c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":600,"wires":[["c339a4c.c6b0958"]]},{"id":"c339a4c.c6b0958","type":"http request","z":"d2384e5b.cfc94","g":"6522b5f9.dc744c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.wassertemperaturen.net/kroatien/porec.html","tls":"aba07eb3.e2684","persist":false,"proxy":"","authType":"","x":310,"y":600,"wires":[["4b4f0817.bea7c8"]]},{"id":"4b4f0817.bea7c8","type":"html","z":"d2384e5b.cfc94","g":"6522b5f9.dc744c","name":"","property":"payload","outproperty":"payload","tag":".strandtemp","ret":"html","as":"single","x":490,"y":600,"wires":[["8f5aa590.bcce18"]]},{"id":"8f5aa590.bcce18","type":"string","z":"d2384e5b.cfc94","g":"6522b5f9.dc744c","name":"","methods":[{"name":"delRightMost","params":[{"type":"str","value":"°"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":650,"y":600,"wires":[["1911f8c.080f207"]]},{"id":"1911f8c.080f207","type":"function","z":"d2384e5b.cfc94","g":"6522b5f9.dc744c","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":600,"wires":[["4066763f.8ca188"]]},{"id":"4066763f.8ca188","type":"debug","z":"d2384e5b.cfc94","g":"6522b5f9.dc744c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":600,"wires":[]},{"id":"aba07eb3.e2684","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]

which gives out the correct value but I just want to have it in HomeAssistant as scrape-config (think it’s the more elegant way)

Does your log file contain something like this?

Error fetching data: https://www.wassertemperaturen.net/kroatien/porec.html failed with [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1124)

That means that HA does not trust the website’s certificate. However I can’t see why, because Chrome does not complain about the website’s certificate.

A workaround that you can implement - but only if you trust that website - is to turn off the verification of the certificate by adding: verify_ssl: false

And, BTW, you then need to slightly modify your value_template to only extract the number and discard the unit.

Ah sounds legit - I would never have thought of that.
Do you maybe have a hint for me how I can modify the template - unfortunately I’m a real noob on that :open_mouth:

Cheers & Thx for your help!

Your template already does this.

Okay fine :slight_smile:

edit:
Works perfectly - thx guys! Had to do just one simple “fix” - the correct split-character was NOT
&
but
°

1 Like

That’s interesting: the scrape sensor must do entity conversion.