openhab / openhab-webui

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

Slider List Item (oh-slider-item) incorrectly rounds displayed value #1503

Open BentHaase opened 1 year ago

BentHaase commented 1 year ago

The problem

The 'Slider List Item' (oh-slider-item) incorrectly rounds the displayed value to the nearest integer value. This behavior started with 'some' Update a few months ago. Before this, the selected value was shown.

See this screenshot of the issue:

image

Code for the specific slider:

value: oh-slider-item
config:
  commandInterval: 2000
  delayStateDisplay: 20000
  icon: oh:heating
  iconUseState: false
  label: true
  max: 30
  min: 4.5
  releaseOnly: true
  scale: true
  scaleSteps: 1
  scaleSubSteps: 10
  step: 0.5
  title: Thermostat Temperatur
  unit: °C

Expected behavior

Like before the value displayed to the right should show the correct fractional value that has been slected via the slider (or any other source).

See this mock up of how it 'once' was and should be:

image

Steps to reproduce

  1. Add Device / Item to model
  2. Set 'Default List Item Widget' to oh-slider-item
  3. Set a step size of 0.5 (check code snipped above)
  4. Select a value of x.5 via slider item and check displayed value to the right with the value that was set

Your environment

runtimeInfo:
  version: 3.4.0.M2
  buildString: Milestone Build
locale: en-DE
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.16
  javaVendor: Debian
  osName: Linux
  osVersion: 5.10.0-15-amd64
  osArchitecture: amd64
  availableProcessors: 4
  freeMemory: 116457568
  totalMemory: 245366784
  startLevel: 100
bindings:
  - astro
  - miio
  - mqtt
  - shelly
  - telegram
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.5789473684210527
    prefersColorScheme: dark
  isSecureContext: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 16
    language: en-US
    languages:
      - en-US
      - en
    onLine: true
    platform: Linux x86_64
  screen:
    width: 2432
    height: 1368
    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; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0
timestamp: 2022-09-27T12:58:01.328Z

Browser console

NONE

Browser network traffic

NONE

Additional information

NONE

ghys commented 1 year ago

Add:

  footer: =JSON.stringify(items.YourItemName)

to your widget to make sure there isn't a unwanted "displayState":

image

mstormi commented 1 year ago

I have the 'inverse' problem with current OH4 (S3515): when I set a value via slider, the item is correctly set. But the slider position graphically resets to the next-lowest integer. Item correctly remains as just set.