Driver / App Access to Device Room

Is there a way to access the room a device has been allocated, either within a driver or an app? Like I believe is available through Maker API.

Believe it was added to the device properties... Let me see if I can find it.

Edit: Found it

Try using device.roomName inside your driver.

3 Likes

Thanks. I knew I'd seen it somewhere....

Someone else recently (I can't find where) asked whether they could extract the Room name from a Device, using an app like Rule Machine. Clearly that's not currently possible, but could we make a feature request along those lines?

For example, simply by including Room Name as an automatic attribute for every device?

I can kinda see why some less static Device attributes / state variables are not made available in Rule Machine...


....but since switch is exposed, in this example, why not all?

All attributes actually are available ("room" is not a device attribute in platform terms, an interesting request but a different issue). However, the list is restrcited to types that match your variable, and your variable must be a string. The switch attribute is the only string attribute that device. The rest are numbers. You would see them with a number variable.

That makes perfect sense. I was wrongly assuming that String accepted all other data types as a catchall. TIL