Version 3.0.0.37 released. See the first post in this thread for the download link and change log.
Announcement
Collapse
No announcement yet.
ISY Insteon 3.0.0.54 - Beta 54 for HS3
Collapse
This is a sticky topic.
X
X
-
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.
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 PostBob,
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 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
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
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
RichardLast edited by ruderthanyou; April 10, 2017, 05:31 PM.
Comment
-
Originally posted by ruderthanyou View PostBob,
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=
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.
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
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.
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
RichardAttached FilesLast edited by ruderthanyou; April 15, 2017, 01:16 AM.
Comment
-
Hi Richard,
Originally posted by ruderthanyou View PostBob,
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:
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 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.
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 PostThe 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.
Code:4/14/2017 10:52:51 PM Sending DON, 0 to Kitchen/ISY Scenes/+Kitchen Lights Attempt 0 ProcessCommand
Richard
Comment
Comment