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

Only a few channels have tags, and none of them are one the semantic ones: see Repository search results · GitHub

@ghys : Can you explain what tags should be added to a channel representing a temperature for example?
I could then update few bindings to add what is required.

For example:
If the channel measures a temperature, ["Measurement", "Temperature"]
If it’s a setpoint of a thermostat, ["Setpoint", "Temperature"]
If it’s a CO Alarm, ["Alarm", "CO"]
The first tag is the Point class and the second, the related Property.

For Points:
In general alarms should have ["Alarm"], read-only items ["Status"] unless there’s a more appropriate Point class, and items that control something ["Control"].
The difference between ["Measurement"] and ["Status"] is subtle, generally ["Measurement"] is for quantifiable values and ["Status"] for discrete values.

For Properties:
If it’s a volume channel, for instance of a media player or speaker, add ["SoundVolume"].
["CO"], ["CO2"], ["Gas"], ["Smoke"], ["Water"] can often make sense as related properties of Alarm points.
["Light"] is tough, I have used it both with ["Measurement"] (for luminance sensors) and ["Control"] or ["Switch"] for channels of lightbulbs (dimmers or switches).
Similarly, ["Presence"] can be a related property of a ["Status"] point or an ["Alarm"] point - you can have the actual presence status in the status item and set the alarm item only when you’re away. Maybe at some point the UI will present you in the home page all your Alarm switch items that are ON, and offer the ability to acknowledge by setting them back to OFF.

3 Likes

@ysc : I started adding a lot of tags on my items. I am now just amazed by the result when I then go in the tabs Locations, Equipments and Properties.
I see that in the locations tab, properties are not displayed in case you have no equipment attached to your location. This is something already corrected or shall I create an issue ?

Thanks, confirmed. Fixed in https://github.com/openhab/openhab-webui/pull/483 - I believe it can make the release.

@ysc I’m trying to wrap my head around the semantic model and how to adapt my setup to it and I have some questions that I hope you can answer.

Scenario 1

Say I want to have a single dimmer control all lights in a room. This dimmer item has no knowledge of any channels etc, that varies by room and may trigger rules as well.

Can a point have a location but not be related to an Equipment?

Scenario 2

I have written a scene based set of rules that control my lights most of the time. The only user control for this system is selecting the scene.

Is there a Property that lines up with the concept of Selection widgets in the UI?

1 Like

Yes. If you select a location in the model page you’ll have a button to add a Point directly under it, which means you can do it.

For Scenes, you can simply have a Point (no special class) at the root level, or even an item outside the model, remember it’s not mandatory to tag all your items.

Yeah I could have answered that one myself :expressionless: sorry

Right, I was more looking for a means for the UI to have introspection on the possible states for a String item. In digging around I wonder if I’ve stumbled on it: stateDescription?

But of course. I’ve been looking too closely to understand and apply the ontology to my entire system.

Thank you

Yes the state descriptions are normally provided by bindings when your item is linked but in OH3 you can also override it with metadata in the UI, for instance:

image

1 Like

Excellent! Thank you for confirming, this will be perfect. I had not gotten to trying that out because I am stuck on an issue I am having with Item states not displaying.

Does the sequence matter?, and what if I only have a property and not a semantic class?
The property seems bit of a duplicate of the quantitytype, is there a reason why this is separate (or can we not just derive this in case of quanitytypes?)

Can the locations be set with tags as well? what would be the sequence?

So I’m still struggling to get my head around the model thing. :woozy_face:

super basic thoughts … what is it that I’m adding? are that channels, items, groups. How does the model relate to those ‘existing’ OH2 concepts?

Another stupid question, I understand how I can add newly created items / equipment to the model, but how to add existing items to the model? Seems however I try it creates new items, instead of allowing me to add existing items

Basically Groups & Tags, I believe

1 Like

You choose your existing item from Items list then select Edit in the upper right corner and choose the the parent group from Parent Membership list.

1 Like

I think yes, the point category goes first and the point type goes second.

Quantity type is not used by the model. Units of Measurement are ways to assign a unit type to a number, not indicate where an item fits in a model. For example, how can you tell the difference between a temperature setpoint for a thermostat and a thermometer reading? You can’t with just the quantity type.

Locations must be Groups.

A location is just a special a Group. Equipment is usually just a special Group too. Points are just regular old Items. The model is defined by Group membership ( e. g. the Equipment in the Kitchen are members of the Kitchen Group) and metadata and tags are used on the Items and Groups to indicate what they represent in the model.

T add an Item to a location, make it a member of that room’s group. To make it part of an equipment add it to the Equipment group. To make an Item a point, set the semantic tags on the item. All of the can be done from the Item’s page.

1 Like

Thanks, very helpful!
As I’m mostly using text configs I now indeed realized I can control it with the right tags (right sequence) on both the groups and items and they indeed appear.
Will play around it to see how it works, esp as some of my items belong to both a ‘location’ group and equipment group as well. (which was indeed my earlier way to be able to access items from both angles)

EDIT: Broke the sections up a bit. Added some text to describe the drawings and the important parts of the drawings. Added some text to describe how to add existing Items to the model (need screen shots?).

1 Like

Is there the possibility to create a model and the equipment in a certain model with a text file or is the only way to create models and equipment with the UI?
I really loved the feature of creating things and items with the UI in openhab2 and would be very frustrated if this will be gone in the future

Since they are just groups and tags that capability is still there same as openHAB 2.

So when I want to show my existing groups I need a certain tag in my items files to show them in my UI?