Originally posted by Bernold
View Post
Announcement
Collapse
No announcement yet.
I struggle to understand how to use Triggers in HS4
Collapse
X
-
Originally posted by Bernold View Postalexbk66: That issue on GitHub is closed, but it ends with you going to check. I wonder if the issue needs to be reopened. I'm relatively new to triggers, so I'm not sure it's just me. What I do know is that I avoided IsFullyConfigured(). I believe I used GetPrettyString() instead as a workaround, to lower the amount of calls. Which is madness. If anyone can confirm, the issue should just be reopened for better performance.
Here is what I see when I add Console.WriteLine(DateTime.Now) to IsFullyConfigured() in the Sample Plugin CS as a test:
- Create an event and pick Sample Trigger as a trigger: called 3 times within the same second
- Pick any of its 4 subtriggers: 3 calls
- Save the trigger: 4 calls(!)
- Opening the Events page: 1 call(?)
- Reopening the specific event: 3 calls
HS4Pro on a Raspberry Pi4
54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI
HSTouch Clients: 1 Android
- Likes 1
Comment
-
alexbk66 Can you guide me on how to fire a trigger from the plugin? Because I am really confused with this.
My requirement is, I have implemented the IsTriggerTrue method to check whether the Trigger should be fired. Now I want it to just fire when the condition is true. What do I need to do in the plugin to achieve this? I don't want any user interaction for firing the trigger. That is no Button/UI Control to fire the trigger. Whenever the IsTriggerTrue returns true I need the trigger to be fired.
Comment
-
Please read docs https://homeseer.github.io/Plugin-SD...iggerType.html
Also there's a sample plugin https://github.com/HomeSeer/Sample-Plugin-CS
TriggerTrue() is "Called by HomeSeer when a trigger needs to be evaluated as a condition" - meaning that this is only called when there's some "main" trigger setup, then HS checks this trigger is used as condition (i.e. AND) and if its condition is met. But "bool isCondition" argument is confusing because my understanding is that it's only called for condition anyway.
- Likes 1
Comment
Comment