Talk:Location Object

From Hubitat Documentation
Revision as of 16:49, 4 February 2020 by WesleyMC (talk | contribs) (Created page with "The '''location.getModes()''' function lacks documentation. The SmartThings [https://docs.smartthings.com/en/latest/ref-docs/location-ref.html#getmodes getModes()] documentati...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The location.getModes() function lacks documentation. The SmartThings getModes() documentation suggests a return type of List<Mode>. Hubitat does not appear to have a Mode type; so, the following generates an error:

List<Mode> discoveredModes = location.getModes()

Through experimentation, it does look like location.getModes() returns a list of <id(string), name(string)> pairs; so, code like the following does work:

def discoveredModes = location.getModes()
paragraph "@0 id: ${discoveredModes[0].id} \tname: ${discoveredModes[0].name}"
paragraph "@1 id: ${discoveredModes[1].id} \tname: ${discoveredModes[1].name}"
paragraph "@2 id: ${discoveredModes[2].id} \tname: ${discoveredModes[2].name}"