How create hierarchy of locations?

Hi, I’m new to openHAB and want to create a hierarchy of locations in a semantics model. However, I seem not to be able to add a location under an already created location. As shown in the screenshot I’d like to have ‘Living Room Large Window’ as a sub-location to ‘Living Room’.

Hardware: Raspberry PI4 running OpenHAB docker container on Ubuntu Server.

Don’t create Items by hand. A Location Item is an Item that holds a Lat,Long coordinate.

In the semantic model, a location is a Group Item with one of the supported semantic class tags for a location.

Only a Group Item can be a location in the semantic model.

In the Semantic Model view, use the “add to model” entries to create your locations and you won’t run into any trouble. If you use the “add to model” menu on the right to create a semantic location, don’t change the type of the Item.

This section of the Getting Started tutorial walks you through the steps to create the locations in your semantic model.

1 Like

Thx Rich for the reply! Yes, my mistake was that I changed the ‘type’ from ‘Group’ of my item ‘Living Room’ to ‘Location’ when I created it via ‘Add Location’. Thereby the ‘Add to Model’ option is not visible, it becomes a sort of end-node/leaf. I guess the rule of thumb is to always create an item that is intended to be a ‘location’ with the (default) type ‘group’ as you wrote. Otherwise one will have to need to know the exact depth of the location hierarchy upfront, right? It was confusing however to see that there exists a type ‘Location’ as an alternative to ‘Group’, I wonder when that is needed?

No, a Location tagged Item can only be a Group. No other Item type should be used for a Location. It makes no sense. The way you put an Equipment or a Point into a Location is through Group membership. Only a Group Item has members.

When you have something like the GPS Tracker binding reporting your current geocoordinates to OH (automations can be driven based on where you are in the world, or you can just drop a pin on the map). The Location Item holds the lat,lon and provides some utility functions to measure distance between two points and such.

1 Like