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

[Main UI] Provide access to widget properties from widget expressions #1025

Closed
matthijskooijman opened this issue Apr 28, 2021 · 3 comments · Fixed by #1698
Closed

[Main UI] Provide access to widget properties from widget expressions #1025

matthijskooijman opened this issue Apr 28, 2021 · 3 comments · Fixed by #1698
Labels
enhancement New feature or request main ui Main UI

Comments

@matthijskooijman
Copy link

The problem

I have a oh-label-card, which has its item property set to some value. In the label property, I want to create an expression that references the configured item, but it seems I cannot access the current widget's properties (only the global list of items and the props for the page).

Your suggestion

I would suggest making this possible, e.g. by adding a widget predefined variable that resolves to the current widget's properties. This would allow using e.g. widget.item for my case, but also opens up room for a lot of customization by accessing the other properties.

Your environment

runtimeInfo:
  version: 3.0.2
  buildString: Release Build
locale: en-NL
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.11
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.48+21-CA
  osName: Linux
  osVersion: 5.10.17-v7+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 49622120
  totalMemory: 194838528
bindings:
  - chromecast
  - dsmr
  - ipp
  - mqtt
  - spotify
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: true
    macos: false
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    pixelRatio: 1
    prefersColorScheme: dark
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 4
    language: en-US
    languages:
      - en-US
      - en
    onLine: true
    platform: Linux x86_64
  screen:
    width: 1280
    height: 1024
    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 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0
timestamp: 2021-04-28T09:17:06.871Z
@matthijskooijman matthijskooijman added enhancement New feature or request main ui Main UI labels Apr 28, 2021
@florian-h05
Copy link
Contributor

@matthijskooijman Does this problem persist in openHAB 3.4.0?

@matthijskooijman
Copy link
Author

Hm, I haven't upgraded since then, so I'm not sure... I can see if I can upgrade, but not sure if I'll get around to that anytime soon...

florian-h05 added a commit to florian-h05/openhab-webui that referenced this issue Feb 10, 2023
Fixes openhab#1025.

This introduces a new object for component configuration expressions to access the configuration of the component itself.

After this got merged, I can provide the docs update as well.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05
Copy link
Contributor

It is not possible, but it will be soon. I have opened a PR to add this.

ghys pushed a commit that referenced this issue Feb 16, 2023
Fixes #1025.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants