OH5 semantic model conflicts

Hello,
I’m using and need a general group that contains objects of the same type from multiple locations (for display or controls). It has been working for a long time without errors with previous OH3/4, but now I upgraded to OH5 and encountered some semantic errors.

Note: I use Equipment to hide the “Properties” sections in the location card/tab.

I tried everything, but I couldn’t find a solution.

Here’s a simple representation in a new environment.

- Office1 → Windows1
- Office2 → Windows2
- General → Windows (Windows1+Windows2)

Model:

Model (one “Windows” item):

User interface:


General


Office1 and Office2


Page code:

config:
  label: Home Page
locations:
  - component: oh-locations-tab
    config: {}
    slots:
      General:
        - component: oh-location-card
          config:
            backgroundColor: blue
      Office1:
        - component: oh-location-card
          config:
            backgroundColor: yellow
      Office2:
        - component: oh-location-card
          config:
            backgroundColor: red
equipment:
  - component: oh-equipment-tab
    config: {}
    slots: {}
properties:
  - component: oh-properties-tab
    config: {}
    slots: {}

Item definition:

version: 1
items:
  General:
    type: Group
    label: General
    tags:
      - Location
  gWindows:
    type: Group
    group:
      type: Switch
      function: Or
      parameters:
        - "ON"
        - "OFF"
    label: Windows
    icon: window
    groups:
      - General
    tags:
      - Equipment
  Office1:
    type: Group
    label: Office1
    icon: office
    tags:
      - Location
  Office2:
    type: Group
    label: Office2
    icon: office
    tags:
      - Location
  Window1:
    type: Contact
    label: Window 1
    icon: window
    groups:
      - Office1
      - gWindows
    tags:
      - Window
  Window2:
    type: Contact
    label: Window 2
    icon: window
    groups:
      - Office2
      - gWindows
    tags:
      - Window

All is working correctly but now I have this errors:

Thanks

Your arrangement simply goes against the philosophy of the model. You can ignore the conflict warnings, but there’s a high probability of unpredictable results in the long run.

The model is intended to represent the true physical layout of your space. Locations mean actual physical locations and equipment should represent actual physical things. In that way, you cannot have the same physical thing located in two physical locations. So, the model tells you there is an error in your configuration.

The problem is not that you have all the windows in another group, this is a very common arrangement. The problem is that this “all windows” group isn’t really a part of the semantic model because “general” cannot really be a location and “all windows” is not a single physical thing.

If it is absolutely required that you have some UI access to that all windows group, there are some work-arounds/hacks that can get you access through the model pages, but the simplest and best solution is simply to remove the semantic tagging from your all windows group and use a basic widget to add access to that group on your overview page instead of trying to see it on the model pages.

2 Likes

Hi, thanks so much for taking the time to look into my case and for the clear suggestions. I’ll follow your advice and use custom widgets.
I really appreciate it! :folded_hands: