There is some confusion about what exactly you are asking for because you appear to be mixing up terms. Note that in openHAB the word ‘Item’ has a very precise meaning as it is one of the functional units of the software. In OH an item is a construct that holds some piece of information. It looks like you already have the Item because the sitemap element you have showed refers to an Item named areaControl
. Your site map element sends a command to that item based on which button you have pushed, and it seems likely, based on your description that the areaControl
Item is linked to the channel of interest.
So, if you are really asking about creating an “Item”, then Rich’s advice is the path you want to follow.
If you are asking about creating a UI element for the MainUI that does the same thing as the Sitemap element you already have, then the answer is 1) yes it can be done, 2) there is no directly equivalent solution but there are many different options, and 3) it will take some understanding of the widget syntax and editing system. So, if you haven’t worked with widgets yet then you really should go through the Quick Start Tutorial and related pages:
as well as the more detailed MainUI specific documentation:
This may also help while you are reading those:
The closest MainUI element to the mapped buttons on a sitemap is probably the segmented button which is a container that will hold multiple other buttons. In this, case you would then add one button for each of the commands that you want to send your Item:
- component: f7-segmented
config:
raised: true
slots:
default:
- component: oh-button
config:
text: Regular Quick Arm
action: command
actionCommand: QA
actionItem: areaControl
- component: oh-button
config:
text: Stay Quick Arm
action: command
actionCommand: Qs
actionItem: areaControl
- component: oh-button
config:
text: Disarm
action: command
actionCommand: D111
actionItem: areaControl
That segmented button defined above looks like this:
Another very easy option is a single button that when you click on it presents you with a menu of the different options:
- component: oh-button
config:
text: Menu
action: options
actionItem: areaControl
actionOptions: QA=Regular Quick Arm,QS=Stay Quick Arm,D111=Disarm
This just presents as a button:
But when you click on it, it brings up a list of the options:
The MainUI system is so flexible that there are many other options as well, but these are the two easiest and most direct.