Announcement

Collapse
No announcement yet.

How do you get a device's name?

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

    How do you get a device's name?

    If you want a device's address, there's a simple "one-liner" to get it:
    hs.speak(hs.GetDeviceCode("Living Room Light"))

    Is there a way to do the opposite, give it an address and have it announce the name? After much trial & error, I wrote a short script to do this:
    dim dref as long
    dim dloc as Object

    dref = hs.getdeviceRef("L1")
    dloc = hs.GetDeviceByRef(dref)

    hs.speak (dloc.name)
    but I imagine there's a cleaner way to get this info -- maybe something along the lines of:
    hs.GetDevice("L1").name

    #2
    I thought there would be too but I guess there's not so the one liner would be:
    hs.speak (hs.GetDeviceByRef(hs.getdeviceRef("L1")).name)

    Kirby

    Comment


      #3
      That'll work then! Thanks for the confirmation!

      Comment

      Working...
      X