openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
214 stars 235 forks source link

OpenHab 3 -> Semantic Model: Items shoul appear in every group they are members of #969

Open NCC1701M opened 3 years ago

NCC1701M commented 3 years ago

The problem

I have the following model:

Shutters
├── FirstFloor
│   ├── Bedroom
│   ├── Livingroom
│   └── Kitchen
└── ControlGroups
    └── DownOnSunset
        ├── Bedroom
        └── Livingroom

FirstFloor, ControlGroups and DownOnSunset are groups. As you can see, the shutters Bedroom and Livingroom are in the groups FirstFloor and DownOnSunset but in the model the only are display in one of those groups. In which group can change when you modify one of those groups (e.g. by adding a new member).

Expected behavior

Every item should be displayed in every group they are a member of. Even if this means that the item is more than once in this list.

Steps to reproduce

  1. Create a group
  2. Add a item to the group
  3. Create a different group
  4. Add the same item to the new group

You will see, that the item is only display in one group. But how can you tell, that it is also in the second group? Only by selecting the group in the list, click on the Item on the right side of the screen and take a look at Direct Group Members

Your environment

runtimeInfo:
  version: 3.0.1
  buildString: Release Build
locale: de_DE
systemInfo:
  configFolder: /openhab/conf
  userdataFolder: /openhab/userdata
  logFolder: /openhab/userdata/logs
  javaVersion: 11.0.10
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.45+27-CA
  osName: Linux
  osVersion: 5.10.17-v7l+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 10072952
  totalMemory: 139206656
bindings:
  - astro
  - homematic
  - hue
  - network
  - openweathermap
  - telegram
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1
    prefersColorScheme: dark
  isSecureContext: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: 8
    hardwareConcurrency: 12
    language: de-DE
    languages:
      - de-DE
      - de
      - en-US
      - en
    onLine: true
    platform: Win32
  screen:
    width: 1920
    height: 1080
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/89.0.4389.90 Safari/537.36
timestamp: 2021-03-22T18:06:06.323Z
rkoshak commented 3 years ago

The model is necessarily constrained to only represent the physical organization of your model. Physically, it's impossible for a Point or Equipment to be in more than one location at the same time or to be a part or more than one equipment at the same time. It's physically impossible. If you violate this restriction, it destroys the computers ability to reason about the home automation.

In short, the model is there to give the computer more information that it can use to reason about your home automation (e.g. to allow HABot to interpret the natural language "turn on all the lights in the living room"). If the assumption that the model represents the physical layout of the automation, that becomes impossible.

Given this, your "DownOnSubset" Group doesn't make sense in the model. It's not a Location. It's not an Equipment. It's not a Point. It is a functional grouping. Functional groups are still allowed, of course. But they don't belong in the model.

NCC1701M commented 3 years ago

Well then were do functional groups belong?

Groups a very helpful controlling your smart home.

By using only the physical organization you are losing an really advanced smart home.

rkoshak commented 3 years ago

Create them like any other Item that isn't necessarily a part of the model on the Items settings page. A Group that isn't part of the model is just a Group without a semantic tag.

Again, I never said above that you can't have functional type Groups. They just don't belong in the model. Base on my own setup, only about 60% of all Items and Groups end up in the model. The model is not and never was intended to include everything.

ghys commented 3 years ago

Yes a common misconception is that the Model view will show your groups and their members with fancy icons if they happen to have a Location or Equipment tag. It will actually show you your actual semantic model (1), which comes with some constraints, some of which are problematic, and some others not.

(1) Well if you click the "show non-semantic" checkbox you'll get a mix of both...

rkoshak commented 3 years ago

I'm going to add a second page to the Getting Started Tutorial to talk about Items that are not a part of the model. This misconception is just too common.

NCC1701M commented 3 years ago

Create them like any other Item that isn't necessarily a part of the model on the Items settings page. A Group that isn't part of the model is just a Group without a semantic tag.

The problem is, the items view is a simple confusing list. It is not suitable for a complex configuration. When you open your file explorer you don't have all your files in a simple list you have a structure. This should be used for your items as well.

Does the "semantic model" has any functional effect on how openhab works with the items? I haven't seen anything yet but maybe it exists. If there is no functional effect then items should appear in any Group or Equipment or Location it is assigned to.

As long as it is possible to add an item to more than on of those groups, equipments or locations it should be also displayed in each of those. Or you have to create the restriction that you can only add it to one Group or Equipment or Location.

Yes a common misconception is that the Model view will show your groups and their members with fancy icons if they happen to have a Location or Equipment tag.

Maybe the term "semantic model" is already a misconception. The name doesn't explain anything.

ghys commented 3 years ago

The problem is, the items view is a simple confusing list. It is not suitable for a complex configuration.

That I agree with. When you have more than a couple dozen items, it just becomes a flat list that you only use to search for a particular item you know the name of. Which is the very purpose of keeping it around.

rkoshak commented 3 years ago

Does the "semantic model" has any functional effect on how openhab works with the items? I haven't seen anything yet but maybe it exists. If there is no functional effect then items should appear in any Group or Equipment or Location it is assigned to.

As I mentioned, it's how HABot can understand what you mean when you say something like "turn on the lights in the living room" or "what's the temperature in the kitchen?".

It also pretty much drives the automatically generated parts of the Overview Page. What get's shown on the Locations, Equipment, and Properties tabs is driven by the model.

There are also some Actions that let you query for what type an Item is and determine where it fits in the semantic model (e.g. getLocation) will return the room that a Point is in, even if it's a member of a subequipment which is a member of an equipment which finally is a member of a location. In a rule one can also get all the Switches with the Light tag, for example.

NCC1701M commented 3 years ago

Does the "semantic model" has any functional effect on how openhab works with the items? I haven't seen anything yet but maybe it exists. If there is no functional effect then items should appear in any Group or Equipment or Location it is assigned to.

As I mentioned, it's how HABot can understand what you mean when you say something like "turn on the lights in the living room" or "what's the temperature in the kitchen?".

...

Ok, but then there should be either the restriction that an item could be the member of only one semantic model entry or, despite the fact that it is physically impossible to have one item in several rooms, it should be displayed in every semantic model entry where it is assigned to. Every thing else is simply confusing.

ghys commented 3 years ago

As I mentioned, it's how HABot can understand what you mean when you say something like "turn on the lights in the living room" or "what's the temperature in the kitchen?". It also pretty much drives the automatically generated parts of the Overview Page. What get's shown on the Locations, Equipment, and Properties tabs is driven by the model. There are also some Actions that let you query for what type an Item is and determine where it fits in the semantic model (e.g. getLocation) will return the room that a Point is in, even if it's a member of a subequipment which is a member of an equipment which finally is a member of a location. In a rule one can also get all the Switches with the Light tag, for example.

It's all a big experiment. I'm guilty of being a big part of it. I figured, what if we could entice people to build a semantic model, so that they get a Home Page with automatically-generated stuff, and, at the same time, their semantic model they built to get that would be HABot-compatible so you could ask natural-language stuff and get relevant answers...? As I said, big experiment. If you have Alexa or Siri you can still connect to them with their own syntax and get the same thing, but, you do you.

NCC1701M commented 3 years ago

It don't think, that therefor a semantic model build on the physical organization is necessary. With a logical structure you have more possibilities. Instead of telling HABot: 'Turn on the lights in the living room' then 'Turn on the ceilling light in the kitchen' you could tell HABot simply: 'Turn on the default lights' or in my example it would be: 'Close DownOnSunset Shutters' instead of the two commands 'Close livingroom shutters' and 'Close bedroom shutters'. It would make everything much simpler for the user.

Regarding the

automatically-generated stuff

You can do this as well. Just implement a check box where the user can decide if the item, equiptment or location should be included in the generated home page

rkoshak commented 3 years ago

I think at a minimum this result of this discussion is that it's a feature request, not a bug.

I've made some changes to the Getting Started Tutorial to emphasize that this is how the model works, include the restrictions, and added some instruction for how to manage Items outside of the model. The preview can be found at https://deploy-preview-1522--openhab-docs-preview.netlify.app/docs/tutorial/model.html (note that's been unreviewed, if you find anything wrong, unclear, or lacking please comment on the PR at. https://github.com/openhab/openhab-docs/pull/1522

NCC1701M commented 3 years ago

I think at a minimum this result of this discussion is that it's a feature request, not a bug.

Yeah, I agree that it is a feature request 😊

Shall I close this one and file a new feature request?