Oops, I had forgotten to untick the "log only assigned and activated events" in Eventghost, so I actually never saw the events that were generated from your plugin!
krambriw wrote:If sun is down within next X minutes with/without weather consideration, the event "IsSunDown: True" is generated.
I tried it just now and the generated event does indeed include the result "False" twice, first one being the event, second one the payload:
9:40:55 Enable: TEST
9:40:55 SunTracker: Check if Sun will be down in X minutes: 0
9:40:55 (0, 60, u'Rain', 'Sunset expected at : ', '2129', 'Minutes left to wait: ', 649, 'Minutes adjusted: ', -60, 'IsSunDown: ', False)
9:40:55 print eg.result
9:40:55 False
9:40:55 Main.IsSunDown: False False
9:40:55 <start unnamed macro>
9:40:55 print eg.event.string
9:40:55 Main.IsSunDown: False
9:40:55 print eg.event.payload
9:40:55 False
I think it will definitely be worthwile to have the payload available for Python scripts that take actions on all events from the plugin, based on the payload. However, I noticed that the event prefix is Main and your event suffix is IsSunDown: False, i.e. including the 'False' statement:
9:45:21 print eg.event.suffix
9:45:21 IsSunDown: False
Would this not make it impossible to catch all related events (i.e. also the "IsSunDown: True") with using a wildcard? Or do you have another solution to catch events?
Also, would it be easy to add more payload options somehow? I would think that the "modified sunset time" and/or amount of time left until "modified sunset" would be a nice to have. Suppose that when you execute the script early on the day, you can use the amount of time left to the modified sunset time to set a timer to trigger an event. I know this can also be done by using your suntracker schedule, but this would be easier to use and maintain, I think.
It may also be more clear to the user if the description in the log print (and maybe also in the payload then?) could include "True sunset expected at:" and "Modified sunset expected at:".
Finally, to make it more clear what this action block of your plugin is doing, it might be a good idea to provide a clear definition inside the action block itself. Maybe something like:
"This plugin action creates a 'virtual new sunset time' based on an offset entered by the user in the first entry box, which can be 120 minutes prior to 120 minutes after true (unmodified) sunset time. Furthermore, this new virual sunset time can be further modified if the Weather compensation factor is used. Although the maximum amount of modification time to be applied is entered by the user, the actual amount of this additional time factor is calculated by the plugin automatically based on actual weather conditions obtained from the internet. Finally, the result of this action block returns True if, at the time this action block is executed, the Sun would have been down according to the calculated 'vritual new sunset time'.
Note: the true (unmodified) sunset time can be obtained by executing this action block and examining the print results in the log.
For further information and help: reference to this forum thread."
Ok, I will be testing some more in the next days and will get back if any issues/comments. Until then: thank you very much for your work and congratulations on the results thusfar!
Regards,
Perry