Fritte wrote:I have some problem and think it's a bug.
It appears that a bug is actually in the plugin.
However, help is easy. You must first disable a schedule and only then you can set it and enable it.
Please use a modified script:
Code: Select all
import datetime
#Get payload
payload = eg.event.payload
alarmtime = payload[0]
eg.plugins.SchedulGhost.DisableSchedule(u'Godmorgon Johan')
if alarmtime == "off":
print "Godmorgon Johan inaktiverat"
else:
#Convert payload to date format -15 minutes
alarmtime = datetime.datetime.strptime(alarmtime, "%Y:%m:%d:%H:%M:%S") - datetime.timedelta(minutes=15)
#Schedule alarm time
d = alarmtime.strftime('%Y-%m-%d')
t = alarmtime.strftime('%H:%M:%S')
schedule = u"[0, u'Godmorgon Johan', 0, [u'%s', u'00:00:00', u'%s', 0], u'2013-01-01 00:00:00', u'SchedulGhost', u'Godmorgon.Johan', '', '']" % (t, d)
eg.plugins.SchedulGhost.AddSchedule(schedule)
eg.plugins.SchedulGhost.EnableSchedule(u'Godmorgon Johan')
print "Godmorgon Johan aktiveras: %s %s" % (d, t)
kkl wrote:I don't think I understand the Span value. Is it possible with SchedulGhost to have a Periodic event that only happens during certain hours of the day? I want to trigger an event every 20 minutes from 0800-2300. I get an error when putting in a Span value (thinking that a Span of 15:00:00 + 08:00:00 = 2300).
Could someone clue me in? Thanks.
Yes, it is obvious that you do not understand the meaning of the span.
And even that is very helpful to your case.
But you'll need one extra schedule.
The attached picture is an example.
I believe that now you'll understand.
Pako