Pushbutton in Basic Ui

I have some items that do not have a state, they can only be triggered. I need something like buttons in the Basic UI. How can i get this? My current (ugly) workarround is to use switches and turn them directly off again automatically.

Use the mappings property on a Switch element in the sitemap. https://www.openhab.org/docs/configuration/sitemaps.html#mappings


So I would only map the ON value?

If that’s the command you care about. Every time the button is pressed the Item will receive an ON command. If you need it to go back to OFF you’ll need to use a Rule or the Expire binding to switch it back off after a given amount of time.

1 Like

I have something very similar:

Switch item=sBedroomMainLight label="Bedroom main light []" icon="light" mappings=[ON="PUSH"]


1 Like

Is it also possible to do this in the item file directly? I am showing all items belonging to a group, so i cant edit every switch manually in sitemap

No. If you want any customization to how the Items appear on the sitemap beyond the label you cannot use Groups on the sitemap. You have to put each element on the sitemap individually.

1 Like

so then I also cant have the items appearing on another page?

Yes, you can have them appearing on another page, but you have to write them out separately. Here is an example:

Text item=sRGB1 label="RGB1" icon="light"{
	Switch item=sRGB1 label="RGB1 switch" icon="light"
	Slider item=dRGB1 label="RGB1 dimmer [%d %%]" icon="slider" sendFrequency=500
	Colorpicker item=cRGB1 label="RGB1 colour"

Main page:



Thank you! Now I really understand how sitemaps work!