Announcement

Collapse
No announcement yet.

Howto add a condition which is not a trigger?

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

  • Howto add a condition which is not a trigger?

    I have a hard time figuring out how to implement an event condition which is not a trigger.

    For example "The Noon phase is..." condition does exactly what I want: it is not in the list of triggers and only appears in the list if you add a condition (i.e. AND IF) to your event.

    Anyone know how to achieve that?

  • #2
    Originally posted by spud View Post
    I have a hard time figuring out how to implement an event condition which is not a trigger.

    For example "The Noon phase is..." condition does exactly what I want: it is not in the list of triggers and only appears in the list if you add a condition (i.e. AND IF) to your event.

    Anyone know how to achieve that?
    I can think of a kludgy kind of way. Trigger on time of day, say 7:00 am daily. The And IF has the moon phase condition. So once a day you're checking the moon phase.

    Doesn't get you exactly when the moon phase changes, but will get you within a day, or within x hours depending on how often during the day you trigger.
    Regards,
    Michael

    HS3, W7HP SP1, HSTouch, W800, Ztroller, TI103
    Intel Atom D2500 4GB RAM 60GB SSD

    Comment


    • #3
      sorry I badly explained my problem

      I'm creating a plugin and I want to implement a condition type which is not a trigger (similar to "The moon Phase is...")

      knowing that my plugin also has triggers, but those triggers are completely disjoint from the conditions. See below my code, the problem with this code is that "My Plugin Conditions" show in the list of possible triggers which is bad. Ideally HasTriggers() should take the TriggerNumber as a parameter exactly as HasConditions, but unfortunately it doesn't.

      Code:
          Public ReadOnly Property HasConditions(ByVal TriggerNumber As Integer) As Boolean Implements HomeSeerAPI.IPlugInAPI.HasConditions
              Get
                  Select Case TriggerNumber
                      Case 1
                          Return False
                      Case 2
                          Return True
                      Case Else
                          Return False
                  End Select
              End Get
          End Property
      
          Public ReadOnly Property HasTriggers() As Boolean Implements HomeSeerAPI.IPlugInAPI.HasTriggers
              Get
                  Return True
              End Get
          End Property
      
          Public ReadOnly Property TriggerCount As Integer Implements HomeSeerAPI.IPlugInAPI.TriggerCount
              Get
                  Return 2
              End Get
          End Property
      
          Public ReadOnly Property TriggerName(ByVal TriggerNumber As Integer) As String Implements HomeSeerAPI.IPlugInAPI.TriggerName
              Get
                  Select Case TriggerNumber
                      Case 1
                          Return "My Plugin Triggers"
                      Case 2
                          Return "My Plugin Conditions"
                      Case Else
                          Return ""
                  End Select
              End Get
          End Property
      Am I missing something?

      Comment


      • #4
        Ah, missed that it was in the Plugin Development forum. I was thinking of an Event.
        Regards,
        Michael

        HS3, W7HP SP1, HSTouch, W800, Ztroller, TI103
        Intel Atom D2500 4GB RAM 60GB SSD

        Comment


        • #5
          HasConditions needs to return True first of all. Even if HasTriggers is True, and some of those triggers are also conditions, HasConditions must also be True or it won't check when a condition is being added to an event.

          The key is the Condition property. If the user already has a trigger, the UI changes to show "AND IF", and the Condition property is set to True. So when you are asked to return the TriggerName, check the condition property. If it is False (it is a Trigger) return an empty string for that trigger number, and if it is True (it is a Condition) return the name of the condition.

          Here is a sample where there is one trigger and condition, one trigger only, and one condition only.

          mvarCondition is the local variable used by the Condition property.
          Attached Files
          Regards,

          Rick Tinker (a.k.a. "Tink")

          Comment


          • #6
            have you actually tested this?

            according to my tests it doesn't work because the Condition property is only set once you choose the trigger/condition, so when you add your first condition and the "AND IF" line appears mvarCondition is still false which results in the dropdown being filled with the triggers instead of conditions

            or maybe it has been fixed in a more recent version of HS3? I'm on 3.0.0.84

            Comment


            • #7
              Uh, oops! Right - at the TOP level that does not work - it is with the subtriggers/subtrigger names that you do that.

              You have to have it show a name for the trigger (I forgot) because that is the initial list generated that gets you to your plug-in.

              So in SubTriggerName, if mvarCondition is False, then return an empty string. It results in the user having a Trigger that they can never complete, but the trigger name has to be in that initial list. If the user is in condition mode, then SubTriggerName returns the name of the condition and then that is how you get there.
              Regards,

              Rick Tinker (a.k.a. "Tink")

              Comment


              • #8
                to make it work, couldn't the Condition property be set everytime before TriggerName is called?

                or as I said in the first place couldn't HasTriggers() takes a TriggerNumber parameter like HasConditions so that we can define conditions that are not triggers

                moreover it seems that you can do it at the top level from HS3 itself because that's the way "The Moon phase is..." work, i.e a condition that does not appear in the list of triggers

                Comment


                • #9
                  Sure. Submit an enhancement ticket in Bugzilla and Rich can prioritize it.
                  Regards,

                  Rick Tinker (a.k.a. "Tink")

                  Comment


                  • #10
                    done: http://www.homeseer.com/bugzilla/show_bug.cgi?id=2062

                    when can I expect to see this implemented? I really need it. Thanks

                    Comment


                    • #11
                      Will probably be a while before we can get to this, but I see you submitted a ticket.

                      Originally posted by spud View Post
                      done: http://www.homeseer.com/bugzilla/show_bug.cgi?id=2062

                      when can I expect to see this implemented? I really need it. Thanks
                      website | buy now | support | youtube

                      Comment


                      • #12
                        Was this ever completed and if so, how do you create a "trigger" that is a condition only?
                        Thanks,
                        Frank

                        Comment


                        • #13
                          Originally posted by sirmeili View Post
                          Was this ever completed and if so, how do you create a "trigger" that is a condition only?
                          I don't think it has ever been completed.

                          Comment


                          • #14
                            Originally posted by spud View Post
                            I don't think it has ever been completed.
                            How did you get around it or did you not?

                            I have an idea for a condition, but it makes a really bad trigger and I would never want anyone to use it as such.
                            Thanks,
                            Frank

                            Comment


                            • #15
                              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.

                              Comment

                              Working...
                              X