Get/Set room in a driver

Is there a method or attribute to read a driver's [instance] room?
I'm developing a parent/child driver model, and in my case the children are always in the same room of the parent, so I would be saving some manual interaction if I could read the parent's room and set it to every child upon creation.

I have tried to call getRoom() and access a room attribute, but both failed.

1 Like

Right now, you can only read room name with read only roomName property.
Yeah, it would make sense to have a method that assigns all child devices to the parent's room. Let me see what I can do...

2 Likes

I think we need to be carful here. There are cases when a parent device might have a room assigned and the child devices might have different rooms. In my case a double switch module can be located in a hallway but each switch control a light in a different room next by. In this case I usually do not assign a room at all to the parent device but rather in the child level only.

2 Likes

Totally agree - I use a parent/child setup for my ecowitt sensors. And the child devices are in very different physical locations!

1 Like

Iā€™m thinking of a method that driver can call. No pre-filling by default, on demand functionality only.

7 Likes

That works - I like it!

1 Like

Download the Hubitat app