I’m doing hard on figuring out how to write customized widgets.
It took me a day to copy/paste together some snipset to get this “my Pool Widget”:
- the card should be the same size of the default label cell next to it.
- the trend item is not shown
yaml code
uid: Pool_Widget_new
tags:
props:
parameters:
- description: Widget title
label: Title
name: Title
required: false
type: TEXT
- context: item
description: Pool Temperatur
label: select Item
name: temp
required: false
type: TEXT
- context: item
description: Diff Temperatur
label: select String item
name: diff
required: false
type: TEXT
- context: item
description: Pool Pumpe
label: select Item
name: pump
required: false
type: TEXT
- context: item
description: Pool Beleuchtung
label: select Item
name: light
required: false
type: TEXT
- context: item
description: Pool Saison
label: select Item
name: season
required: false
type: TEXT
parameterGroups: []
timestamp: Jan 10, 2022, 5:24:29 PM
component: f7-card
config:
outline: false
noBorder: false
padding: true
noShadow: false
style:
--f7-card-margin-horizontal: 5px
--f7-card-content-padding-vertical: 0px
--f7-card-content-padding-horizontal: 16px
--f7-card-border-radius: 15px
--f7-card-box-shadow: 0px 5px 10px rgba(0,0,0,0.15)
--f7-card-header-font-size: 14px
--f7-card-header-font-weight: 600
slots:
content:
- component: oh-label-card
config:
noShadow: true
trendItem: =(props.temp)
action: analyzer
actionAnalyzerItems: =[props.temp]
item: =(props.temp)
title: =(props.Title)
icon: f7:thermometer
actionAnalyzerCoordSystem: time
vertical: false
- component: oh-label-card
config:
noShadow: true
item: =(props.diff)
fontSize: "10"
- component: f7-row
config:
colorTheme: blue
class:
- padding-bottom
slots:
default:
- component: f7-col
slots:
default:
- component: oh-button
config:
title: Pumpe
color-theme: blue
action: command
actionItem: =props.pump
actionCommand: '=(items[props.pump].state == "ON") ? "OFF" : "ON"'
text: Pumpe
round: true
small: true
active: =(items[props.pump].state == "ON")
- component: f7-col
slots:
default:
- component: oh-button
config:
title: Licht
color-theme: yellow
action: command
actionItem: =props.light
actionCommand: '=(items[props.light].state == "ON") ? "OFF" : "ON"'
text: Beleuchtung
round: true
small: true
active: =(items[props.light].state == "ON")
- component: f7-col
slots:
default:
- component: oh-button
config:
title: Saison
color-theme: green
action: command
actionItem: =props.season
actionCommand: '=(items[props.season].state == "ON") ? "OFF" : "ON"'
text: Saison
round: true
small: true
active: =(items[props.season].state == "ON")
I guess I really need to understand the basic logic of components, config, styles, slots etc. but I can’t find a documentation about it… can someone assist pls?