Announcement

Collapse
No announcement yet.

Get device data based on device name, location1 and location2

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

  • tenholde
    replied
    While the combination of: Location2 + Location + Name may not be unique, you can obtain device info via the full name. HS will return the first device that matches. If you know you do not have duplicates, then you will be fine.

    Code:
    hs.GetDeviceRefByName("Basement Storage CedarClosetDoor"))
    
    hs.DeviceStringByName("Basement Storage CedarClosetDoor")
    
    MyDevice = CType(hs.GetDeviceByRef(hs.GetDeviceRefByName("Basement Storage CedarClosetDoor")),Scheduler.Classes.DeviceClass)
    Courtesy of: http://tenholder.net/tenWare2/tenScriptAid/default.aspx

    Leave a comment:


  • jon00
    replied
    As location 1 and/or location 2 can be duplicated between devices, it would not be possible to do this as a specific scripting command.

    Best to iterate though all devices and find what you are looking for. Takes no time at all to go through the list.

    Leave a comment:


  • Get device data based on device name, location1 and location2

    I looking for a way to get device data with the devicename and location 1 (and location2) as search criteria.
    In my HS setup the name en location1 gives me already the capability to address every single device.

    I've seen the topics (solutions) that go through the whole devicelist but is it possible to query the HS db and fetch directly single device data like the Reference ID?
Working...
X