How to create a user-editable value

  • Platform information:
    • openHAB version: 3.0.1
  • Issue of the topic: please be detailed explaining your issue

Looking for advice on how to do the following

  • I have a Basic UI page showing the temp from a temp sensor
  • I have created a login with role:user that can see that page. (Note when that user is logged in - he is NOT an admin)
  • I want to have a persistent number ("TempLimit’) that can be tested in a rule/script (ie. if (Temp > TempLimit) do something)
    • I want TempLimit value to be a run-time variable; Not hardcoded in a script
    • Not sure where to save this TempLimit.
      • my 1st idea is to create a channel (that has no MQTT updates).
      • also note that there is a runtime [vars] array that could be useful …but not sure if these values are persistent - or are reset on openHAB restart.
      • ??? other places?
  • I want the user to be able to edit TempLimit from the Basic UI page
    • How?

Any advice appreciated.

Store the value in an item (which is not linked to any channel), persist it with your desired persistence service and display it using a setpoint.

@opus
Thanks. That helped.

I have added two cells to my BasicUI

  • Slider Cell
    • Nothing displays in the Cell. Is that normal?
      image
    • Click on the cell and get a vertical Slider … but no text (values) shown unless mouse is changing value. No scale shown ether. Normal?
      image
    • Seems to be a bug in the HTML when setting the VERTICAL boolean???
<input name="vertical" type="number" step="0.01" data-validate="true" data-validate-on-blur="true" class="input-with-value">
component: oh-slider-cell
config:
  item: SetPoint
  min: 10
  max: 30
  scale: true
  header: Freezer 1 - Set point
  label: true
  unit: C
  scaleSteps: 5
  scaleSubSteps: 1
  icon: oh:heating
  color: blue
  vertical: 0.63

  • Knob Cell
    • Nothing displays in the Cell. Is that normal?
      image
    • Click on Cell and get a blank popup ???
component: oh-knob-cell
config:
  header: Freezer 1 - Set point
  item: SetPoint
  max: 30
  responsive: true
  icon: oh:heating
  min: 10
  primaryColor: "#cccccc"
  secondaryColor: "#ffffff"
  textColor: "#888888"
slots: null

Not sure if I am fighting bugs or my own ignorance.

Solved problem with Knob

  • responsive: true … does not seem to work. Tried size various size settings

Bug?

Got it all working

The trick was to use Widgets (not cells)

image

Glad you got it working!
A sidenote: BasicUI does show sitempas created by a .sitemap file or created as a sitemap from within MainUI-Pages.
Widgets are displayed via MainUI.