Semantic model confusion - lightbulb

Hi,

Am having some challenges with lightbulb not showing up under equipment in the model (but under properties)

Group gHome 				"Home" 								["Location"]
Group gInside 				"Inside" 				(gHome)		["Indoor"]  
Group gOutside 				"Outside" 				(gHome)		["Outdoor"] 

Group gFrontOutsideWall 	"Front Outside Wall" 	(gOutside) 	["Location"]
Group gFrontBalcony 		"Front Balcony" 		(gOutside) 	["Location"]

Group gElectrical_Equipment 	 	"Electrical Equipment"									["Equipment"]
Group gFan 							"Fan" 					(gElectrical_Equipment) 		["Fan"] 
Group gLightbulb 					"Bulbs"					(gElectrical_Equipment) 		["Lightbulb"]

Items

//// Front Balcony -----------------------------
Switch 	frontbacony_1 				"Front Balcony Side Light" 		 				(gFrontBalcony, gLightbulb)  	["Light"] 				{ channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:1" , alexa="Lighting", alexa="Switchable"}
Switch 	frontbacony_2 				"Front Balcony Fan" 			<fan>  			(gFrontBalcony, gFan) 			["Switch", "Fan"] 		{ channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:2" , alexa="Switchable"}
Switch 	frontbacony_3 				"Front Balcony Plants" 			  				(gFrontBalcony, gLightbulb) 	["Switch"] 				{ channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:3" , alexa="Lighting", alexa="Switchable"}
Switch 	frontbacony_4 				"Front Balcony Ceiling Light" 	     	  		(gFrontBalcony, gLightbulb) 	["Switch"] 				{ channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:4" , alexa="Lighting", alexa="Switchable"}

However only fan show as equipment, lightbulbs as properties. what am i doing wrong ?

image

What you had would cause duplicate equipment.

  • An equipment can only belong to one location, or equipment.
  • A Point can only belong to one equipment

Try this instead

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)     ["Switch"]     {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:1" , alexa="Lighting", alexa="Switchable"}
Switch  frontbacony_2              "Front Balcony Fan Switch"            <fan>  (gFrontBalconyFan)           ["Switch"]     {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:2" , alexa="Switchable"}
Switch  frontbacony_3              "Front Balcony Plants Switch"                (gFrontBalconyPlantsLight)   ["Switch"]     {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:3" , alexa="Lighting", alexa="Switchable"}
Switch  frontbacony_4              "Front Balcony Ceiling Light Switch"         (gFrontBalconyCeilingLight)  ["Switch"]     {channel="mqtt:topic:myMQTTBroker:hmfrontbalcony:4" , alexa="Lighting", alexa="Switchable"}

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.

1 Like

Thanks, does that mean that say lighbulb1- cannot belong to both Equipment LightBulb and Location DrawingRoom at the same time ?

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)

1 Like

No, it can’t (or shouldn’t).

An equipment has a location

Say Equipment A belongs to Location X

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?

1 Like

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)

Assume LightBulb would need to be a group as a child to DrawingRoom (location)?

Yes

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.