Widget that simulate mapping in Sitemap

Hello,

In OH2.5 I used Sitemap to control my smart home. I used mapping to created buttons and scenarios:

Switch item=Roller_Control	label="Blind [%d]"	mappings=["75"="75%", "DOWN"="▼", "STOP"="■", "UP"="▲"]
Switch item=Relay2_Output	label="Wall"		mappings=["OFF"="Off", "ON"="On"]
Switch item=Relay1_Output	label="Fan"		    mappings=["OFF"="Off", "ON"="On"]

OP3

Is it possible to use mapping in the Locations/Equipment cards?

You could use the “Command Options” in the Metadata section of the items (don’t know if it works if you have defind your items via files )

There is an example here on the forum somewhere but I can’t find it at the moment. You’d create an f7 card, add in separate f7 rows and columns and then insert oh-buttons for each button. See [wiki] Building Pages in the OH3 UI: documentation draft (2/3) - #186 by rlkoshak for an example.

Thanks. I created a widget with 4 columns (name, icon, On button and Off button) and used it as ‘Default Standalone Widget’ and ‘Default List Item Widget’.
Any idea why it overlaps the “Close” button?

uid: test2
tags: []
props:
  parameters:
    - description: test
      label: Description
      name: Title
      required: false
      type: TEXT
    - context: item
      description: test
      label: Preset Item
      name: item
      required: true
      type: TEXT
timestamp: Jan 29, 2021, 11:07:04 AM
component: f7-card
slots:
  content:
    - component: f7-row
      config:
        style:
          height: 100%
          width: 100%
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: Label
                  config:
                    text: Wall
          - component: f7-col
            slots:
              default:
                - component: f7-icon
                  config:
                    f7: lightbulb
                    color: black
          - component: f7-col
            slots:
              default:
                - component: oh-button
                  config:
                    title: On
                    action: command
                    actionItem: =(props.item)
                    actionCommand: ON
                    fill: =items[props.item].state=="ON" ? true :false
                    iconColor: blue
                    text: On
          - component: f7-col
            slots:
              default:
                - component: oh-button
                  config:
                    title: Off
                    action: command
                    actionItem: =(props.item)
                    actionCommand: OFF
                    fill: =items[props.item].state=="OFF" ? true :false
                    iconColor: blue
                    text: Off

`

I don’t think you can use a card as a list widget. I don’t know the full list of widgets but I would expect there to be something like an f7-list-item or the like which would need to be your root component.