more G-Labs products

Author Topic: Couple questions about cron events  (Read 1371 times)

April 02, 2015, 12:08:03 AM
Read 1371 times

ses1984

  • *
  • Information
  • Newbie
  • Posts: 10
I'm trying to get a scene to trigger on a cron event and it doesn't seem to be working. I have set a scene to gradually increase the brigtness on some dimmers that I want to use to help wake me up in the morning. I think I have the scene set correctly because I can manually trigger it, but no matter what I do, I can't seem to wire it up to trigger on the cron event.

I was wondering if, for testing purposes, there was a way to manually trigger a cron event, such that if you had a scene wired to a cron event, you could manually fire the cron event and thus test that the scene triggers off of that.

Another question I had is, is it possible to see when cron events are fired? For example, when I manually trigger the scene, a graphic alert goes off that indicates something is happening. Is it possible to see such alerts when cron events happen?

Thank you very much, HG is awesome!

April 02, 2015, 04:51:06 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I was wondering if, for testing purposes, there was a way to manually trigger a cron event, such that if you had a scene wired to a cron event, you could manually fire the cron event and thus test that the scene triggers off of that.
Not exactly, but you can create a scheduled event at a time and then update the time within HG to 1-2 minutes in the future.  Or, just enter the cron string into the "Scheduled Events" parameter of the module as 1-2 minutes into the future.  Either way will work.

Another question I had is, is it possible to see when cron events are fired? For example, when I manually trigger the scene, a graphic alert goes off that indicates something is happening. Is it possible to see such alerts when cron events happen?
I don't think there's a way within HG web interface out of the box.  The 2 things you can do is either watch the mono output via debug mode or modify the "Scheduled Events" script to add a "Program.Notify(...);" line.  Once you add that line, make sure to recompile the script.

April 02, 2015, 09:23:30 PM
Reply #2

ses1984

  • *
  • Information
  • Newbie
  • Posts: 10
Quote
Not exactly, but you can create a scheduled event at a time and then update the time within HG to 1-2 minutes in the future.  Or, just enter the cron string into the "Scheduled Events" parameter of the module as 1-2 minutes into the future.  Either way will work.

This gets pretty tedious if you're troubleshooting and the problem your trying to troubleshoot is the cron system itself. Every single time I want to re-try, I have to wait an extra 1-2 minutes. The other night I did this about 30 times... that's 30-60 minutes wasted.

I just had an idea that I could set the event to fire every minute, then the worst-case scenario is that I have to wait a full extra minute between tests. That's still pretty tedious.

April 03, 2015, 12:36:08 AM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I don't disagree.  I had the same issues when I was debugging cron events last year.  Sorry, I just don't have a better suggestion.  By definition, cron events are checked every 30 seconds by the "Scheduled Events" script.  You could manually fire that script and perhaps tweak that code somehow or just write your own so it fired once and only once when it was launched.

The "Scheduled Events" script is simple and could be modified.  It wasn't worth it for me, but it sounds like you have a more complicated task to debug.  If so, that would be my best suggestion.

April 04, 2015, 05:12:34 PM
Reply #4

ses1984

  • *
  • Information
  • Newbie
  • Posts: 10
Quote
It wasn't worth it for me, but it sounds like you have a more complicated task to debug.


Actually the part I'm trying to debug is really simple. I have a scene that I want to trigger on a cron event. It does not trigger on that cron event.

This is the example given: http://www.homegenie.it/docs/images/hg_scheduler_02.jpg

This is what I'm doing: http://i.imgur.com/owxaa5o.png

.......

I figured it out. It was really stupid. I needed to enable the scene Program.Status="Enabled"