HomeSeer / Plugin-SDK

Plugin development kit for the 4th major edition of the HomeSeer platform.
https://www.nuget.org/packages/HomeSeer-PluginSDK/
GNU Affero General Public License v3.0
21 stars 5 forks source link

Working on event triggers..... #26

Closed wvuyk closed 5 years ago

wvuyk commented 5 years ago

I am trying to implement the triggers I defined in the HS3 version, but I think I either miss some info on how to do this, or it is not working in the current alpha (4.0.0.27). I have defined a triggertype "Any_On_Trigger" and added it to the TriggerTypes collection for the plugin.

I have created a simple view with a select list, and I can use it in an event. It is being set and saved. Next thing I would expect is that the IsTriggerTrue method would be called from homeseer. But up till now it is not called even once? I have tried to check if the event is disabled, but in the current interface of events there seems to be no way of checking if the event is enabled or disabled....

How can I check if an event is disabled or enabled, and more important, why is the IsTriggerTrue method not called?

Wim

wvuyk commented 5 years ago

I went to the old interface of HS3 and was able to see the event was still disabled. I anebled the events I created, but still IsTriggerTrue is never called?

Any response here?

jldubz commented 5 years ago

I recommend you take a look at issue 18 if you haven't yet. A good process workflow is mapped out there.

I do not think the IsTriggerTrue method is the method you think it is. The inline documentation states:

/// <summary>
/// Called by HomeSeer to determine if this trigger's conditions have been met.
/// </summary>
/// <remarks>
/// Always return TRUE if the trigger cannot be a condition and there is nothing to check when an event is
///  manually executed by a user.
/// </remarks>

and it does not sound like you are trying to evaluate the trigger as a condition.

I think you are either looking for the IsFullyConfigured method - AbstractTriggerType.IsFullyConfigured if you are trying to determine if it is fully configured on save.

Or

If you are looking for something that fires the trigger, you will need to build that yourself, and, when your plugin has determined it needs to fire the trigger, it should call HomeSeerSystem.TriggerFire() to execute the event. There is an example of this in the sample plugin at HSPI.cs Line 270 or HSPI.vb Line 245

wvuyk commented 5 years ago

Jon-Luke,

You are right. Confused the TriggerFire and IsTriggerTrue.... I have corrected it here and it works fine now...

Am closing this issue

Thanks,

Wim