Announcement

Collapse
No announcement yet.

ISY Insteon 3.0.0.54 - Beta 54 for HS3

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Version 3.0.0.37 released. See the first post in this thread for the download link and change log.
    --
    Bob Paauwe
    ISYInsteon Plug-in
    http://www.bobsplace.com/ISYInsteon/

    Comment


      Brilliant - that did it, working perfectly now. Thanks again for the rapid response Bob.

      Comment


        Version 3.0.0.38 release. See the first post in this thread for details and download link.

        This has some big changes and for the first time, will work on a Linux HomeSeer installation. Because of the nature of the changes, I've left the previous version available just in case you need to downgrade. If you do encounter any issues, please report them here.
        --
        Bob Paauwe
        ISYInsteon Plug-in
        http://www.bobsplace.com/ISYInsteon/

        Comment


          Version 3.0.0.39 release. See the first post in this thread for details and download link.

          Same notes as with 3.0.0.38. If you have issues, please report and if necessary you can downgrade to 3.0.0.37
          --
          Bob Paauwe
          ISYInsteon Plug-in
          http://www.bobsplace.com/ISYInsteon/

          Comment


            Script for updating ISY Variables

            Bob,

            I'm trying to write a script that updates ISY variables. Having some success, but I think I'm going at it the wrong way.

            I was originally thinking I could just do a &hs.SetDeviceValueByRef(x,y,True) which does update the value in the device. But I don't believe your plugin see's it as a change because the value isn't updated on the ISY.

            Next I found some references to using a 'CAPIControl.vb' script that I believe you alluded to in a post. Anyway, at first I was unable to make that script work. Upon changing the Status-Control from 'status' to 'control' for the range, I was able to make the script work and modify it for my purposes. So that good.

            But as I mentioned above, I know this is probably not correct thing to do, so I was trying to see if there is another way to update a value thru a script without modifying the ISY Variable device in HS. For the record, I am new to scripting in HS.

            Thanks

            Richard

            Comment


              Originally posted by ruderthanyou View Post
              Bob,

              I was originally thinking I could just do a &hs.SetDeviceValueByRef(x,y,True) which does update the value in the device. But I don't believe your plugin see's it as a change because the value isn't updated on the ISY.

              Yeah, The SetDeviceValue commands will change the HomeSeer device record but don't pass that information on to the plug-in so that it can control the device. You do need to use CAPI as you determined below.

              Next I found some references to using a 'CAPIControl.vb' script that I believe you alluded to in a post. Anyway, at first I was unable to make that script work. Upon changing the Status-Control from 'status' to 'control' for the range, I was able to make the script work and modify it for my purposes. So that good.
              This is close, but you shouldn't need to modify the status/value pairs on the device. The range control is there just to get a correct display. You want to use the status/value pair that is defined as a control (The value should be shown as -1).

              This script worked for me:
              Code:
              Sub Main(ByVal parm as object)
              
              Dim objCAPIControl As HomeseerAPI.CAPI.CAPIControl
              Dim dvRef as Integer
              
              dvRef = hs.GetDeviceRefByName("State_8_for_testing")
              
              objCAPIControl = hs.CAPIGetSingleControl(dvRef, True, "Value", False, False)
              If objCAPIControl IsNot Nothing Then
                 objCAPIControl.ControlValue = 100
                 hs.CAPIControlHandler(objCAPIControl)
              End If
              
              End Sub
              It has both the variable and the value hard coded. I used a state variable named "State_8_for_testing" and set it to 100 using the script.
              --
              Bob Paauwe
              ISYInsteon Plug-in
              http://www.bobsplace.com/ISYInsteon/

              Comment


                Bob,

                Something is just not working right. The IF statement in your code is evaluating as Nothing. The GetDeviceRefByName is properly returning the device's Reference ID, but that where it ends. I've tried it with all my variables devices, and even created a new variable.

                Here is my code:
                Code:
                Sub Main(ByVal parm as object)
                
                Dim objCAPIControl As HomeseerAPI.CAPI.CAPIControl
                Dim dvRef as Integer
                Dim dvName as String
                
                dvName = "State_6"
                dvRef = hs.GetDeviceRefByName(dvName)
                
                hs.writelog (dvName, dvRef.ToString )
                
                objCAPIControl = hs.CAPIGetSingleControl(dvRef, True, "Value", False, False)
                If objCAPIControl IsNot Nothing Then
                   hs.writelog (dvName, "Something" )
                   objCAPIControl.ControlValue = 100
                   hs.CAPIControlHandler(objCAPIControl)
                Else
                   hs.writelog (dvName, "Nothing" )
                End If
                
                End Sub
                The output to the log file is:
                Apr-10 2:59:32 PM State_6 Nothing
                Apr-10 2:59:32 PM State_6 2611

                I found a program to enumerate device and it's CAPIControls, this is what one the the variables reports:

                .CCIndex=0; Label=; ControlType=9; ControlValue=-1; ControlString=
                DevInfo Ref=2611; Name=State_6; Location=; Location2=; Address=VAR_2_6

                OK as I was typing this I noticed the CAPIGetSingleControlbyUse object, and changed the line in the code above to use hs.CAPIGetSingleControlbyUse(dvRef,ePairControlUse.Not_Speci fied), 'Not Specified' matching the Control Use for the first value status pair. That worked. The value updated.

                So with the code change my log output now looks like:

                Apr-10 3:26:59 PM ISYInsteon State_6 now at 100
                Apr-10 3:26:59 PM Device Control Device: State_6 to (100) by/from: CAPI Control Handler
                Apr-10 3:26:59 PM State_6 Something
                Apr-10 3:26:59 PM State_6 2611

                So now I'm wondering what's wrong that the first code isn't working for me.

                Thanks

                Richard
                Last edited by ruderthanyou; April 10, 2017, 05:31 PM.

                Comment


                  Originally posted by ruderthanyou View Post
                  Bob,

                  Something is just not working right. The IF statement in your code is evaluating as Nothing. The GetDeviceRefByName is properly returning the device's Reference ID, but that where it ends. I've tried it with all my variables devices, and even created a new variable.

                  .CCIndex=0; Label=; ControlType=9; ControlValue=-1; ControlString=
                  I think the query for the control is failing because the label isn't matching. You notice in call to CAPIGetSingleControl() there the argument "Value". That is supposed to be the label. It looks like yours has a blank label and thus, no match. I think you could just change that from "Value" to "" in the call and it would work.

                  But my next question is which version of my plug-in are you using? 3.0.0.37 changed the CAPI controls for variables. The control you listed looks like a pre 3.0.0.37 control. If you're not on the latest, I'd recommend updating now, otherwise everything you do to make this work may break when you do update.

                  I'm definitely not an expert when it comes to working with CAPI controls. I had to fiddle around with the code for a while before I got it working. I'll also admit that I'm not 100% confident that the way I create those controls in the plug-in is right. I may need to tweak something to get this working for you. But we'll figure it out.
                  --
                  Bob Paauwe
                  ISYInsteon Plug-in
                  http://www.bobsplace.com/ISYInsteon/

                  Comment


                    Bob,

                    I'm running 3.0.0.39. The device I enumerated was created using this version of the plug-in.

                    By the way, I did notice the label being blank. Unfortunately I did try the "" earlier and that didn't work for me either. As I was researching the CAPIGetSingleControl method to figure out what the label value should be, I noticed the other method, CAPIGetSingleControlbyUse. I believe it works because it doesn't rely on a label.

                    By the way, here is the code for enumerating a device in case you want to compare my device and yours:

                    Code:
                    Sub Main(ByVal strDevRef As String)
                    	Dim objDev As Object
                    	Dim intDevRef as Integer
                    	Dim intCount As Integer
                    
                    	intDevRef = CInt(strDevRef)	
                    	objDev = hs.GetDevicebyRef(intDevRef)
                    	
                    	If objDev Is Nothing Then
                    		hs.WriteLog("DevInfo","Invalid device ref: " & strDevRef)
                    	Else
                    		hs.WriteLog("DevInfo", "Ref=" & strDevRef & "; Name=" & objDev.Name(hs) & "; Location=" & objDev.Location(hs) & "; Location2=" & objDev.Location2(hs) & "; Address=" & objDev.Address(hs))
                    
                    		intCount = 0
                    		For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
                    			hs.WriteLog("DevInfo", ".CCIndex=" & CStr(objCAPIControl.CCIndex) & "; Label=" & objCAPIControl.Label & "; ControlType=" & CStr(objCAPIControl.ControlType) & "; ControlValue=" & CStr(objCAPIControl.ControlValue) & "; ControlString=" & objCAPIControl.ControlString)
                    			objCAPIControl.ControlValue = 10
                    			intCount = intCount + 1
                    		Next
                    		If intCount = 0 Then
                    			hs.WriteLog("DevInfo", "No CAPIControl objects defined for this device")
                    		End If
                    	End If
                    	
                    End Sub
                    Regards

                    Richard

                    Comment


                      Hi Richard,

                      I see the same thing now. I forgot that the label was something I was experimenting with but took back out. So all my variables still had the label set.

                      So maybe there's some way to use CAPIGetSingleControl() but it's not documented well enough. Maybe all the parameters are optional and you can leave out everything but the dvref.

                      The other functions will work though. I got it working using the CAPIGetControlEx() and using the first element of the returned array. Using CAPIGetSingleControlByUse() as you did should be fine too.

                      From what I can tell, the GetControl functions only get status/value pairs that are marked as control. I suspect you'd need to use the CAPIGetStatus() function to get the range that is status only.

                      The CAPI framework does allow for a lot of flexibility but it more complicated for the simple cases like this. It would be nice if HomeSeer provided better examples.
                      --
                      Bob Paauwe
                      ISYInsteon Plug-in
                      http://www.bobsplace.com/ISYInsteon/

                      Comment


                        Bob,

                        I'm back and so quick. Thought I would be gone, eh? Anyway, thanks for helping me on the previous one. Unfortunately I have another issue.

                        I've created an event that is very simple:

                        IF This event is MANUALLY triggered
                        THEN ISYInsteon ISY Device Actions
                        Control: Kitchen/ISY Scenes/+Kitchen Lights send: ON

                        Unfortunately this is what I get in my ISY event viewer log

                        Fri 04/14/2017 08:51:46 PM : [INST-TX-I1 ] 02 62 00 00 35 CF 13 00
                        Fri 04/14/2017 08:51:46 PM : [INST-ACK ] 02 62 00.00.35 CF 13 00 06 LTOFFRR(00)

                        Just like ON, TOGGLE also seems to only send OFF. All my scenes behave this way.

                        The others: OFF, FAST ON, FAST OFF, DIM and BRIGHT, they all work. You can see it with the log below:

                        Fri 04/14/2017 08:52:43 PM : [INST-ACK ] 02 62 00.00.35 CF 13 00 06 LTOFFRR(00)
                        Fri 04/14/2017 08:52:24 PM : [INST-ACK ] 02 62 00.00.35 CF 12 00 06 LTON-F (00)
                        Fri 04/14/2017 08:52:56 PM : [INST-ACK ] 02 62 00.00.35 CF 14 00 06 LTOFF-F(00)
                        Fri 04/14/2017 08:53:07 PM : [INST-ACK ] 02 62 00.00.35 CF 16 00 06 LTDIM (00)
                        Fri 04/14/2017 08:53:15 PM : [INST-ACK ] 02 62 00.00.35 CF 15 00 06 LTBRITE(00)

                        This issue is weird because this did work before. I've recently did an upgrade of your plug-in and HS. Not sure if this is what caused the issue though. But I'm guess yes.

                        If I control the scene thru 'Control a Device', then it works just fine - all actions including ON and Toggle.

                        I do prefer your method, as it doesn't require a scene to be actual devices in HS. By the way, I'm running 5.0.4, and as I mentioned this did work prior on this ISY version.

                        Thanks again

                        Regards

                        Richard
                        Attached Files
                        Last edited by ruderthanyou; April 15, 2017, 01:16 AM.

                        Comment


                          Hi Richard,

                          Originally posted by ruderthanyou View Post
                          Bob,

                          Just like ON, TOGGLE also seems to only send OFF. All my scenes behave this way.

                          The others: OFF, FAST ON, FAST OFF, DIM and BRIGHT, they all work. You
                          can see it with the log below:
                          I've reproduced this and have a fix that I'll publish shortly.


                          This issue is weird because this did work before. I've recently did an upgrade of your plug-in and HS. Not sure if this is what caused the issue though. But I'm guess yes.
                          The code for this hasn't changed since I wrote it in 2012 so I don't think it was a plug-in version update that caused it. Have you updated the ISY firmware lately? What version of the ISY firmware are running?

                          The issue is that the ISY is interpreting a ON @ 0 brightness as a OFF, I don't think it use to do that as I have other code in the plugin that converts ON @ 0 to an OFF. Since you can't actually set a scene to a brightness level, I've always just sent an ON and left the brightness level at a default of 0.

                          The fix is is to now force the brightness level to non-zero in this case.
                          --
                          Bob Paauwe
                          ISYInsteon Plug-in
                          http://www.bobsplace.com/ISYInsteon/

                          Comment


                            Bob,

                            I'm running 5.0.4, but I've been running on it just after it was released.

                            What's weird is that I just started using this call a couple weeks ago, and when I setup the events they worked just fine (or I thought so). They are used for a rare use case so really wasn't paying too much attention to them.

                            Now I'm going to use these calls much more often in conjunction with the stuff from the previous posts you helped me with, and that's when I noticed that they were not working.

                            I'm glad you confirmed you could duplicate it, because I thought I was going crazy. I really thought it was something I did. I was uninstalling/installing multiple different version of HS3 and your plugin in a test environment to figure out what caused it to stop working. I did manage to make the call work once (so I wasn't hallucinating) but after a reboot it stopped.

                            Originally posted by bpwwer View Post
                            The issue is that the ISY is interpreting a ON @ 0 brightness as a OFF, I don't think it use to do that as I have other code in the plugin that converts ON @ 0 to an OFF. Since you can't actually set a scene to a brightness level, I've always just sent an ON and left the brightness level at a default of 0.
                            I noticed this in the log file, I'm assuming the 0 after the DON below is the brightness level.
                            Code:
                            4/14/2017 10:52:51 PM	Sending DON, 0 to Kitchen/ISY Scenes/+Kitchen Lights Attempt 0	ProcessCommand
                            Anyway, thanks again

                            Richard

                            Comment


                              Posted version 3.0.0.40. See the first post in this thread for the link and details.
                              --
                              Bob Paauwe
                              ISYInsteon Plug-in
                              http://www.bobsplace.com/ISYInsteon/

                              Comment


                                Posted version 3.0.0.41. See first post for link and details.
                                --
                                Bob Paauwe
                                ISYInsteon Plug-in
                                http://www.bobsplace.com/ISYInsteon/

                                Comment

                                Working...
                                X