-
-
Notifications
You must be signed in to change notification settings - Fork 267
Description
The problem
I'm not sure if this is a documentation problem, MainUI problem (i.e. these are not supposed to work for MainUI Widgets), or a combination. I'm starting here because I think there are at least a couple bugs in MainUI.
I created the following custom widget to explore all the different ways we can use properties in widgets (and rule templates). These are not documented anywhere but the assumption is they would work the same as they do for Bindings so I used https://www.openhab.org/docs/developer/addons/config-xml.html#xml-structure-for-configuration-descriptions as a reference.
uid: parameterPlayground
tags: []
props:
parameters:
- context: item
default: not set
description: Only allow selection of Switch and Contact Items
label: Switch or Contact Item
name: switchContact
required: false
type: TEXT
groupName: items
filterCriteria:
- value: Switch,Contact
name: type
- context: item
description: Only show Group Items
label: Group
name: group
required: true
type: TEXT
groupName: items
filterCriteria:
- value: Group
name: type
- context: item
default: not set
description: Select more than one DateTime Item
label: Multiple Items
name: multi
required: false
type: TEXT
multiple: true
groupName: items
filterCriteria:
- value: DateTime
name: type
- context: item
default: not set
description: Select an Item from a list only showing Items with the Switch or
Light tags.
label: An Item with tag
name: withTags
required: false
type: TEXT
groupName: items
filterCriteria:
- value: Switch,Light
name: tag
- context: rule
default: not set
description: Select from Scenes, Scripts, and Rules
label: Script to Call
name: script
required: false
type: TEXT
groupName: rules
- context: tag
default: not set
description: Tag on Items that should be processed by this rule.
label: Tag identifying the Items
name: tag
required: false
type: TEXT
groupName: items
- context: thing
default: not set
description: Select a Thing
label: Thing
name: thing
required: false
type: TEXT
groupName: things
- context: channel
default: not set
description: Select an Event Channel
label: Event Channel
name: channel
required: false
type: TEXT
groupName: things
filterCriteria:
- value: TRIGGER
name: kind
- default: not set
description: Any arbitrary text
label: Arbitrary Text
name: text
required: false
type: TEXT
groupName: input
- default: "7"
description: An integer > 0, defaults to 7
label: Integer
name: integer
required: false
type: INTEGER
min: 0
groupName: input
- default: "8"
description: An integer between 0 and 10 with a step of 2, defaults to 8
label: Bound Integer
name: boundInt
required: false
type: INTEGER
min: 0
max: 10
groupName: input
- default: "12.34"
description: A decimal value
label: Decimal
name: decimal
required: false
type: DECIMAL
groupName: input
- default: "65"
description: A decimal value with units
label: Temperature
name: temp
required: false
type: DECIMAL
groupName: input
unit: °F
- default: ==
description: Select from a list, default is ==
label: List Selection
name: list
required: false
type: TEXT
groupName: input
limitToOptions: true
options:
- label: == equals
value: ==
- label: "!= not equals"
value: "!="
- label: < less than
value: <
- label: <= less than equal
value: <=
- label: "> greater than"
value: ">"
- label: ">= greater than equal"
value: ">="
- default: "true"
description: A binary selection
label: Boolean Option
name: bool
required: false
type: BOOLEAN
groupName: input
- context: network-address
description: IPv4 or IPv6 address
label: Network Address
name: netaddr
required: false
type: TEXT
groupName: input
- context: network-interface
description: Network interface name, e.g. eth0.
label: Network Interface
name: netinter
required: false
type: TEXT
groupName: input
- context: serial-port
description: Path to a serial port
label: Serial Port
name: serial
required: false
type: TEXT
groupName: input
- context: password
default: not set
description: Passwords or other secrets that should not be displayed
label: Password
name: password
required: false
type: TEXT
groupName: input
- context: password-create
description: Field to set a password
label: Set Password
name: setpassword
required: false
type: TEXT
groupName: input
- context: color
description: Choose a color using a color wheel
label: Color Picker
name: color
required: false
type: TEXT
groupName: input
- context: date
default: not set
description: Choose a date using a calendar
label: Date Picker
name: date
required: false
type: TEXT
groupName: input
- context: datetime
default: not set
description: Choose a date and time using pickers
label: Date and Time Picker
name: datetime
required: false
type: TEXT
groupName: input
- context: email
description: Enforces email address formatting
label: Email address
name: email
required: false
type: TEXT
groupName: input
- context: month
default: not set
description: Choose a month of the year
label: Month
name: month
required: false
type: TEXT
groupName: input
- context: week
default: not set
description: Choose a week of the year
label: Week
name: week
required: false
type: TEXT
groupName: input
- context: day
default: not set
description: Choose a day of the week
label: Day of the Week
name: day
required: false
type: TEXT
groupName: input
- context: time
default: not set
description: Select a time, 24 hour format
label: Time
name: time
required: false
type: TEXT
groupName: input
- context: telephone
description: Enter a telephone number
label: Telephone number
name: telephone
required: false
type: TEXT
groupName: input
- context: url
description: Web address
label: URL
name: url
required: false
type: TEXT
groupName: input
- context: service
description: Service name
label: Service
name: service
required: false
type: TEXT
groupName: input
- context: location
description: Map location picker
label: Location
name: location
required: false
type: TEXT
groupName: input
- description: Arbitrary text limited to IP address formatting
label: Regex enforcing IP address formatting
name: regex
required: false
type: TEXT
pattern: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
groupName: input
- default: not set
description: Advanced property, should be hidden until show advanced is checked
label: Avanced property
name: advanced
required: false
type: TEXT
groupName: input
advanced: true
- default: not set
description: Advanced property 1, should be hidden until show advanced is checked
label: Avanced property 1
name: advanced1
required: false
type: TEXT
groupName: advanced
advanced: false
- default: not set
description: Advanced property 2, should be hidden until show advanced is checked
label: Avanced property 2
name: advanced2
required: false
type: TEXT
groupName: advanced
advanced: false
parameterGroups:
- name: items
advanced: false
label: Item selectors
description: Item related selectors, pickers, etc.
- name: rules
advanced: false
label: Rule selectors
description: Scene, Scripts, and Rules selectors, pickers, etc.
- name: things
advanced: false
label: Thing selectors
description: Thing and Channel related selectors, pickers, etc.
- name: input
advanced: false
label: Text input and selectors
description: Input fields, selectors, etc. for text, numbers, locations, etc.
- name: advanced
advanced: true
label: Group for advanced properties
description: The whole group is hidden until show advanced is checked.
timestamp: Nov 12, 2025, 1:14:43 PM
component: oh-list-card
config:
title: Set props to test!
footer: footer
simpleList: true
slots:
default:
- component: oh-label-item
config:
title: "='Switch or Contact Item: ' + props.switchContact"
- component: oh-label-item
config:
title: "='Group: ' + props.group"
- component: oh-label-item
config:
title: "='Multiple Items: ' + props.multi"
- component: oh-label-item
config:
title: "='Script to Call: ' + props.script"
- component: oh-label-item
config:
title: "='Tag identifying Items: ' + props.tag"
- component: oh-label-item
config:
title: "='Thing: ' + props.thing"
- component: oh-label-item
config:
title: "='Event Channel: ' + props.channel"
- component: oh-label-item
config:
title: "='Arbitrary Text: ' + props.text"
- component: oh-label-item
config:
title: "='Integer: ' + props.integer"
- component: oh-label-item
config:
title: "='Bound Integer: ' + props.boundInt"
- component: oh-label-item
config:
title: "='Decimal: ' + props.decimal"
- component: oh-label-item
config:
title: "='Temperature: ' + props.temp"
- component: oh-label-item
config:
title: "='List Selection: ' + props.list"
- component: oh-label-item
config:
title: "='Boolean Option: ' + props.bool"
- component: oh-label-item
config:
title: "='Network Address: ' + props.netaddr"
- component: oh-label-item
config:
title: "='Network Interface: ' + props.netinter"
- component: oh-label-item
config:
title: "='Serial Port: ' + props.serial"
- component: oh-label-item
config:
title: "='Password: ' + props.password"
- component: oh-label-item
config:
title: "='Set Password: ' + props.setpassword"
- component: oh-label-item
config:
title: "='Color Picker: ' + props.color"
- component: oh-label-item
config:
title: "='Date Picker: ' + props.date"
- component: oh-label-item
config:
title: "='Date Time Picker: ' + props.datetime"
- component: oh-label-item
config:
title: "='Email: ' + props.email"
- component: oh-label-item
config:
title: "='Month: ' + props.month"
- component: oh-label-item
config:
title: "='Week: ' + props.week"
- component: oh-label-item
config:
title: "='Day of the Week: ' + props.day"
- component: oh-label-item
config:
title: "='Time: ' + props.time"
- component: oh-label-item
config:
title: "='Telephone: ' + props.telephone"
- component: oh-label-item
config:
title: "='URL: ' + props.url"
- component: oh-label-item
config:
title: "='Service: ' + props.service"
- component: oh-label-item
config:
title: "='Location: ' + props.location"
- component: oh-label-item
config:
title: "='Regex enforcing IP address formatting: ' + props.regex"
- component: oh-label-item
config:
title: "='Advanced Properties: ' + props.advanced"
- component: oh-label-item
config:
title: "='Advanced Properties 1: ' + props.advanced1"
- component: oh-label-item
config:
title: "='Advanced Properties 2: ' + props.advanced2"
You should be able to copy the above for your own testing. It does nothing more than present properties with different contexts and configurations and shows what each gets set to in an oh-list-card.
The issues are below. I'll extract the property(ies) and describe what doesn't work. I tried to list them in the order they appear in the YAML above.
For all properties with a default value, clicking in the text box and hitting the backspace or delete button to remove the letters, once the last letter is removed, the default value is fully restored. You have to either enter your replacement for the default and then delete the default, triple click or triple click on the text to highlight it all and then start typing.
It does work to use the X icon on the right. But the first click restores the default and the second click removes the default and lets you start typing.
- context: item
default: not set
description: Only allow selection of Switch and Contact Items
label: Switch or Contact Item
name: switchContact
required: false
type: TEXT
groupName: items
filterCriteria:
- value: Switch,Contact
name: type
- context: item
description: Only show Group Items
label: Group
name: group
required: true
type: TEXT
groupName: items
filterCriteria:
- value: Group
name: type
- context: item
default: not set
description: Select more than one DateTime Item
label: Multiple Items
name: multi
required: false
type: TEXT
multiple: true
groupName: items
filterCriteria:
- value: DateTime
name: type
The filterCriteria is ignored for Items. All Items are shown. filterCritera does work elsewhere, for example with channels.
I may have opened an issue on this years ago but can't find it.
- context: thing
default: not set
description: Select a Thing
label: Thing
name: thing
required: false
type: TEXT
groupName: thingsThe thing context appears to be completely broken.
- default: "7"
description: An integer > 0, defaults to 7
label: Integer
name: integer
required: false
type: INTEGER
min: 0
groupName: inputIf one types in a negative value it says you must enter a valid number but if you correct it, the error doesn't go away until you click somewhere else on form.
- default: "8"
description: An integer between 0 and 10 with a step of 2, defaults to 8
label: Bound Integer
name: boundInt
required: false
type: INTEGER
min: 0
max: 10
groupName: inputmin and max work but it treats step as if it's not a valid property (i.e. it gets removed on a reload)
- context: network-address
- context: network-interface
- context: serial-port
- context: password-create
- context: color
- context: email
- context: month
- context: week
- context: day
- context: telephone
- context: url
- context: serviceNone of these contexts do anything. They just present a plain text box with no constraints.
- name: advanced
advanced: true
label: Group for advanced properties
description: The whole group is hidden until show advanced is checked.Setting advanced: true on the parameterGroup does not do anything.
Steps to reproduce
Copy the widget code posted above to a Developer Tools -> Custom widgets, save and click "Set Props" and set the properties.
Your environment
runtimeInfo:
version: 5.1.0.M2
buildString: Milestone Build
locale: en-US
systemInfo:
configFolder: /openhab/conf
userdataFolder: /openhab/userdata
logFolder: /openhab/userdata/logs
javaVersion: 21.0.9
javaVendor: Debian
osName: Linux
osVersion: 6.8.0-86-generic
osArchitecture: amd64
availableProcessors: 4
freeMemory: 258431672
totalMemory: 1078984704
uptime: 14832
startLevel: 100
addons:
- automation-jsscripting
- binding-amazonechocontrol
- binding-astro
- binding-chromecast
- binding-ephemeris
- binding-exec
- binding-http
- binding-ipcamera
- binding-mail
- binding-matter
- binding-mqtt
- binding-network
- binding-networkupstools
- binding-openweathermap
- binding-remoteopenhab
- binding-shelly
- binding-vesync
- binding-zigbee
- binding-zwave
- misc-openhabcloud
- persistence-mapdb
- persistence-rrd4j
- transformation-basicprofiles
- transformation-jinja
- transformation-jsonpath
- transformation-map
- transformation-regex
- ui-basic
- ui-habot
- voice-pipertts
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: false
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
pixelRatio: 1.100000023841858
prefersColorScheme: light
isSecureContext: true
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: 1
hardwareConcurrency: 3
language: en-US
languages:
- en-US
onLine: true
platform: Linux x86_64
screen:
width: 2560
height: 1440
colorDepth: 24
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: light
filled: true
pageTransitionAnimation: default
bars: light
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
blocklyRenderer: null
userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/141.0.0.0 Safari/537.36
timestamp: 2025-11-12T20:46:58.676Z