Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Run External Programs based on Sunrise/Sunset webtags

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
captzero
Posts: 363
Joined: Wed 03 Mar 2010 10:20 am
Weather Station: Vantage Pro2 w/ daytime FARS
Operating System: Windows 10
Location: Brisbane, Australia
Contact:

Run External Programs based on Sunrise/Sunset webtags

Post by captzero »

Hi all,
Here's a brain rattler....
I stream a live image during daylight hours only (no action at night) and use Windows Task Scheduler to run the program at around dawn and kill it around dusk. I change the on/kill times each week. As far as I know, Windows Task Scheduler doesn’t have the ability to do this based on the actual dawn/dusk times. Does anyone know of a way to do this using the external program feature in Cumulus (or Toolbox) or perhaps some other way?
Thanks
Dan

http://www.brisbaneliveweather.com




A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

would be nice to have an application that could do that!!!

I too use a form of task scheduler to run 25 scripts a day, 4 would benefit using dust and dawn times.

Anyone then.....
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
BCJKiwi
Posts: 1259
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by BCJKiwi »

You could create a batch file as C:\cumulus\web\batchT.txt and have Cumulus save it (not send it) as batch.cmd - obviously name something that make sense to you rather than batch.cmd!

In it place a variable for say <#isSunUp> (Tag generates 0 or 1).

This batch file could be run in the Program slot of external files which runs every time the tag files are updated e.g. every 10 mins or whatever you have set. The batch file can test this value and take action accordingly.

How you would use that to interact with whatever is controlling the streaming / 25 scripts is for you to determine.
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

Very interesting idea, use cumulus to change a variable with in a txt created into a cmd.

Now how to use this...mm

I convert all bat files into a silent exe so it does interfere with my media center playback/other apps.

My idea would be use cumulus to write a webtag into a simple text as sun up or sun down(0 or 1) then use a script to read that value as a variable to record or not to record and run this as a schedule every hour or what ever....

Now how to write that script...

*looks for thinking hat*

Lol
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

Only problem I see if using my weather station dawn/dusk or sunset/sunrise times, the recording would start too late and finish too soon.

Example data from station yesterday

Dawn: 06:40 Sunrise: 07:08
Dusk: 17:45 Sunset: 17:18

But I would like to start recording at 06:00 as sky starts to show light and finish at 18:30 as the light fades.

Know of any solution?

Chris
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by mcrossley »

Use <#isdaylight> which is based on dawn/dusk twilight times?

Edit: oops ignore that, I didn't read your question properly.
BCJKiwi
Posts: 1259
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by BCJKiwi »

Its all down to how complicated you want to make it.
You could use any of the tags available and do the work from there.

There are separate tags for;
current hour <#hour>
current minute <#minute>
sunrise <#sunrise>
sunset <#sunset>
dawn <#dawn> (start of civil twilight - Sun's centre 6deg below horizon)
dusk <#dusk> (end of civil twilight - Sun's centre 6deg below horizon)
daylength <#daylength>
sun above the horizon <#isSunUp> (officially "daylight" is defined as when the sun's upper edge is at the horizon but of course it get light before then.

So there are a lot of variables to play with:-
compare the current time to dawn or dusk
or
deduct an hour from sunrise and when current time is > than that, switch on (and add an hour to sunset to switch off).
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

How is it possible to deduct minutes from <webtag> as to return a variable of 1 or 2???

As I understand, using either <#isdaylight> or <#IsSunUp> will return a 1 for yes and a 0 for no, this could be easily be used in a switch script, but for either of them to Work it, it would require to minus X minutes from them.

Is that at all possible???
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
captzero
Posts: 363
Joined: Wed 03 Mar 2010 10:20 am
Weather Station: Vantage Pro2 w/ daytime FARS
Operating System: Windows 10
Location: Brisbane, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by captzero »

BCJKiwi wrote:place a variable for say <#isSunUp> (Tag generates 0 or 1).
I think this is probably the least complicated and easiest way to go.
Last edited by captzero on Wed 21 May 2014 5:47 am, edited 1 time in total.
Dan

http://www.brisbaneliveweather.com




A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

captzero wrote:
BCJKiwi wrote:place a variable for say <#isSunUp> (Tag generates 0 or 1).
I thinK is probably the least complicated and easiest way to go.
I would agree, but first light is about half an hour before and after <#issunup> times.
I like to capture the sun coming up as the colours are amazing and as the light fades in the evening..

PS. I've really highjacked this thread, sorry captzero.
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by tumutbound »

I spent a bit of time looking into this recently but ended up writing a python program to do it.
This program updates the configuration file for my webcamera program, also python, to decide when to start/stop taking images.

The main reason for not using webtags was I need it to happen in my Raspberry Pi based web camera and getting the webtag data from cumulus (running in an XP virtual machine on a Linux server ) via a Samba share was a hassle and a bit unreliable.

It's only in use on a test camera but I plan to have it running on the main camera soon.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

I'm stuck with a windows machine which is a TV media center. So it's much harder trying to keep resources to a minimum.
I have no stream monitoring software at all, the web cam takes care of the snapshot saving them to a nas drive on the network.

Wish I knew how to program!!
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
BCJKiwi
Posts: 1259
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by BCJKiwi »

@ace2
Doing math on dates is absolutely do-able in a batch file.

Construct the batch file with sample data in the format that Cumulus will deliver it to test the match.
Then save the working batch file as batchT.txt
edit it to replace the test data with the webtag.
Cumulus will process the text file and save as batch.cmd
You then run batch.cmd in the program time slot of Cumulus' external programs.
The batch file can do any number of different things in the one file if you need more routines, or, you could have a separate batch file for each routine (from Cumulus or not) and chain them together in another batch file.

Time to study the many features of the batch file language ;)

All manner of things can be carried out in batch files - some complicated some less so.
There are also programs designed to extend and/or simplify these processes.

e.g. Math;
http://www.robvanderwoude.com/battech_math.php
Date and time
http://www.robvanderwoude.com/datetime.php

Also on that site many other commands are described;
http://www.robvanderwoude.com/batchfiles.php

I have also used the Kixtart program extensively over many years for login scripts and for routines similar to some php code.

While these references may appear old, nothing much has changed and these still work in all current versions of Windows AFAIK.
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by steve »

Just to clarify - <#IsSunUp> indicates whether the sun is UP, i.e. between sunrise and sunset, so yes, it is light before and after those. <#isdaylight> indicates whether it is between dawn and dusk, i.e. it includes Civil Twilight - http://en.wikipedia.org/wiki/Twilight#Civil_twilight

If neither of those are suitable for a particular purpose, you'll have to do the maths yourself. It's possible that a future version of Cumulus might include web tags for nautical and astronomical twilight.
Steve
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: Run External Programs based on Sunrise/Sunset webtags

Post by ace2 »

steve wrote:It's possible that a future version of Cumulus might include web tags for nautical and astronomical twilight.
That would be great if that could be done one day.
Until then, I'll think I'll just stick to changing the times manually.....
Too hard to nut it out......
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
Post Reply