Getting Started with OH3: rewriting the tutorial - 6. Model your home with Items & link Channels

Okay, many thanks. Buy what is the purpose of a location item? What can it “do”?

But it wouldn’t make sense to do that because the way you put Equipment and Points into a location is by adding them as members of the Location Group. And since Locations don’t do anything themselves, an Item as a Location dues nothing for you. Better to leave it out of the model entirely.

It’s could be a place holder in the model I guess. But you’d have to change it to a Group before you could do anything with it.

Yes. If an item is a location, it will be picked up by model.
Bindings such as openweathermap have channels which I think will default to a location item, which will then appear as an outliers in model.

Yes that’s maybe an unfortunate naming decision. An item can be a location in terms of semantics (it represents a certain place) or it could have a location type meaning the type of value it accepts is a longitude/latitude pair. Those are completely different and unrelated concepts despite having the same name…

2 Likes

First things first: great work!
My honest respect to the developers and their effort.

EDIT: sorry for slow typing. Some of my thoughts already seem to have come up during the last hour.

Approaching new ideas I always try to understand what’s been the intention and rely on consistency thereafter. It really helps me, if I find the model and the usage - here the UI - consistent and understandable.

Please let me elaborate on the Semantic Model under these circumstances. Words starting with capitals are identifiers from the UI.

Category
Is it mostly icon or only icon? Wouldn’t it make sense to display a textual and/or graphical icon picker, like it is displayed for Type, Semantic Class and Semantic Property?
What about your own pictures select box?

Changing a Group Item’s type
In the UI it seems one can not change the Group Item Type after creation, opposite to Semantic Class and Semantic property. You have to delete the affected object an re-create it.
If you like to and the object sits at a higher hierarchical level in the model, all sub-object will be moved to the container of the affected object and have to be manually restructured. A loss against textual configuration files, as long as you can’t select, drag and drop multiple objects.

Add Location
If you choose Add Location in the modelling part of the UI, you can choose a Type during creation. There you can choose e.g. Dimmer, which, as other Types as well, seems not to make sense at this point, for they seem to represent Point Items. Or is it, that you mean Group with Dimmers - a construct not yet seen in the textual configuration files?
You can even select Location or Group as the type, which I find irritating. For a Location is naturally of type Location and not of type Dimmer or Player. “Model your home with Items…” states: A Location is a group item…
Also "HABot Walkthrough (2/n): Semantic Tagging & Item Resolving says, that “The ontology defines 4 main types: Location, Property, Point and Equipment, with associated tags for each of them.”
It is (like) a Java class hierarchy and defines sub-classes e.g. for Location, like Indoor, Room, etc.
So it doesn’t makes sense to me, that I can choose a Type which is not a sub-class of Location at all for a Location, especially not select between Location and Group type.

Maybe it’s only in the words. Maybe it’s meant to say “Add (tagged) Group (Location, etc.)”. But then again Dimmer, etc. makes no sense.

Please let me say, that I can follow the possibility to set a Semantic Class and Property on Locations.

Add Equipment / Add Point
For me the same problem. The said is true for Equipment, for Point it is the other way round, for you can choose a Type of Group: “A Point is not a Group but any other type of Item and is usually linked to a Channel”

Point and Property
Now to the hardest part: imagination :wink:
It’s almost impossible to fit everyone, so I agree that Point and Property should be used in a creative manner, that adds to the outcome. For me a simple ON/OFF (for Switch or State) is missing. Yes, you could imagine a Level of 0 or 1. And what about Power and Energy - same physical quantity.

What do you think of my thoughts?

BTW: as mentioned in some posts already adding Equipment directly to Locations doesn’t seem to work, for there will nothing be displayed under Locations, Equipment or Properties.

1 Like

Maybe I’m missing the nuance here, but I certainly have Dimmer Type Groups.

Group:Dimmer:MAX gdHallwayLights

From

OMG - I am so sorry. Looking at my old configuration files and the documentation again…I don’t know how I could have overlooked it.

1 Like

Only the icon. It’s only used in Sitemaps and in administration areas of MainUI. It’s mostly a legacy carry over from OH 2. I think PaperUI first introduced category as the name for the icon. I think there were plans for doing something with that at one point but those plans were abandoned when the maintainers for PaperUI abandoned openHAB.

Category is not involved in the model.

I don’t know if custom icons are supported or not. I think they are though and they would follow the same rules and approach as documented at Items | openHAB

Certain aspects of an Item is fixed. These include the name and the type I think, there may be others. It appears that it works differently with text based items but it really isn’t. You can’t change these on a text base Item either. But it appears that you are doing so because what is actually happening is that when your .items file is unloaded, all of the Items defined in that file are completely destroyed. Then when the .items file is reloaded all of those Items are recreated. The Items are not edited in place. So in the UI, to make those sorts of changes you have to do the same thing. Delete the Item and recreate it.

The model is there for your benefit and has to be flexible enough to support a number of ways to represent your home automation. There could be a use case where someone may want to give a type to a Location Group but I doubt that would be a common use case. Ultimately a Location is just a regular old Group like any other Group and the same generic Group form is presented when creating a Location Group.

You have always had the ability to give a Group a type in .items files since Groups were introduced
way back probably before OH 1.0. Group:Dimmer:MAX defines a Group of type Dimmer presumably containing Dimmers. The state of the Group would be the state of the Item with the maximum value. Furthermore, sending a command to a Group and the command is forwarded to all of it’s members.

That’s an unfortunate case where the same name is used for two different things. First realize that the model was adopted from somewhere else so it’s not so easy to just go and change it because of the conflict. Anyway, the type you see in the Group menu is for a Latitude/Longitude coordinate. There is a Location type Item in OH that has existed long before the model. This has nothing to do with the model’s Location tags. Put another way, the Location type has no semantic meaning for the model.

In general I would expect a Location Group and an Equipment Group to not have any type what-so-ever. Again, the Location type has nothing to do with the semantic model. It’s a type of Item and it’s state is a lat/long coordinate. Everything about the model is built up using Group membership and tags. Nothing else is used in the model beyond that. Setting a Type on a Group may be useful in other parts of openHAB (e.g. rules) but it does not do anything for the model.

An Equipment represents a device. A device may have one or more things it reports and things it can do. Each of those is represented by a separate Item. These Items are the Points. The Equipment is a Group. The Equipment contains all the Point Items as members of the Group.

In rare cases you may have an Equipment with just one Point. In that case you can skip the Equipment Group and just create the single Item and give it the Equipment Tag.

When you create equipment from Thing, the Group Item that represents the Equipment is created along with Items linked to all the Channels you select.

When you create points from Thing, the Group that represents the Equipment is not created. Instead you can select an existing Equipment Group to put the Items into. This is because there are many cases where Points on an equipment come from different Things (e.g. a Network binding online Channel to track the Equipment’s online status).

There are cases where you do want to use a Group as a Point. For example, I might have a Group:Number:Temperature:AVG AverageTemp that aggregates all the temp sensors in the house into an average. I might make AverageTemp a Point type Measurement with a Property type of temperature and make it a member of the House Group.

I use Switch/Power for that. Remember that the tags go in pairs. Switch/Energy might make sense too, but for me I tend to reserve Energy for power usage sensors and will Measurement/Energy for that case. For battery statuses I use Status/Energy. Also, you don’t have to add the property so you could just use Switch and skip the property if that makes more sense to you. But it’s the Switch that tells you that it’s an ON/OFF and its the property that tells you what the Switch is controlling or reporting.

The key is to pick something that makes sense to you and be consistent.

Thanx for your effort to answer my lengthy question in an similar way. From first reading I already got some impression and ideas and will try to experiment.

So maybe the “location” item should be renamed “installation” to be separated from the tag.

Wouldn’t it also be reasonable to call the icon property “icon” instead of “category”?

Just from an outside perspective…

I think even the type can be changed. Just the name (aka ID) is fixed. You just can’t edit some options from the Model page in MainUI but have to go to Items > Edit to do so.

1 Like

hello,

how is it possible to set in my location over equipment from thing a temperature to my radiator?

when i use ["Setpoint", "Temperature"] i only can read the targetsetpoint

thx

A Location is a Group with one of the supported Location tags. An Equipment is a Group or an Item with one of the supported Equipment tags. A Point/Property is an Item with a supported Point tag and optionally a supported Property tag.

To put anything in a Location, you make it a member of that Location.

When creating an Equipment from Thing, you must first click on to select the Location you want the Equipment to be in. That will add the generated Equipment Group into that Location’s Group and all the Point Items will be members of the Equipment Group.

Perhaps I have expressed myself in correctly. I try to control my thermostat under Locations in my room. the problem is that my item for the thermostat is a number. and I can’t control them.

the item

Number sPZB001_schlaf_solltemperature "Soll Temperatur" (SZ_Thermostat) { channel="deconz:thermostat:000000000000:00158d00032f6160010201:heatsetpoint", alexa="ThermostatController.targetSetpoint" [scale="Celsius"] }

To change how an Item is shown in the automatically generated parts of the UI you need to override the default by setting a default widget in the Item’s metadata. In this case you need to tell it to use a setpoint or slider in the default list item widget.

EDIT

now i found the option, i was blind.

THANK YOU !!!

Go to the Items page under Settings -> Items. Click on “Add metadata” Choose “default list widget”. Fill out the form to define the way that Item is represented.

Your screen shot is from the Thing, not the Item. The Semantic Class and Property have nothing to do with this.

1 Like

thank you it works well.

but i had another problem, perhabps you had a idea.

i want to change the label-cell color based on a status of a switch, the values are “ON” or “OFF”.

i tried this

=parseInt(items.dummyawayswitch.state.toString) == OFF? “green” :
parseInt(items.dummyawayswitch.state.toString) == ON? “orange”: “red”

but he always shows “green”.

why do you parseInt ? :slight_smile:

1 Like

what can i else use?