Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number channel cannot be linked to Switch Item (with profile) #1478

Closed
ssalonen opened this issue Aug 24, 2022 · 6 comments · Fixed by #2690
Closed

Number channel cannot be linked to Switch Item (with profile) #1478

ssalonen opened this issue Aug 24, 2022 · 6 comments · Fixed by #2690
Assignees
Labels
bug Something isn't working main ui Main UI

Comments

@ssalonen
Copy link
Contributor

ssalonen commented Aug 24, 2022

The problem

When linking a Number channel, it is impossible to select Switch item to link to

I use profile to transform the numbers to ON/OFF type.

As a workaround, it is possible to change item type temporarily to Number, do the channel link, and revert item type back to Switch.

Expected behavior

UI would not filter out items of different type when linking channels. Thanks to profiles, otherwise "incompatible" types should be linkable.

Steps to reproduce

Your environment

runtimeInfo:
  version: 3.3.0
  buildString: Release Build
locale: fi-FI
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.15
  javaVendor: Raspbian
  osName: Linux
  osVersion: 5.15.32-v7l+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 81427080
  totalMemory: 372244480
  startLevel: 100
bindings:
  - fmiweather
  - modbus
  - network
  - shelly
  - systeminfo
  - zwave
clientInfo:
  device:
    ios: true
    android: false
    androidChrome: false
    desktop: false
    iphone: true
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    os: ios
    osVersion: 15.6.1
    webView: true
    webview: true
    standalone: true
    pixelRatio: 3
    prefersColorScheme: dark
  isSecureContext: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 4
    language: en-GB
    languages:
      - en-GB
    onLine: true
    platform: iPhone
  screen:
    width: 390
    height: 844
    colorDepth: 32
  support:
    touch: true
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: true
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X)
    AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
timestamp: 2022-08-24T04:24:27.134Z

Browser console

Browser network traffic

Additional information

@ssalonen ssalonen added bug Something isn't working main ui Main UI labels Aug 24, 2022
@ssalonen
Copy link
Contributor Author

ssalonen commented Aug 24, 2022

@rkoshak thoughts on this one? Does this make from core architecture point of view?

I find the ability to transform channel of type X to item of type Y using profiles is really powerful. It seems to work now (UI config workaround described in the first post) but I am not sure how officially supported it is.

@rkoshak
Copy link

rkoshak commented Aug 24, 2022

I agree with this one. There are a number of new things that recent changes to Profiles have made possible that are not accounted for in MainUI. In particular the ability to change the type of the Item from a Number to a Switch (for example) which, prior to 3.2 (maybe even as recent as 3.3) was not possible.

I think MainUI is simply lagging behind those changes and needs to be updated.

Edit to note that I've been pushing for the ability to change the Item type like this periodically for a very long time (at least as far back as OH 2.0). I've always been annoyed that the Network Status binding followed by the Network binding shows the online/offline state of a network device using a Switch instead of a Contact. I'm super happy that we finally have this ability.

@ssalonen
Copy link
Contributor Author

ssalonen commented Jan 6, 2023

Easy would be to remove the item filter in

<item-picker key="itemLink" title="Item to Link" name="item" :value="selectedItemName" :multiple="false" :items="items" :filterType="getCompatibleItemTypes()"

Is there more user friendly way to handle this?

@ssalonen
Copy link
Contributor Author

ssalonen commented Feb 20, 2023

Would PR be accepted to remove the item filter? I do understand the downsides with this as well.

As I was working on openhab/openhab-addons#14058, I hit this issue once again. In modbus 4.0 I was planning to offer one channel, meant to offer the data as percent (%).

Now due to this UI limitation, it seems I should either

  • make 2 channels: one for dimmer, one for roller shutter?
  • advice UI workaround (first post )

@ssalonen
Copy link
Contributor Author

For now, I am resorting to advicing user to work-around the issue in docs:

Check out README at https://github.com/ssalonen/openhab2-addons/tree/modbus-14058/bundles/org.openhab.binding.modbus (ctrl+f search with "due to MainUI limitation"). Perhaps worst example is the one with Rollershutter Item: https://github.com/ssalonen/openhab2-addons/tree/modbus-14058/bundles/org.openhab.binding.modbus#rollershutter-example

@florian-h05
Copy link
Contributor

I have just created a draft PR to finally address this issue: #2690.
Please have a look and check if my logic there is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants