Semantic Model Warning: "Item has invalid semantic structure - belongs to multiple Equipments"

Hi all,

I’m getting the following warning in my openHAB logs:

Item 'Sensor_GF_Kitchen_ShellyTwoSignalStrength' (Point) has invalid semantic structure: It belongs to multiple equipments [Group_House_Sensors, Group_GF_Kitchen_Sensors]. A Point can only belong to at most one Equipment.

Here’s how my item and group definitions look:

Item:

Number:Dimensionless Sensor_GF_Kitchen_ShellyTwoSignalStrength "Mikrowelle Signalstaerke"
(Group_House_Sensors, Group_GF_Kitchen_Sensors, Group_House_NotPersistedEveryChange, Group_House_NotPersistedEveryHour)
["Measurement", "Level"]
{ channel="shelly:shellyplus1pm:d4d4da353774:device#wifiSignal", stateDescription=" "[ pattern="%.2f %unit%" ], unit="one" }

Group Definitions:

Group Group_House_Sensors "Gesamte Wohnung Sensoren" (Group_House) ["Sensor"]
Group Group_GF_Kitchen_Sensors "Kueche Sensoren" <window> (Group_GF_Kitchen) ["Sensor"]

From my understanding, both groups being tagged as ["Sensor"] might be treated as Equipment, which conflicts with the semantic model rule that a Point can belong to only one Equipment. Could someone confirm this and suggest the best practice here?

Should I:

  • Remove the ["Sensor"] tag from one group?
  • Redefine my semantic structure differently?

Thanks in advance for your help!

It seems to me that you should remove the sensor tag from both groups. Neither is a proper equipment. It seems that you meant to use those groups as groups of (multiple) equipment, thus they themselves aren’t equipment.

how is than the correct semantic model definition of this

Number:Dimensionless Sensor_GF_Kitchen_ShellyTwoSignalStrength "Mikrowelle Signalstaerke"
(Group_House_Sensors, Group_GF_Kitchen_Sensors, Group_House_NotPersistedEveryChange, Group_House_NotPersistedEveryHour)
["Measurement", "Level"]
{ channel="shelly:shellyplus1pm:d4d4da353774:device#wifiSignal", stateDescription=" "[ pattern="%.2f %unit%" ], unit="one" }

Group Definitions:

Group						Group_House										"Gesamt Wohnung"			<group> ["House"]
Group						Group_GF_Kitchen						"Kueche"						<kitchen>		(Group_GroundFloor) ["Kitchen"]
Group Group_House_Sensors "Gesamte Wohnung Sensoren" (Group_House) ["Sensor"]
Group Group_GF_Kitchen_Sensors "Kueche Sensoren" <window> (Group_GF_Kitchen) 
["Sensor"]

I followed this description

Not quite.

The semantic model is hierarchy of the physical layout of your home automation. You can’t have a physical device in more than one location at the same time. You can’t have a sensor or actuator that is a part of more than one location at the same time. It’s physically impossible, so the semantic model doesn’t support it.

You’d have the following hierarchy assuming you have one physical device that is providing all the sensors:

House (Location)
    |_Kitchen (Location)
        |_Kitchen_Sensors (Equipment)
            |_Kitchen_Temperature (Point)
            |_...

In the semantic model, you don’t need a House_Sensors because it’s already known that Kitchen_Temperature is in the House because it’s in the Kitchen which is in the house. We know the device is a sensor because Kitchen_Sensors is tagged as such.

If for some reason you need a functional Group of all the sensors in your house (e.g. to trigger a rule) you can still do that. But that Group needs to exist outside the semantic model (i.e. no semantic tag). So @jimtng is exactly right. Group_House_Sensors should not have a semantic tag and, unless Group_GF_Kitchen_Sensors represents a single physical device, this Group should not have a semantic tag either. But if Group_GF_Kitchen_Sensors does represent a physical device, it’s poorly named.

Group_GF_Kitchen_Sensors

Should be all sensors in the kitchen not only one…so it can’t be an equipment, because an equipment is only one single device right?

Correct. For example, if you have a smoke alarm, thermometer, and water leak sensor in the kitchen, each would be represented by a separate Equipment Group. But again, you can still have the Kitchen_Sensors Group, just remove the semantic tag.

1 Like

So if I have three Shelly devices I need a three groups as equipment?

Group_GF_Kitchen_SensorsShellyOne
Group_GF_Kitchen_SensorsShellyTwo
Group_GF_Kitchen_SensorsShellyThree

But a thing can’t be an equipment?

If yes how is the syntax for the things file?

That’s the intent. However, you have some flexibility here. If these three devices will only ever be used by OH and the users of your home as if they were a single device then certainly you can model them as if they were a single equipment.

You can also model them as an equipment of equipments.

House (Location)
    |_Kitchen (Location)
        |_Kitchen_Sensors (Equipment)
            |_ShellyOne (Equipment)
            |    |_Kitchen_Temperature (Point)
            |    |_Kitchen_Humidity (Point)
            |_ShellyTwo (Equipment)
            |   |_Kitchen_WaterLeak_Alarm (Point)
            |   |_Kitchen_WaterLeak_Battery (Point)
...

Generally a Thing is represented as a single Equipment. There are some cases where that won’t be the case but most of the time one Thing will become one Equipment in the semantic model.

The semantic model only exists in Items. There is nothing in a .things file relevant to the semantic model (except in cases where you have fulkl control over the Things and Channels like MQTT and HTTP).

And I still say that unless you have a really compelling need for the semantic model, it’s hardly worth the effort if you are using .items files. When you are using the UI though, you can create the Equipment and all the Point Items for a Given thing in one go using “Add equipment to model” from the Thing’s page in MainUI. With changes comming in OH 5, the binding authors will even have recommended semantic tags to use.

I have noticed that already I am on oh 5.0 snapshot build

Also note that this warning is just that - a warning. Depending on how you’re actually utilizing the semantic model, this may or may not be a problem. I personally have lots of things that violate this, like so:

Group eAirQualitySensor ["Sensor"]
Group eMiniSplit ["HVAC"]
Number:Temperature MyRoom_AmbTemp (eAirQualitySensor, eMiniSplit) ["Measurement", "Temperature"]

In reality, the ambient temperature is provided by my air quality sensor, because the Mini-Split only has a set point, and doesn’t expose a measurement of the current air temperature. But I still want to expose that as the temperature when exposing the mini split as a thermostat to say HomeKit. In reality, if I ask for the points of either eAirQualitySensor or eMiniSplit, they will both give me MyRoom_AmbTemp just fine. But if I ask for the equipment that MyRoom_AmbTemp belongs to (keeping in mind the semantic model is quite clear that a point is expected to only belong to one equipment), I don’t know which equipment it will give back (in practice it will be eAirQualitySensor, but that’s just a consequence of how group names and semantic actions are implemented, and not to be relied upon). It would get even “more” undefined if you were to ask which location the temperature item is in, since the equipments might be in different locations. But if you don’t run into any rules or UI constructs that need to reliably go from point to equipment or location for this item, and you have a good reason for a point to be in multiple equipments, again, it’s just a warning, and can be ignored. For me personally, if I ran into issues, I could resolve it by using a non-semantic-equipment group to define the HomeKit accessory. But it’s quite convenient to use the same group for both-- for now.

Right now I try to understand the semantic model and especially for what it is good…so I need to expose it but why do I need it that’s still unclear for me…

The semantic model provides the following:

  • one way you can organize your Items hierarchically
  • it’s the only way there is enough information for HABot to work
  • it is the only way to populate the Overview Locations, Equipment, and Properties tabs of MainUI (these tabs are automatically built based on the semantic model)
  • there are some rule Actions which can be used to interrogate where an Item fits in the hierarchy (e.g. items.SomeItem.semantics.location will return the Location Group Item SomeItem belongs to in JS).

For a concrete example of the last point, I use these actions to find and use the status Item for an Equipment when the sensors for that Equipment stop reporting new values.

var {alerting} = require('rlk_personal');
var logger = log('Sensor Alert');
var equipment = actions.Semantics.getEquipment(items[alertItem]);
var statusItem = items[equipment.name+'_Status'];

if(isAlerting && statusItem.state != 'OFF') {
  statusItem.postUpdate('OFF');
  alerting.sendAlert('Offline: ' + equipment.label + ' has stopped reporting', logger);
}
else if(!isAlerting && statusItem.state != 'ON') {
  statusItem.postUpdate('ON');
  alerting.sendAlert('Online: ' + equipment.label + ' is back', logger);
}
else {
  console.info('Sensor status update alerting ' + isAlerting + ' initial ' + isInitialAlert + ' equipment ' + equipment.label + ' status ' + statusItem.state);
}

I use the name of the Item to figure out which one is the status Item but I could just as easily use the semantic tags. alertItem and isAlerting comes from Threshold Alert. This rule gets called from Threshold Alert when a sensor doesn’t report for a certain amount of time. I get the parent equipment for that sensor, find the status Item for that equipment and set it to ON or OFF based on the value if isAlerting. Because everything is grouped by equipment because they are in the semantic model, I can easily get at all the other Items that are also a part of this same equipment with just two lines of code. I don’t even need to do any tricks like making sure all the Items are named with the same pattern and using string manipulation to find the related Items.

If none of the points above is relevant to you, you don’t need the semantic model.

I only started now to work on my health checks and I get a lot of these complaining my item “belongs to multiple equipments:

The item belongs to

and these are defined

To me this is a pretty helpful structure as the item (in this case a light) belongs to the Wohnzimmer (living room) and it is also part of the Indirect Lights, which allows me to send ON/OFF to these groups separately. So, would be the solution to remove “Location” (I tried “equipment” first but it reveals the same problem) from the indirect lights?

@Mherwege AFAIK as you implemented it: I am aware that my indirect lights are not a physical location per se (you could imagine them to be a sub group of all lights of the living room, so it is indeed somewhat a physical location but I do not want to model it that way).

I feel that this leads to a broken window effect because it creates more than 20 health entries on my system which will make me overlook the real warnings. Therefore, I wonder if this warning is actually helping us or rather confusing? Maybe filtering types of health checks could be a solution but makes it even more complex…WDYT?

You need to change your „indirekte Lichter“ group to be a non semantic group.

It will therefore not be shown in the semantic model tree, but keeps the functionality.

Ok, by removing “Equipment” or “Location” and setting it to “None”.

Yes, remove the semantig tags for that group completely.

1 Like