How to use f7-card in a item list representation

For my light dimmers it would be ideal to have a list-widget combining a switch with a dimmer. So I took the f7-card widget developed by aaron2

and integrated it in a list widget via textual item config file:

.... { channel="knx:device:bridge:DALI:UG_Fitness_Licht", listWidget="widget:Dimmer"[Item="UG_Fitness_Licht"]}

on the mobile phone this approach works quite nicely, however on the ipad the card does not fully scale to the max width

does anybody has an idea how that could be done.

@rlkoshak: maybe the approach described above could be a way to group your chromecast widgets in one consolidated list-widget (or maybe it is just a too naive and not educated approach)?

With a lot trial&error and even more help from @RGroll and @JustinG I managed to achieve something similar which I’m quite happy with and whicht might be helpful for you:

The code is not perfect since I’m still an OH-beginner, but it might be interesting anyway:

component: oh-list-card
config:
  noChevron: true
  style:
    background: linear-gradient(to bottom,#e6e6e6 0%,#8c8c8c 100%)
slots:
  default:
    - component: f7-list-item
      config:
        accordionItem: true
      slots:
        content:
          - component: f7-row
            config:
              class:
                - align-items-center
              style:
                width: 100%
                height: 25px
                flex-wrap: nowrap
            slots:
              default:
                - component: f7-col
                  config:
                    class:
                      - display-flex
                      - flex-direction-row
                      - align-items-center
                      - margin-top
                      - margin-bottom
                    style:
                      height: 100%
                      width: fit-content
                      min-width: 100px
                  slots:
                    default:
                      - component: oh-button
                        config:
                          icon-f7: lightbulb_fill
                          iconColor: '=(items.AnzahlLampenAn.state === "0") ? "gray" : "yellow"'
                          style:
                            --f7-button-bg-color: transparent
                            --f7-button-hover-bg-color: transparent
                            --f7-button-pressed-bg-color: transparent
                      - component: oh-label-item
                        config:
                          item: AnzahlLampenAn
                - component: f7-col
                  config:
                    class:
                      - display-flex
                      - align-items-center
                      - justify-content-flex-end
                    style:
                      height: 100%
                      width: 100%
                  slots:
                    default:
                      - component: oh-list-item
                        config:
                          title: Alle aus
                          action: command
                          listButton: true
                          actionItem: AlleLichterAus
                          actionCommand: ON
        default:
          - component: f7-accordion-content
            slots:
              default:
                - component: oh-repeater
                  config:
                    sourceType: array
                    for: devices
                    in:
                      - actionitem: LeuchteHuegross_Farbe
                        label: AZ-H
                      - actionitem: LeuchteHueklein_Farbe
                        label: AZ-E
                      - actionitem: LeuchteMobil_Farbe
                        label: SZ-M
                      - actionitem: LeuchteWohnzimmer_Farbe
                        label: WZ
                      - actionitem: EsszimmerTisch_Farbe
                        label: EZ-T
                      - actionitem: EsszimmerWein_Farbe
                        label: EZ-W
                      - actionitem: EsszimmerKlavier_Farbe
                        label: EZ-K
                      - actionitem: Frosch_Farbe
                        label: EZ-F
                  slots:
                    default:
                      - component: f7-list-item
                        slots:
                          content:
                            - component: f7-row
                              config:
                                class:
                                  - align-items-center
                                style:
                                  width: 100%
                                  height: 25px
                                  flex-wrap: nowrap
                              slots:
                                default:
                                  - component: f7-col
                                    config:
                                      class:
                                        - display-flex
                                        - flex-direction-row
                                        - align-items-center
                                        - margin-top
                                        - margin-bottom
                                      style:
                                        height: 100%
                                        width: fit-content
                                        min-width: 100px
                                    slots:
                                      default:
                                        - component: oh-button
                                          config:
                                            action: command
                                            actionItem: =loop.devices.actionitem
                                            actionCommand: '=(items[loop.devices.actionitem].state.split(",")[2] === "0") ?
                                              items[loop.devices.actionitem].state.split(",")[0]+
                                              "," +
                                              items[loop.devices.actionitem].state.split(",")[1]
                                              + ",80" :
                                              items[loop.devices.actionitem].state.split(",")[0]
                                              + "," +
                                              items[loop.devices.actionitem].state.split(",")[1]
                                              + ",0"'
                                            icon-f7: lightbulb_fill
                                            iconColor: '=(items[loop.devices.actionitem].state.split(",")[2] === "0") ?
                                              "gray" : "yellow"'
                                            style:
                                              --f7-button-bg-color: transparent
                                              --f7-button-hover-bg-color: transparent
                                              --f7-button-pressed-bg-color: transparent
                                        - component: oh-button
                                          config:
                                            action: popup
                                            actionModal: widget:Widget_farben
                                            actionModalConfig:
                                              leuchte: =loop.devices.actionitem
                                            text: =loop.devices.label
                                            color: blue
                                            style:
                                              --f7-button-bg-color: transparent
                                              --f7-button-hover-bg-color: transparent
                                              --f7-button-pressed-bg-color: transparent
                                  - component: f7-col
                                    config:
                                      class:
                                        - display-flex
                                        - align-items-center
                                      style:
                                        height: 100%
                                        width: 100%
                                    slots:
                                      default:
                                        - component: oh-colorpicker
                                          config:
                                            sliderLabel: true
                                            sliderValue: true
                                            item: =loop.devices.actionitem
                                            modules:
                                              - brightness-slider

Since I don’t know (yet) how to work with variables in OH I exported some values to node-red, where I counted the switched-on-lights and exported it back to OH. But I guess it’s quite simple to do that in OH directly.

1 Like