Announcement

Collapse
No announcement yet.

Howto add a condition which is not a trigger?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by spud View Post
    I just end up with triggers that can't be used. For example in the EasyTrigger plugin "A plugin is..." can only be used as a condition but it still appear in the list of triggers.
    Thanks Spud! I appreciate it.
    Thanks,
    Frank

    Comment


    • #17
      Originally posted by spud View Post
      I just end up with triggers that can't be used. For example in the EasyTrigger plugin "A plugin is..." can only be used as a condition but it still appear in the list of triggers.
      Spud, did you ever come up with a solution to this? I have this exact same issue and am trying to decide how to handle. I have a couple triggers and then a condition that can't be a trigger. I hit the same place you did where the condition can be selected as a trigger which isn't a good user experience.
      HS 3.0.0.435 (PRO)
      Hardware: Napco GEM-P9600 | VenstarT1800 w/Insteon 2441V adapter | Insteon PLM
      Plugins HS3: Napco Gemini (mine) | Insteon Thermostat (mine) | Insteon Plug-in (mnsandler) | HSTouch Server (HST)
      Platform: Windows 10 Pro 64bit, core2 duo 2.0Ghz, 4GB memory
      http://www.kazteel.com/

      Comment


      • #18
        Originally posted by nfrobertson View Post
        Spud, did you ever come up with a solution to this? I have this exact same issue and am trying to decide how to handle. I have a couple triggers and then a condition that can't be a trigger. I hit the same place you did where the condition can be selected as a trigger which isn't a good user experience.
        not a very good one, but now when a user choose a trigger that can only be a condition, the plugin displays "Not available as a trigger (IF / OR IF) only as a condition (AND IF)" as the only subtrigger choice.

        Comment


        • #19
          Thanks Spud.

          I sat there thinking about Tink's solution and why it might work for my use. I use a top level "My Plugin Name : Special Triggers" for the TrigNum=1 (I only have that 1 TrigNum), and then I include as the SubTrigNum the list of triggers/conditions. So, I finally am making use of Condition() to set a variable that tells the plugin what the user is doing. Down in SubTriggerName() have some logic to check it. If Condition() has set the variable to False meaning it's being used as a trigger, I return "" for the SubTrigNum's name that is a condition only. In my initial couple tests this appears to do exactly what I want. The list of sub-triggers only shows those that are actually the triggers. After that trigger is set, it moves on to condition mode and I adjust the logic to shows only those that are capable of being conditions.

          I see you have multiple top level TrigNums for EasyTrigger instead of one as the entry point with sub triggers like I'm doing. However, isn't this same mechanism possible in the TriggerName() call like I think Tink originally mentioned? I have developer debug logging on all these method calls right now and the very first thing that is done is Condition.Set() when a new event is started. I'd think that would set the variable and could be used in TriggerName() to control the top most level of triggers with the first IF (aka trigger) section ?
          HS 3.0.0.435 (PRO)
          Hardware: Napco GEM-P9600 | VenstarT1800 w/Insteon 2441V adapter | Insteon PLM
          Plugins HS3: Napco Gemini (mine) | Insteon Thermostat (mine) | Insteon Plug-in (mnsandler) | HSTouch Server (HST)
          Platform: Windows 10 Pro 64bit, core2 duo 2.0Ghz, 4GB memory
          http://www.kazteel.com/

          Comment


          • #20
            Originally posted by spud View Post

            not a very good one, but now when a user choose a trigger that can only be a condition, the plugin displays "Not available as a trigger (IF / OR IF) only as a condition (AND IF)" as the only subtrigger choice.
            I revisited this thread because another member was asking about this. For your Condition "A plugin is..." , couldn't Triggers based on a plugin having just been stopped or started be provided? This is not something I want or need in your plug-in, I was just wondering if that would be possible.

            Randy Prade
            Aurora, CO
            Prades.net

            PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

            Comment


            • #21
              Originally posted by rprade View Post
              I revisited this thread because another member was asking about this. For your Condition "A plugin is..." , couldn't Triggers based on a plugin having just been stopped or started be provided? This is not something I want or need in your plug-in, I was just wondering if that would be possible.
              I guess it would be possible to add such triggers. The plugin would need to constantly poll HS3 to get the list of running plugins, not ideal but possible.

              Comment


              • #22
                Originally posted by spud View Post

                I guess it would be possible to add such triggers. The plugin would need to constantly poll HS3 to get the list of running plugins, not ideal but possible.
                You could subscribe to log events and look for the "Starting Plug-In" log line from HS...

                Comment

                Working...
                X