Grab webcam pics when it rains heavily?

I’d like to run a repeating task on a (Linux) system at home to capture images from webcams after significant rainfall. Has anybody here already built something like this?

My ideal setup would be something like logic to capture images every $CaptureInterval minutes any time more than $MinAccumulation mm of rain has accumulated over the last $LookbackDuration hours, and continue capturing images from various sources (probably webcams on the LAN and public Internet) until $Followup hours after the rain has stopped accumulating at/above that threshold.

Weatherflow staff: FYI, the page Tempest Integrations - WeatherFlow suggests I check the “forum wiki” at https://community.tempest.earth/t/smart-weather-station-third-party-applications but I can’t access that whether logged in to the forum or browsing the web anonymously, I get the error “Oops! That page doesn’t exist or is private.”

Indeed an old link, I have forwarded your findings internally for correction. Thanks for the feedback :slight_smile:

Well repeating task means cron.

If you run ‘motion’ you can do captures every so many minutes and turn them on/off (or I guess change the period too) programmatically, but of course you’d have to write the program with the smarts in it to determine whether to turn the captures on/off.

I used to turn my timelapse cam on/off based on time of day ala

15  5  * * * wget http://localhost:8080/0/config/set?ffmpeg_timelapse=60 >/dev/null 2>&1
45 20  * * * wget http://localhost:8080/0/config/set?ffmpeg_timelapse=0 >/dev/null 2>&1

Thanks. Yes, indeed, repeating task means cron because even though I’m pretty sure systemd is capable of doing that, cron is what I would use. :wink: But I’m open to using somebody’s cross-platform code that they’ve been using w/ Task Scheduler, etc.

I like motion very much and in fact am somewhat likely to use that as the webcam service for the LAN images (just using http to fetch individual JPEG images). BTW, IME one way to stop/start motion’s image capture is to use its web config interface to change the pixel change threshold (lower it to grab an image, raise it to stop capturing). But I think having motion write the files is a poor fit for this project, as I want the images stored on the box where the cron job runs, not the boxes with the cameras. Plus I want to grab images from public webcams I don’t manage.

I can tell you what method I have used which should give you plenty of ideas of value but I dont know how to share a package on github. I am using python on several raspberry pis to take photos every minute including capturing remote images using wget to load to my local pi that creates the time lapses.
Cron runs a python code on the camera pis every minute to capture as many images as desired using raspistill and manipulating the images to suit and sends them to the pi creating all the timelapses.
The timelapses are created every 10 minutes by appending to the day files. The ‘recent’ timelapse cuts the required seconds from the day file and uploads it to my remote webserver.
Now this part would suit your rain interface: Another python code calculates sunrise times each day which could alternatively check when it last rained using the API. The timelapse code that runs every 10 minutes could also directly check the sunrise time or use the API to calculate when it last rained.
A major issue with using rain data from the Tempest is false rain.
In my graphing software using python and the API i have a variable that is the maximum wind speed that allows rain to register. So when I read in the rain from the API it ignores rain if wind is stronger than my variable.
But all of my software is patchy because I am working on every area of it building better features all the time and I have no clue how to or time spare to use github.
For my timelapse I display the available views which when clicked goes to an expandable latest image full frame refreshing every minute so that it can be left as a 1fpm view. Or clicking it again displays the latest time lapse to view what the weather is doing.
I used the API information and manipulate and temporarily store all my data in json.
It is really fun getting it all working and I am sure it will work for you :slight_smile:
This is where I am up to: Window-Cameras
Cheers Ian :slight_smile:

Thanks, Ian! Some great ideas, indeed.

I’ve previously used motion on pi3b devices to make a security camera system that uploads ‘motion’ stills to a remote webserver along with HTML & JS to allow a low frame rate “video” interface after detected events begin and notifies me about the event. It’s not true video but rather replacing the image frame as new JPEGs load, with a playback rate selector, pause toggle, etc. I’d been thinking of overlaying accumulation info on the frames (e.g. 0.78"), but including a chart seems even better – maybe publish time + accumulation data and have the web UI include a combination of chart and time slider so that you could either watch the time lapse “video” and see the chart’s time slider move to indicate what moment + accumulation level is being depicted, or use the slider to select a specific moment/frame to view.

I’m sorry to hear you’re one of the folks having false rain trouble. I’ve only had my Tempest about nine months and have been pretty lucky in that regard since moving it to its permanent, fence-mounted location. It’s a good reminder though that the Tempest is useless for measuring snow accumulation and I might want to look for APIs that would allow me to create imagery archives after big snow events.

-Peter

1 Like

Hi Peter,
My interest is primarily wind, secondly the air’s characteristics. I do not require any rain accuracy myself. However as a weatherflow tester I designed a mount which prevented false rain on a very exposed vibrating pole and I also installed a dual Sky system which recorded rain from a short pole in the garden. So I was recording rain correctly but my priorities have now moved on to several other directions. I am testing temperature accuracy, building better weather graph displays, adding more time lapse cameras, adding more wind locations and improving my web pages. And when ever the wind might be flyable I go paragliding. Learning python to build all these unlimited feature improvements is very satisfying.
I have wondered about tidying my creations to share on github but each time I sit down to work on something I focus on higher priority items.
What is the purpose of your creation? Why do you wish to only watch cameras after rain?
Cheers Ian :slight_smile:

What’s the purpose? My neighborhood is somewhat prone to yard ponding and street flooding during heavy (>= 50mm/hour) rainstorms and after prolonged rain. I’d like to automate collecting time lapse imagery any time stormwater problems seem likely.

Hi @peter4 ,
OK now I get it and I guess that it is not a critical flood warning system.
In that case I would simply set the time lapse up to record all the time and save daily video files. In my situation I had considered including rainfall information via some device within the view of the timelapse. Ideas include running the downpipe from the roof through a visible V notch which is an accurate method of measuring water flow. Another idea is to have a tipping bucket within the frame. I have found that my time lapse cameras do not display the rainfall very well at all. Sometimes it is impossible to see if it is raining. If the rain falls onto the window in front of the camera it is easy to see but still difficult to know how heavy it is raining. Because I have several cameras I figure it is not too difficult to arrange a tipping bucket in front of one of them. In a built up area it is very difficult to measure rainfall accurately. I have two funnel gauges on the fence on opposite corners of my block in reasonable clear areas. Today for example one read 52mm while the other read 63mm. Which doesnt bother me unless I am using the figures to calibrate the Tempest then a 20% error is not so useful.
If the still pictures are stored until the end of the day. Then you could call the API for the 24 hour of one minute values.
cheers Ian :slight_smile: