No announcement yet.

Device Name by Refid

  • Filter
  • Time
  • Show
Clear All
new posts

  • Device Name by Refid

    How do I get a Device Name by its refid? Looks like you can use the Device Class to do this, but I'm missing something.

    DevCl = hs.GetDeviceByRef(Ref)
    DevName = DevCl.Name

    I'm trying to use RegisterStatusCB to get some info on device status changes. The parms passed are:
    parm(0) = Code part of the Address of the device that changed status
    parm(1) = Full Address of the device that changed status (including Code if present)
    parm(2) = The New value of the device that changed status.
    parm(3) = The Old value of the device that changed status.
    parm(4) = The device reference ID number. Can be used with GetDeviceByRef to find the DeviceClass of the specific device.

    Well, I got it finally by fumbling around:

    Sub Main(parms as Object)
    'Example of getting device name using refid
    Dim dv as Object = hs.GetDeviceByRef(84)
    Dim DevName as String = dv.Name(hs)
    hs.Writelog("Device Class", DevName)
    End Sub
    Produces this in the Log:
    May-27 4:16:19 PM Device Class Linksys Router

    What was throwing me is there's a GetDeviceRef in the scripting section of the HS3 doc, but not GetDevByRef except a brief mention in the Device Class section. No examples of how to use it.
    Last edited by mmn; May 27th, 2014, 03:11 PM.

    HS3, W10 Home, HSTouch, W800, Z-Stick+