Page 4 of 12

Re: SchedulGhost

Posted: Sat Nov 13, 2010 9:42 am
by feerlessleadr
Hi Paco,

I believe that your plugin is what I have been looking for for a while. Basically, I am looking to set a timer that will place my computer into hibernate mode after a set amount of time my computer is idle.

I have tried to accomplish this with your plugin, but i don't think i'm doing it right.

I have gone into the 'Show ScheduleGhost' macro, and have added a new schedule titled 'Sleep Timer' with schedule type as Time Span. I set the time span for 5 seconds (just to test) and I labeled the start event suffix as sleep and left the stop event suffix and event payload as blank (as I'm not quite sure what either mean)

When I select 'Test Now' I see the event 'ScheduleGhost.sleep' pop up in the log, but then after the 5 seconds are up, I get a buunch of errors:

Code: Select all

Traceback (most recent call last) (1462):
File "C:\Program Files (x86)\EventGhost\eg\Classes\Scheduler.py", line 143, in MainLoop
File "C:\Program Files (x86)\EventGhost\plugins\ScheduleGhost\_init_.py", line 2305, in ScheduleGhostScheduleRun
ValueError: list.index(x): x not in list
Do you think you could let me know what I can do to accomplish what I am looking to do?

Re: SchedulGhost

Posted: Sat Nov 13, 2010 10:12 am
by Pako
Yes, what you write is true. It's a bug, but he does not prevent normal use.
If you press the Apply button first and then Test now button, it will be fine. But this is only necessary immediately after creating a new schedule.
But I got the impression that you are not properly understood the schedule type Time span.
For this special schedule is Start event meaningless. There is only important Stop event.
This type of schedule makes sense only in conjunction with the Run schedule immediately action.

Pako

Re: SchedulGhost

Posted: Sat Feb 19, 2011 6:14 pm
by dt1000
Nice work - a very cool plug-in! :)

Re: SchedulGhost

Posted: Mon Apr 11, 2011 7:31 pm
by cfull1
Is there a way I can use AddSchedule from a python script?
I want to automatically schedule an event from commands from my webserver

Thanks,
Carson

Re: SchedulGhost

Posted: Tue Apr 12, 2011 7:23 am
by Pako
cfull1 wrote:Is there a way I can use AddSchedule from a python script?
Yes, of course it is possible.
You can use the command eg.plugins.SchedulGhost.AddSchedule(arg)
where arg = definition of schedule (as in the edit-box on dialogue Add schedule).

However - perhaps in your case is about a one-time schedules.
If so, you should instead the SchedulGhost plugin use function
eg.scheduler.AddTask(waitTime, func, *args, **kwargs) or
eg.scheduler.AddTaskAbsolute(startTime, func, *args, **kwargs)
These functions are used internally in the SchedulGhost plugin.

Pako

Re: SchedulGhost

Posted: Tue Apr 12, 2011 10:44 pm
by cfull1
Hey Pako, I'm confused how to use AddSchedule normally in the edit box.
Could you give me an example?

I'm not sure if I want a repeating schedule or not yet.
Is scheduler a separate plugin or part of SchedulGhost?
Could I have an example of that too?
Sorry my python skills need some work,
Thanks for all your help

Carson

Re: SchedulGhost

Posted: Wed Apr 13, 2011 9:35 am
by Pako
cfull1 wrote:Hey Pako, I'm confused how to use AddSchedule normally in the edit box.
Could you give me an example?
Of course I can.
AddScheduleDescription.gif
I thought that the description of action Add schedule explains it well enough. But it seems not. Never mind, I'll try to explain it.
The following picture is a good thing to see.
AddSchedule.gif
You can do the following:
1. Open SchedulGhost manager and create a schedule (I called it Test)
2. Double-click on Get schedule. In the dialog, choose your schedule (Test)
3. Add the action Python command (command = print eg.result)
4. Run the macro Get schedule. In the logger will appear a row with definition of schedule
5. Use Copy/Paste to transfer the definition to dialogue Add schedule
cfull1 wrote:I'm not sure if I want a repeating schedule or not yet.
Is scheduler a separate plugin or part of SchedulGhost?
Could I have an example of that too?
No, scheduler is not part SchedulGhost plugin.
Here is the documentation, including examples.
I think the section Documentation is a very good place to read for anyone who wants to learn something.

Pako

Re: SchedulGhost

Posted: Wed Apr 13, 2011 5:02 pm
by cfull1
Awesome Thanks! This is just what I was looking for.

Re: SchedulGhost

Posted: Mon Jan 23, 2012 11:32 pm
by jesterod
is there a way to get a timer for 72 hours?
or better a script to set a schedule in SchedulGhost for 72 hrs later

Re: SchedulGhost

Posted: Fri Apr 27, 2012 9:11 pm
by mbonaccors
So I'm having a few bits of trouble with the scheduldhost plugin.

-I installed the plugin and it's added to the "autostart" tree
-I clicked "configure plugin" and hit the "Show schedule manager" button
-I created several events in schedule manager and tested them.
-I added the event tags that were created to a few macros (Text to speech, Mute Volume at 9:30pm, etc.)

Unfortunately, SchedulGhost hasn't created any events, even though they are enabled in the schedulemanager. Do I need to add other actions for scheduler somewhere so that it creates events? I assumed that once you had configured and enabled events in schedulghost, all you need is the plugin to reside in the autostart tree for it to begin creating events.

Thanks in advance!

Re: SchedulGhost

Posted: Tue Aug 14, 2012 3:33 pm
by EventGhost4ever
If you add a schedule with the action "AddSchedule" of SchedulGhost, the added schedule will not be saved in SchedulGhost.xml.
I need this function, therefore I have written an addition to the code of SchedulGhost, which adds an action, which saves the added schedule in SchedulGhost.xml.

Code: Select all

class DataToXML(eg.ActionBase):
    def __call__(self):
        self.plugin.dataToXml()
#===============================================================================

    Actions = (
        (DataToXML, "DataToXML", "Save data to xml", "Saves data to xml.", None),
I have also written an addition to the description of the action "AddSchedule".

Code: Select all

descr = u'''<rst>**Add schedule**.

In the edit box, enter a python expression with the parameters of the plan.
This may be for example *eg.result*, *eg.event.payload* or the entire list
(in the same format, what you get as a result of the action **"GetSchedule"**, see the documentation of
the python expression in this description.

This action works in two ways (depending on the existence of the schedule):

1. If the schedule with the same title already exists, its parameters are overwritten by the new ones.
2. If the title does not yet exist, the schedule is created and added to the list.

An added schedule will not be saved automatically in SchedulGhost.xml. To save the added schedule use the
SchedulGhost manager or the action "DataToXML".
		
This is the syntax of the python expression::

[enabled?, u'scheduleTitle', scheduleType, [expressionScheduleType], u'dateLastRun timeLastRun',\
u'eventPrefix', u'startEventSuffix', u'stopEventSuffix', u'eventPayload']

These are the different schedule types and them expressions:

* 0 (only once (or yearly)): u'startEventTime', u'span', u'date', repeatYearly?
* 1 (daily): u'startEventTime', u'span' 
* 2 (weekly): u'startEventTime', u'span', daysWeek, DoNotTriggerOnAHoliday?,\
TriggerNotChosenDayOnAHoliday?
* 3 (monthly  / weekday): u'startEventTime', u'span', daysWeek, monthsYear(Jan-Jun),\
monthsYear(Jul-Dec), DoNoTriggerOnAHoliday?
* 4 (monthly / day): u'startEventTime', u'span', daysMonth(1-8), daysMonth(9-16),\
daysMonth(17-24), daysMonth(24-31), monthsYear(Jan-Jun), monthsYear(Jul-Dec)
* 5 (periodically): u'startEventTime', u'span', u'date', periodEventRepeat, timeFormat
* 6 (time span): u'00:00:00', u'span'

Explanation:

* enabled? = boolean expression if it is true or false (0 = false; 1 = true)
* u'scheduleTitle' = expression with a unicode string (wake_me_up)
* scheduleType = a number
* date = year-month-day (2012-12-31)
* time and span = hours:minutes:seconds (23:59:59)
* daysWeek = sum of the days (Monday = 1, Tuesday = 2; Wednesday = 4, ..., Sunday = 64)
* monthsYear(Jan-Jul) = sum of the months (January = 1, ..., June = 32)
* monthsYear(Jul-Dec) = sum of the months (July = 1, ..., December = 32)
* timeFormat: seconds = 0, minutes = 1, hours = 2, days = 3, weeks = 4, months = 5, years = 6

Make sure to use backslash' instead of ' within a string literal if you use this function in a python script.
'''
Could I commit these code additions to the SVN repository?

Re: SchedulGhost

Posted: Sat Aug 18, 2012 10:45 am
by Pako
Thank you for the improvements.
The modified plugin is now stored in the repository.

Pako

Re: SchedulGhost

Posted: Wed Aug 29, 2012 10:28 am
by woodi
Hi, I can't get the disable-function to work properly.

I have this schedule running:
eg_log2.jpg
And it's working perfect.
eg_log1.jpg
But as you can see, when I execute the macro "Bathmode", the schedule Poolpump sets to be disabled for 11 minutes (10+1) in total. But it's not working, the schedule keeps sending ON-events anyway.

From the Schedule-logg:
2012-08-29 11:33:04 SchedulGhost plugin started. All valid schedules will be scheduled:
2012-08-29 11:33:04 Schedule "Poolpump" scheduled. Next time: 2012-08-29 11:36:00.
2012-08-29 11:36:00 Schedule "Poolpump" - Start event triggered. Next time: 2012-08-29 11:39:00.
2012-08-29 11:36:18 Schedule "Poolpump" canceled (disabled).
2012-08-29 11:39:00 Schedule "Poolpump" - Start event triggered. Next time: 2012-08-29 11:42:00.
2012-08-29 11:41:00 Schedule "Poolpump" - Stop event triggered.
2012-08-29 11:42:00 Schedule "Poolpump" - Start event triggered. Next time: 2012-08-29 11:45:00.
2012-08-29 11:44:00 Schedule "Poolpump" - Stop event triggered.
2012-08-29 11:45:00 Schedule "Poolpump" - Start event triggered. Next time: 2012-08-29 11:48:00.
2012-08-29 11:47:00 Schedule "Poolpump" - Stop event triggered.
2012-08-29 11:48:00 Schedule "Poolpump" - Start event triggered. Next time: 2012-08-29 11:51:00.
It seems like the schedule turns back to enabled by itself and keeps running. And no "enabled" line can be found in the Schedule-log either at 11:47:18.

BUT, it seems like the schedule doesn't trigger any OFF-event when disabled (should have triggered a OFF-event 11:37:00). But they start to be triggered again as soon as the ON-events starts.

Have I done something wrong in my setup or is there a bug in the disable/enable-function in the plugin?

Best regards
Johan

Re: SchedulGhost

Posted: Thu Sep 06, 2012 5:08 am
by Pako
Thank you for your bug report. I am a long time could not find a bug.
Finally, I found that the problem occurred only when the action "Disable schedule"
was executed between the start and stop events (but not always).
Corrected version can be downloaded from the SVN repository.

Pako

Re: SchedulGhost

Posted: Fri Sep 07, 2012 6:27 am
by woodi
Thanks Pako!

But I think a new bug occured instead.

Code: Select all

2012-09-07 08:11:19  SchedulGhost plugin started. All valid schedules will be scheduled:
2012-09-07 08:11:19  Schedule "Poolpump" scheduled. Next time: 2012-09-07 08:12:00.
2012-09-07 08:12:00  Schedule "Poolpump" - Start event triggered. Next time: 2012-09-07 08:15:00.
2012-09-07 08:12:11  Schedule "Poolpump" canceled (disabled).
2012-09-07 08:14:00  Schedule "Poolpump" - Stop event triggered.
I executed my macro "Bathmode" after the schedule Poolpump started (08:12:11) and the schedule sent an OFF-event while it was disabled.
But no ON-events anymore, thats good. :)

Best regards
Johan