Skip to content

YamlSlotButton

olialb edited this page Jun 20, 2026 · 2 revisions

ohItem slot type button

The button type shows the state of an openHAB item as text. You can toggle between the different states of the item in case its a switch (ON/OFF), an option list is defined as attribute or in the referenced openHAB item.

Additional slot attributes for slot type button:

Slot attribute default value optional / Mandetory Description
radioButtonState button toggles between all availbale states O Defines a fixed state which is set in the openHAB item when the button is pressed (Can be used for implementaion of radio button functionality)

Example in cardEntities:

    ...
    slots:
      - class: ohItem
        type: button              #lovelace ui field type
        text: Receiver            #shown as text
        item: String_Yamaha_Input #openHAB String Item
        icon: remote-tv
        iconColor: red
        options: TUNER=Radio,PHONO=Plattenspieler,AV2=vu2+

In cardEntities: image

Example in cardGrid with state as text:

    ...
    slots:
      - class: ohItem
        type: button              #lovelace ui field type
        text: =itemState          #Text shows the item state
        item: String_Yamaha_Input #openHAB String Item
        icon: \ueec4 #remote
        iconColor: red
        options: TUNER=Radio,PHONO=Plattenspieler,AV2=vu2+

In cardGrid: image

You can also build a radio button functionality with the button slot type. You can use the same item in an array of button slots and set different fixed state values with the radioButtonState attribute in each of this slots.

Radio button example (4 values over 4 slots):

      - class: ohItem
        type: button
        item: H_Schlafzimmer_SysMode
        radioButtonState: "Off"
        iconColor: default=green,Off=red
      - class: ohItem
        type: button
        item: H_Schlafzimmer_SysMode
        radioButtonState: "Heat"
        iconColor: default=grey,Heat=red
      - class: ohItem
        type: button
        item: H_Schlafzimmer_SysMode
        radioButtonState: "Cool"
        iconColor: default=grey,Cool=blue
      - class: ohItem
        type: button
        item: H_Schlafzimmer_SysMode
        radioButtonState: "Auto"
        iconColor: default=grey,Auto=white

image

Clone this wiki locally