If you want to group all lightbulbs and all fans, you can do that but do not include semantic model into it.
e.g.
// Non semantic groups
Group gLightBulbs
Group gFans
// Semantic Model
Group gHome "Home" ["Location"]
Group gInside "Inside" (gHome) ["Indoor"]
Group gOutside "Outside" (gHome) ["Outdoor"]
Group gFrontBalcony "Front Balcony" (gOutside) ["Location"]
//// Front Balcony -----------------------------
Group gFrontBalconyFan "Front Balcony Fan" (gFrontBalcony) ["Fan"]
Group gFrontBalconyLightBulb "Front Balcony Light" (gFrontBalcony) ["Lightbulb"]
Group gFrontBalconyCeilingLight "Front Balcony Ceiling Light" (gFrontBalcony) ["Lightbulb"]
Group gFrontBalconyPlantsLight "Front Balcony Plants" (gFrontBalcony) ["Lightbulb"]
Switch frontbacony_1 "Front Balcony Light Switch" (gFrontBalconyLightBulb, gLightBulbs) ["Switch"] {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:1" , alexa="Lighting", alexa="Switchable"}
Switch frontbacony_2 "Front Balcony Fan Switch" <fan> (gFrontBalconyFan, gFan) ["Switch"] {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:2" , alexa="Switchable"}
Switch frontbacony_3 "Front Balcony Plants Switch" (gFrontBalconyPlantsLight, gLightBulbs) ["Switch"] {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:3" , alexa="Lighting", alexa="Switchable"}
Switch frontbacony_4 "Front Balcony Ceiling Light Switch" (gFrontBalconyCeilingLight, gLightBulbs) ["Switch"] {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:4" , alexa="Lighting", alexa="Switchable"}
This will allow you to send a command to gLightBulbs to turn them all off, for example, or create a rule that triggers whenever any light bulb is turned on. Such groups are not part of the semantic model.
Your switch lightbulb1 can only be member of the equipment or the location. But having it a member of the equipment, this can be part of the location:
DrawingRoom (location)
—-LightBulb (equipment)
——-lightbulb1 (point / switch item)
So if you have equipment B that belongs to Equipment A (remember this is located in X) and also to a Location Y, then it has an ambiguous location. Is Equipment B located in X or Y?
Another way to look at it could be that the location of child (if any) overrides the location of parent.
A related query - can you specify a location as part of things definition via file based config? i tried using the @ “xx” syntax but that doesnt work (i maybe using it incorrectly)
Just to avoid potential problems with future readers, the complete set of rules are:
A Location can only belong to 0 or 1 other Location
An Equipment can only belong to 0 or 1 Location or 0 or 1 other Equipment (i.e. it can belong to either a Location or an Equipment but not both at the same time)
A Point can belong to 0 or 1 Location, 0 or one Equipment, or nothing at all (same as above, it cannot belong to both a Location and an Equipment at the same time)
To put the rule concisely, any member of the semantic model can only appear in the semantic model once.
No. Things do support a “location” field but this is really kind of a legacy thing and not really used for anything practical in OH any more except for organizing the Things page in MainUI.