openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
212 stars 232 forks source link

[Main UI] HA config from Zwave-js-ui is displayed with errors on the "Thing" "Code Tab" #2298

Closed apella12 closed 3 months ago

apella12 commented 3 months ago

The problem

I have been testing some HA configs in OH from Zwave-js-ui. They work fine. However, they are displayed on the UI code tab with errors. The impact is that changes (like removing a config from the thing) are not automatic. I had to delete the thing and rescan to pick up the changes. Restarting OH had no effect.

mqtt Channel1 2024-01-31 095551 mqtt Channel2 2024-01-31 095551 Result: HA code tab 2024-01-30 201302

Expected behavior

Would expect that an imported HA configuration would display on the UI code tab without errors. My guess is that the config is split-up to fit a certain field size on the UI code tab and that causes the errors. Maybe that cannot be fixed?

Steps to reproduce

  1. HA configs are produced by Zwave-JS-UI (formerly zwave2mqqt) and is used by HA, so I'm assuming the configs are legit.
  2. Discover via Scan
  3. go to thing and examine the code tab
  4. Note errors. I did find that I could edit the config to eliminate the errors, but deleting and rescanning is easier
  5. The channel performs correctly despite the errors, but changes like removing a config are not possible without deleting the thing and Scan. OH restart had no effect.

Your environment

Note this is a test environment and I am using a snapshot that handles most empty values in HA configs.

runtimeInfo:
  version: 4.2.0
  buildString: "Build #3868"
locale: en-US
systemInfo:
  configFolder: /openhab/conf
  userdataFolder: /openhab/userdata
  logFolder: /openhab/userdata/logs
  javaVersion: 17.0.9
  javaVendor: Debian
  osName: Linux
  osVersion: 5.15.133.1-microsoft-standard-WSL2
  osArchitecture: amd64
  availableProcessors: 4
  freeMemory: 106589928
  totalMemory: 262144000
  uptime: 2122
  startLevel: 70
addons:
  - automation-jsscripting
  - binding-mqtt
  - persistence-rrd4j
  - transformation-jinja
  - transformation-jsonpath
  - transformation-map
  - ui-basic
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: 0.800000011920929
    prefersColorScheme: light
  isSecureContext: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: 8
    hardwareConcurrency: 4
    language: en-US
    languages:
      - 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: light
    filled: true
    pageTransitionAnimation: default
    bars: filled
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0
timestamp: 2024-01-31T15:23:16.832Z

Browser console

The red dot errors are;
1) all collection items must start at the same column
2) Nested mapping are not allowed in compact mappings
3) Implicit keys must be followed by map values
4) Implicit map keys must be on a single line

Browser network traffic

Additional information

I did post on the forum and it was suggested this could also be the way the Mqtt binding imports these configs that leads to the code tab errors. If in your opinion this issue needs to be moved to addons, let me know

FWIW above the Code tab can be edited to clear the errors. (kind of a PITA with dozens of configs) HA code tab fixed 2024-01-30 201302

apella12 commented 3 months ago

After further work, I do not think the state of the code tab is causing the problem. I was able to Add a config to an existing channel, no problem even with the state of the code tab. I'm guessing that when a config is removed it is not fully removed and so have to delete the thing and rescan. Will add issue to addons repository. Sorry for the confusion. It looked like an issue