Local Flooding - How to get the webcam into Home Assistant

Hi there,

We get quite a bit of flooding around where we live which affects road access.

There’s helpfully a couple of webcams installed which show the state of the roads, but there website is littered with adverts.

Can anyone tell me a way of scraping the live image and including in Home Assistant - the iframe option to include the website doesn’t work. Is the site using X-Frame headers to prevent the embedding of infromation?

Thanks,

Try api environment.data.gov.uk/flood-monitoring/id/stations/2165.json

It will give the height so I assume that will also indicate flooding?

EDIT: after a 2nd thought… it will likely not … a picture would show you if flooding happened in that area.

Thanks. I’m already using the Environment Agency integration to get river levels.

I had hoped to also incorporate the webcam but it seems to be tricky to get the live feed in.

The link just keeps reverting to ab ad which I can’t seem to bypass:

You can try something like this but I would not know how sensitive it is to a correct timestamp…the timestamp you can add as part of a command_line with a template

curl -L \
  -H "Referer: https://www.farsondigitalwatercams.com/" \
  -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0" \
  "https://images-cnd0ajgjbebpgjbe.z03.azurefd.net/realtime-images/Gloucester-River7/current1.jpg?rid=1770645270" \
  -o gloucester.jpg

EDIT: then you should download it to your www folder from which you can then use it in HA

Or this may work too, I have not the time to check if it is actaully pulling the correct latest picture

curl -L \
  -H "Referer: https://www.farsondigitalwatercams.com/" \
  -H "User-Agent: Mozilla/5.0" \
  "https://images-cnd0ajgjbebpgjbe.z03.azurefd.net/realtime-images/Gloucester-River7/current1.jpg?rid=$(date +%s)" \
  -o gloucester.jpg

Thanks - yes, did something similar (created and edited a script in nano editor):

It’s pulling back the jpg - but the jpg of the advert not of the webcam unfortunately.

#!/bin/bash
curl -s -L \
  -H "Referer: https://www.farsondigitalwatercams.com/locations/gloucester" \
  -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
  -H "Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8" \
  -H "Accept-Language: en-GB,en-US;q=0.9,en;q=0.8" \
  -H "Cache-Control: no-cache" \
  -H "Pragma: no-cache" \
  "https://images-cnd0ajgjbebpgjbe.z03.azurefd.net/realtime-images/Gloucester-River7/current1.jpg?rid=1770645270" \
  -o /config/www/gloucester_webcam.jpg

Mine does…

The webpage card might work?

Odd - it pulls the camera picture not the image of the GoPro ad?

Indeed… I get a picture, but it does not show any time only a date so no clue what it is (other than ‘today’ and after sunrise :slight_smile: )

The op wants just the picture, not the clutter around it.

Brilliant - done it!
Now just to get it to run the script based on a specified time I want it to run (e.g. every hour).

Thanks ever so much! You’ve been so helpful.

Great…tick the solution box please so others can find this as a possible (!?) solution too (i.e. bypassing ‘stuff’). I was in Gloucester 5y ago as a tourist …which sort of drew my attention to your challenge :slight_smile:

the command_line lets you set an scan_interval: 3600

1 Like

Flooded today which is why I’m onto Home Assistant (just as well it’s also a day off for me!).

Will do - thanks ever so much.