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
20 stars 4 forks source link

Is there a way to know whether a trigger is trigger or condition on creation? #277

Open avargaskun opened 2 years ago

avargaskun commented 2 years ago

Environment

HomeSeer

OS

Windows and Linux

HS Version

v4.2.12.0

Development

PSDK Version

v1.4.0.0

Language

C#

IDE

VSCode

Dev OS

Mac

Plugin

HSBuddy

Problem

The plugin has a trigger that supports being both a trigger and a condition. The trigger instance needs to know which kind it is to define the UI of the ConfigPage. In HS3, it was possible to do this by implementing public void set_Condition(IPlugInAPI.strTrigActInfo TrigInfo, bool Value) in the IPluginAPI interface, but that is no longer available as part of the AbstractPlugin class.

Is there a way to obtain this information when a trigger is being created/modified in HS4 plugins?

Description

(See problem definition above)

Expected Behavior

A way to determine if a trigger instance is a trigger or a condition when being created/configured.

Steps to Reproduce

NA

Screenshots

NA

Logs

NA

alexbk66 commented 2 years ago

There's public override bool CanBeCondition and public override bool IsTriggerTrue(bool isCondition) image image

avargaskun commented 2 years ago

Thanks. These aren't the same as what I'm looking for. The way I understand, CanBeCondition is to tell HS that my Trigger should also appear available as a condition (which is true in my case) and IsTriggerTrue is what HS calls to check for the status of the trigger.

What I need is a way to ask HS from my plug-in (in OnNewTrigger as well as later on) if a particular instance of the trigger is configured as a trigger or as a condition. In HS3 that was passed in as a plug-in callback, but that doesn't seem to exist in HS4.

alexbk66 commented 2 years ago

So, is bool isCondition what you need?

spudwebb commented 2 years ago

This is a request that is in our TODO list as PSDK-111

https://github.com/HomeSeer/Plugin-SDK/issues/171 https://github.com/HomeSeer/Plugin-SDK/issues/237