Hello,
i’ve put much time into creating custom widgets, being able to have very flexible content and also use oh-repeater to show whats going on in some rooms, dynamically.
Here you see one example where i’ve created a widget for the room “Büro”.
The green badges are ment to show whats going on in this room.
The Problem is (as you see in this gif), that sometimes some badges are not shown.
As i then once go into the “Büro”-specific page (where some other items are shown but you dont see them) and then go back, the missing Badge (“Bildschirm”) is there again.
Nothing changes, i just open a page in the web-gui and go back to the overview.
Same happens if im using the android app.
It seems like it doesnt matter what page i open, when i come back, the missing badges are there again.
The condition showing and hiding the badge is
visible: =items[props.badgeitm.split(";")[loop.int_idx]].state == props.badgecond.split(";")
wich then should be (through oh-repeater) something like
visible: =items["SckOffcPeri_Swt"].state == ON
Here the full code
uid: cLink
tags:
- link
- page
- card
props:
parameters:
- description: Text, to be shown as Link
label: Title
name: title
required: false
type: TEXT
- description: "example: cPowerConsumption"
label: Page
name: link
required: true
type: TEXT
- description: "example: /static/livingroom.jpg"
label: Background-Image
name: backgroundurl
required: false
type: TEXT
- description: "example: Off_office;Focus_office;Cinema_office;Chill_office;Party_office;"
label: Scene List
name: scene
required: false
type: TEXT
- description: "example: Fernseher;SleepTimer;"
label: Badge Text List
name: badgetxt
required: false
type: TEXT
- description: "example: tv;wifi;"
label: Badge Icon List
name: badgeico
required: false
type: TEXT
- description: "example: dSckBedRoomTv_Swt;dSckLvngRoomTv_Swt;"
label: Badge Item List
name: badgeitm
required: false
type: TEXT
- description: "example: ON;ON;"
label: Badge Condition List
name: badgecond
required: false
type: TEXT
- description: "example: green;orange;"
label: Badge Color List
name: badgecol
required: false
type: TEXT
parameterGroups: []
timestamp: Jun 9, 2021, 10:41:21 AM
component: f7-card
config:
style:
padding: 0px
border-radius: 7px
border-width: 1px
border-color: rgba(255,255,255, 0.2)
box-shadow: 0px 0px 8px 4px rgba(255, 255, 255, 0.1)
outline: true
slots:
default:
- component: f7-card-content
config:
style:
height: 100px
padding: 0px
background-image: ='url(' + props.backgroundurl + ')'
background-size: cover
background-postion: center
border-radius: inherit
slots:
default:
- component: oh-button
config:
position: absolute
action: navigate
actionPage: ='page:' + props.link
actionPageTransition: f7-circle
border-radius: inherit
style:
--f7-button-bg-color: rgba(0,0,0,0.3)
--f7-button-hover-bg-color: transparent
--f7-button-pressed-bg-color: white
height: 100%
width: 100%
top: 0px
left: 0px
padding: 0px
border-radius: inherit
slots:
default:
- component: oh-button
config:
style:
height: 100%
width: 100%
background: linear-gradient(20deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.5)5%, rgba(255,255,255,0) 30%,rgba(255,255,255,0) 70%,rgba(255,255,255,0.5) 95%, rgba(255,255,255,0.5) 100%)
- component: Label
config:
text: "=(props.title) ? props.title : props.link"
style:
position: absolute
font-size: 40px
color: rgba(0,0,0,0.7)
bottom: 0px
left: 10px
font-weight: bold
pointer-events: none
no-shadow: false
text-shadow: 0px 0px 15px rgba(255, 255, 255, 1)
- component: oh-button
config:
visible: "=(props.scene != NULL) ? true : false"
action: popup
actionModal: widget:listScenes
actionModalConfig:
scenestr: =props.scene
style:
position: absolute
right: 5px
top: 5px
width: 50px
height: 50px
padding: 0px
--f7-button-hover-bg-color: rgba(255,255,255,0.5)
display: flex
justify-content: center
flex-wrap: wrap
slots:
default:
- component: f7-icon
config:
f7: slider_horizontal_3
color: black
size: 30px
- component: oh-repeater
config:
for: int
sourceType: array
in: =props.badgetxt.split(";")
fragment: true
slots:
default:
- component: f7-badge
config:
visible: =items[props.badgeitm.split(";")[loop.int_idx]].state == props.badgecond.split(";")[loop.int_idx]
textColor: black
color: =props.badgecol.split(";")[loop.int_idx]
slots:
default:
- component: oh-button
config:
visible: =(props.badgeico.split(';')[loop.int_idx] != 'NULL')
iconF7: =props.badgeico.split(";")[loop.int_idx]
iconSize: 13px
color: black
style:
padding: 0px
- component: Label
config:
visible: =props.badgetxt.split(';')[loop.int_idx] != 'NULL'
text: =props.badgetxt.split(";")[loop.int_idx]
Can anyone tell me, if my widget is too complex, if there are some limitations in how many operations can be done or if its a bug?
Thanks