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

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?

  • Locations are Groups with one of the Location tags applied.
  • Equipment is usually a Group with one of the Equipment tags. You put an Equipment into a location by making it a member of that Location Group. In rare cases an Equipment might be represented by a single Item.
  • Points are Items with a Point tag and optional Property tag applied. You make a Point part of Equipment by making it a member of the appropriate Equipment Group. In rare cases a Point might be applied to a Location directly instead of an Equipment.

You can see a mostly complete list of all the tags in the picture in the tutorial (some new tags have been added since that drawing was made).

See the Item docs for how to set a tag on an Item. I assume you already know how to create a Group and set Group membership on an Item.

Without the tags the Items are not part of the model (not all Item need to be part of the semantic model). Thus, without the tags there is no way for the UI to know what Items represent and where they are located.

I think the documentation here should also explain how to configure the widget of a group.
As shown in the images their state is “NULL”.

How do I derive a Group State from Member Items?
In OH2 it was: Group:Switch:OR(ON,OFF)

In OH3: Select Group from Items, go to edit and then Select Member base type: Switch
Then select Aggregation Function and select One ON then ON else OFF.

Next, Add Metadata and select Default Standalone Widget. Change the default widget
to Toggle Card and save. Now you can turn on/off all your switches in the group.

The default widgets are covered (will be covered) in the Pages sections of the Getting Started tutorials. The problem is if you try to cover everything all at once it becomes too much. So the deliberate flow of the tutorial is Things -> Items and Model -> Persistence -> Pages -> Rules -> Cloud -> Comprehensive example. I actually moved Persistence to before Pages because I needed Persistence concepts there.

I’ll have to think about Group state. The getting started tutorial isn’t intended to be comprehensive. It can’t cover everything. So we have to pick and choose what and where we put certain things. In this case, adding Groups, setting their type and their aggregation function is a wholly separate topic unto itself.

Thanks for all the work on the documentation. But I still don’t get two aspects:

Can you maybe comment on the practical difference between locations and groups?

Second, how can I group elements of same type?

I opened a discussion here: OH3: Meaning of Locations and Groups

Thanks a lot!

1 Like