Hi all,
im using openhab 4.2.1 and i have a little problem what i want i want to solve:
i have a knx thing and a channel like this:
- id: Storen_Szene
channelTypeUID: knx:number
label: Storen_Szene
description: ""
configuration:
ga: 17.001:31/2/13
i have also a storen.map intransform-folder like this
key=value
1=eingefahren
2=ausgefahren
then i have assigned an
item from type number.
What i want is to set up that i can select the on this scene 2 options but later more with the textlabel. Also it should not allowed to set other values than the predefined.
But all im trying im not getting this. if im setting the correct numbers then they are sent to knx bus and actions there are done. This works. But i want to get in web-ui or android-app a proper selection of the possible options, not the number itself. Is this possible and someone has an example for me? I searched for but got only descriptions for making it with sitemaps in earlier versions of openhab, but i dont use sitemaps
Minimalistic in Main UI:
component: oh-list-card
config:
simpleList: false
title: Beschattung
slots:
default:
- component: oh-list-item
config:
icon: oh:blinds-0
title: Szene 1
action: command
actionCommand: "0"
actionItem: Virtuelle_Scene2
- component: oh-list-item
config:
icon: oh:blinds-50
title: Szene 2
action: command
actionCommand: "1"
actionItem: Virtuelle_Scene2
- component: oh-list-item
config:
icon: oh:blinds-100
title: Szene 3
action: command
actionCommand: "2"
actionItem: Virtuelle_Scene2
Please be aware that knx Scene number is 0-based
Hi Udo,
thank you. I thaught about it and my opionion was to do something like this but more universal.
Thats why i tried now a widget. I changed an existing a little bit more and it works but i have problems to fill a field. Maybe you or someone has an idea why it is not filling up the title:
title: =items[props.item].label
if im writing there .type then im getting the property of type, but seems not possible to get the itemlabel.
full code:
uid: select_options-1
tags: []
props:
parameters:
- context: item
description: The item to control
label: Item
name: item
required: false
type: TEXT
parameterGroups: []
timestamp: Sep 20, 2024, 11:53:22 AM
component: card
config:
title:
slots:
default:
- component: oh-repeater
config:
sourceType: array
for: selection
in:
- title:
icon: =items[props.item].icon
item: =props.item
label:
fragment: true
slots:
default:
- component: oh-list
config:
id: list
slots:
default:
- component: oh-list-item
config:
title: =items[props.item].label
after: =items[loop.selection.item].displayState
smartSelect: true
icon: f7:lightbulb
iconColor: default
popupOpen: =".selectionPopup_"+loop.selection_idx
- component: f7-popup
config:
class: ="selectionPopup_"+loop.selection_idx
slots:
default:
- component: f7-page
slots:
default:
- component: f7-navbar
config:
title: =loop.selection.title
style:
position: sticky
slots:
left:
- component: oh-link
config:
iconIos: f7:arrow_left
iconMd: material:arrow_back
iconAurora: f7:arrow_left
popup-close: true
- component: f7-list
config:
virtualList: true
slots:
default:
- component: oh-repeater
config:
sourceType: itemStateOptions
itemOptions: =loop.selection.item
for: option
fragment: true
slots:
default:
- component: oh-list-item
config:
title: =loop.option.label
actionFeedback: ='{ "text":"You selected <b>' + loop.option.label +
'</b><br>Sending command <b>'
+ loop.option.value + '</b> to item",
"position":"center","icon":"<i
style=\\"color:green\\"
class=\\"f7-icons\\">checkmark_alt</i>","closeButton":true
}'
noChevron: true
radio: true
checked: "=loop.option.value === items[loop.selection.item].state ? true :
false"
popupClose: true
action: command
actionItem: =loop.selection.item
actionCommand: =loop.option.value