Announcement

Collapse
No announcement yet.

Dim Device Control labeling

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

    Dim Device Control labeling

    Hi Wim, hope all is well.

    Ran into a very perplexing problem that took me a couple of days to figure out. I'll try to summarize...

    I have a script that I use to control dimmable Homeseer objects/devices via events triggered by central scenes. In order to use the CAPI Control Handler you have to supply the Label of the control object you wish to set a value for. The below snippet works with any dimmable object in my system.

    Code:
    Imports System.Threading, System.Convert
    Sub Main(ByVal Parms As Object)
    
    Dim ParmArray() As String
    ParmArray = Parms.ToString.Split(ToChar(","))
    
    Dim DeviceRef As Integer = Integer.Parse(ParmArray(0))
    Dim DimValue As Integer = Integer.Parse(ParmArray(1))
    
    '' set the device to the dim value
    Dim cc As HomeSeerAPI.CAPIControl = hs.CAPIGetSingleControl(DeviceRef, True, "Dim (value)%", False, False)
    cc.ControlValue = DimValue
    Dim cr As HomeSeerAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
    
    End Sub
    But it throws an error when I try to control a JowiHue light device.

    I finally figured out that JowiHue light objects are not labeled like every other dimmable light in HS4, specifically, there's no "Dim" prefix.

    Below illustrates this:
    Click image for larger version

Name:	Capture.PNG
Views:	212
Size:	41.2 KB
ID:	1481064

    Now... I can solve this by manually altering the JowiHue light device and adding the "Dim" prefix to the status control, but I'd have to remember to do this every time I add a new light device. And I suspect if I use the reset the status/graphics option I'd lose the prefix. Or I can maintain two different scripts where the control label is just "(value)%"

    But my favorite solution would be if you could add the Dim prefix so JowiHue lights look like every other light

    Thoughts?

    #2
    Tony,

    I was on the wrong foot here for a while as I was sure I had set the ControlUse values to Dim.

    And it was indeed set correctly from the plugin. Tested it and it worked just fine for me.
    But I just realized you are using a different CAPIGetControl then I was testing with. You are checking for the description fields (wich for sure can/will differ per plugin), where I was using the controluse fields like "objCAPIControl = hs.CAPIGetSingleControlByUse(dvRef,ePairControlUse.Dim)". This method is not depending on the description used by a plugin and will work immediatly.

    I still can add the Dim description for future changes if needed btw. It was set, but on a wrong label field of the device.

    Wim
    -- Wim

    Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

    1210 devices/features ---- 392 events ----- 40 scripts

    Comment


      #3
      Actually, I appreciate the detailed feedback. The method I was using I copied from a script someone else came up with. I tried reading through the HS script/API documentation, but not having done programming in decades, it started to melt my brain. I will try to adopt the method you outlined above because like you said it's not dependent on labeling.

      Another thing to note about the JowiHue On/Off/Dim device object, it doesn't fully respond to the HS4 "Linked" device feature. I tried linking a Z-wave dimmer to device 370 as noted in my image above, the On/Off function successfully links, but the Dim does not. Not sure if this is limitation of the HS4 Link feature or something else. Note that if I try to link two other dimmers together all functions work.

      Comment


        #4
        The trouble with linked devices is that both must match the values on both sides. I have not tested those and am not sure if the sync does work reliable. When I have time I can try to sync with a virtual device to see if all functions.
        -- Wim

        Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

        1210 devices/features ---- 392 events ----- 40 scripts

        Comment


          #5
          The new version that has been published is setting the Dim preset correctly again. To enable it you will need to reset the device on the Properties/JowiHue tab.
          -- Wim

          Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

          1210 devices/features ---- 392 events ----- 40 scripts

          Comment

          Working...
          X