Seite 1 von 1

Widget UI visable - replacment Image

Verfasst: 18. Feb 2023 13:29
von lenschith
Hallo zusammen,
ich bastle gerade wieder an Widgets und möchte gerne ein Bild ersetzen wenn ein Schalter nicht an ist. Aber ich ich finde gerade keinen Ansatz wie ich das lösen kann. Vielleicht kann mir ja jemand einen Denkanstoß geben.

Hintergrund: Wenn der 3D Drucker nicht mehr an ist, sollte statt des Livestreams einfach ein Bild im Widget erscheinen.

Code: Alles auswählen

              - component: oh-image
                        config:
                          url: '=props.urllivestream ? props.urllivestream : "http://openhab3:8080/static/dashboard/icons/3dprinter.svg"'
                          width: 100%
                          height: 100%
                          style:
                            border-bottom-left-radius: 0px
                            border-bottom-right-radius: 7px
                            border-top-left-radius: 0px
                            border-top-right-radius: 7px
                          //visible: =items[props.poweritem].state === 'ON'
Gruß
Lenschi

Re: Widget UI visable - replacment Image

Verfasst: 18. Feb 2023 20:49
von lenschith
Hab jetzt eine Möglichkeit gefunden, es funktioniert weiß aber nicht ob das der schönste/einfachste Weg ist.
Falls noch jemand ne andere - bessere Idee hat bin ich Dankbar.

Code: Alles auswählen

                      - component: oh-image
                        config:
                          url: =props.logo
                          width: 100%
                          height: 100% 
                          visible: =items[props.poweritem].state === 'OFF'
                      - component: oh-image
                        config:
                          url: '=props.urllivestream ? props.urllivestream : props.logo'
                          width: 100%
                          height: 100%
                          action: photos
                          actionPhotoBrowserConfig:
                            lazy: false
                            //theme: dark
                            type: popup
                          actionPhotos: =[props.urllivestream]
                          lazy: false
                          style:
                            border-bottom-left-radius: 20px
                            border-bottom-right-radius: 0px
                            border-top-left-radius: 20px
                            border-top-right-radius: 0px
                          visible: =items[props.poweritem].state === 'ON'