Announcement

Collapse
No announcement yet.

How to compare two device Values in an event

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

    How to compare two device Values in an event

    I would like to compare two temp. values in an event:

    If (device value 1) is greater than (device value 2)
    Then:

    Is this possible in a standard event?

    #2
    No it is not possible to do it as a trigger, I did ask and Rick said that he would look at doing it but that was some months ago. I can't find the thread to hand at the minute. To me it should be a native part of HomeSeer, I think (although don't have HS to hand) you could trigger on Device 1 Changing To Any Value and then execute a single line script to say something like if hs.devicevalue(1234) < hs.devicevalue(5678) then hs.triggerevent("Ev Name")

    but that does not exactly look the best and is not the easiest to follow in the HS events page.

    Comment


      #3
      Just found this thread searching for the same requirement.
      My HS2 based heating controls are largely written in script and I'm upgrading (ok, writing everything from scratch )and I was sitting here wondering why I used scripts rather than events. And the answer, is of course you cant compare two devices such as a setpoint and a temperature reading.

      Comment


        #4
        Originally posted by ecuboss View Post
        Just found this thread searching for the same requirement.
        My HS2 based heating controls are largely written in script and I'm upgrading (ok, writing everything from scratch )and I was sitting here wondering why I used scripts rather than events. And the answer, is of course you cant compare two devices such as a setpoint and a temperature reading.
        This was the only reason I needed the functionality because I was using HS as a thermostat. As much as I am loathed to do it I think I am going to look at writing a device comparison plugin, I will post back here if I actually get anywhere with it.

        Comment


          #5
          This seems like a fairly basic requirement for a rules engine... anyone know why this isn't available within an event?

          Comment


            #6
            Perhaps someone could log a bugzilla and we could all show our support by adding ourselves to that ticket? Agree, this would be useful
            Nicolai L

            Comment


              #7
              Originally posted by NicolaiL View Post
              Perhaps someone could log a bugzilla and we could all show our support by adding ourselves to that ticket? Agree, this would be useful
              I think this is a good idea. I too want to do this from time to time and have run out of time to write the scripts.
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                Whilst I put a Bugzilla request in for this I don't know how long or even if it will ever be added. In an hour I have managed to get a rough plugin that I think works to do this, if anyone wishes to test it you will find it attached to this post here. In a complex HS system with a lot of value change callbacks then it would be good if someone could monitor CPU use for it (memory should not be an issue, there are no objects created or files stored) for me - I have no easy way of getting a load of devices changing value to test myself but it is fairly light on processing.

                The logic is that whenever a device changes value then it will look at whether this device is listed in any of the triggers that the plugin owns. If the device is the first device in the event then it will perform the respective comparison (greater/less/equal etc) on the second device. Do be careful setting values as a result of these events that may be the triggers on other comparison events, it might be possible to get in some sort of loop so try and keep it reasonably simple.

                I have it running as a thermostat which is likely to be probably my only application for it but it eliminates a script + event which is what I used to have to do.

                If anyone uses it, has any feedback, wishes to see any more comparisons then let me know...that if it works that is.
                Last edited by mrhappy; March 13, 2015, 07:14 AM.

                Comment


                  #9
                  Originally posted by mrhappy View Post
                  Whilst I put a Bugzilla request in for this I don't know how long or even if it will ever be added. In an hour I have managed to get a rough plugin that I think works to do this, if anyone wishes to test it you will find it attached to this post here. In a complex HS system with a lot of value change callbacks then it would be good if someone could monitor CPU use for it (memory should not be an issue, there are no objects created or files stored) for me - I have no easy way of getting a load of devices changing value to test myself but it is fairly light on processing.

                  The logic is that whenever a device changes value then it will look at whether this device is listed in any of the triggers that the plugin owns. If the device is the first device in the event then it will perform the respective comparison (greater/less/equal etc) on the second device. Do be careful setting values as a result of these events that may be the triggers on other comparison events, it might be possible to get in some sort of loop so try and keep it reasonably simple.

                  I have it running as a thermostat which is likely to be probably my only application for it but it eliminates a script + event which is what I used to have to do.

                  If anyone uses it, has any feedback, wishes to see any more comparisons then let me know...that if it works that is.
                  Thanks for putting this together Adam and making it available. Will eliminate the need for some scripts.

                  Cheers
                  Al
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment


                    #10
                    One more comment to add to the appreciation for the work you do

                    Comment


                      #11
                      Adam,
                      Can you put a copy of this in the scripts library so it will be easier to find in the future.
                      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                      Comment


                        #12
                        Originally posted by Rupp View Post
                        Adam,
                        Can you put a copy of this in the scripts library so it will be easier to find in the future.
                        Then all the fun of searching for it will have gone - yes I am kidding, I will though I am curious does it work OK for anyone before I do?

                        Comment


                          #13
                          @ mrhappy,

                          You sir, are a rock star.

                          I too am in need of this kind of thing for controlling climate related events. I will try it out and give you some feedback!

                          EDIT:

                          How do you install this thing?
                          Originally posted by rprade
                          There is no rhyme or reason to the anarchy a defective Z-Wave device can cause

                          Comment


                            #14
                            Just drop the HSPI_DEVCOMPARE.exe file into your HS directory, go into the manage plugins list and enable it, it should then load up.

                            Comment


                              #15
                              Originally posted by rprade
                              There is no rhyme or reason to the anarchy a defective Z-Wave device can cause

                              Comment

                              Working...
                              X