Hi,
ok, after 5 months I gave it another try. Started to create my own widget again.
Still I have to say that this is still not straight forward for me.
Way to much Try-And-Error where Error still is the most part of the “development”.
For this widget it took me 3 very long nights …
I’d like to achieve a widget which displays the state of my rolling gate (German: Rolltor).
Futhermore I’d like to control it with 3 buttons (open, stop, close).
At least the last point I could achieve.
Layout (textual):
Row1: centered (perhaps right aligned) image of a rolling gate. I’ve created 10 svg files with open, 10%, 20%, … 100% closed with inkscape
Row2: Current status of gate (opened, opening, stopped, closing, closed)
Row3: centered buttons: open, stop, close
uid: widget_gate_v2
tags: []
props:
parameters:
- description: Optionally a title of the widget. Defaults to none
label: Title of the widget
name: title
required: false
type: TEXT
- description: A text prop
label: Prop 1
name: prop1
required: false
type: TEXT
- context: item
description: An item to open gate
label: Open Gate
name: itemOpenGate
required: true
type: TEXT
- context: item
description: An item to close gate
label: Close Gate
name: itemCloseGate
required: true
type: TEXT
- context: item
description: An item to stop gate
label: Stop Gate
name: itemStopGate
required: true
type: TEXT
- context: item
description: An item to close gate
label: Gate Status
name: itemGateStatus
required: true
type: TEXT
parameterGroups: []
timestamp: May 6, 2021, 4:28:05 PM
component: f7-card
config:
title: '=(props.title) ? props.title : ""'
footer: =props.prop1
slots:
default:
- component: f7-row
slots:
default:
- component: Label
config:
class:
- justify-content-center
icon: oh:rtsvg
- component: f7-row
config:
class:
- justify-content-center
slots:
default:
- component: Label
config:
class:
- text-align-center
text: =(items[props.itemGateStatus].state)
- component: f7-row
config:
class:
- justify-content-center
slots:
default:
- component: oh-link
config:
actionItem: =props.itemOpenGate
actionCommand: ON
action: command
colorTheme: '=(items[props.itemOpenGate].state == "ON") ? "green" : "gray"'
iconF7: lock_open
iconSize: 20
style:
background-color: rgba(246, 158, 81, 0.2)
border-radius: 15px 0px 0px 15px
padding: 10px
- component: oh-link
config:
actionItem: =props.itemStopGate
actionCommand: ON
action: command
colorTheme: '=(items[props.itemStopGate].state == "ON") ? "green" : "gray"'
iconF7: stop
iconSize: 20
style:
background-color: rgba(246, 158, 81, 0.2)
border-radius: 0px 0px 0px 0px
padding: 10px
- component: oh-link
config:
actionItem: =props.itemCloseGate
actionCommand: ON
action: command
colorTheme: '=(items[props.itemCloseGate].state == "ON") ? "green" : "gray"'
iconF7: lock
iconSize: 20
style:
background-color: rgba(246, 158, 81, 0.2)
border-radius: 0px 15px 15px 0px
padding: 10px
Within folder (all files same content) openhabian\openhab-conf\icons\classic\
Rolltor_Closed.svg
rtsvg.svg
rt.png
Still I can not manage to display any of those icons/images.
I’ve created a dummy widget with to test svg and this is working (taken from an example somewhere in here), why ever…
component: oh-label-card
config:
title: Toggle the Magnetic Valve
item: Main_Magnetic_Valve
action: toggle
icon: oh:rtsvg
actionCommand: ON
actionCommandAlt: OFF
label: Magnetic Valve
iconUseState: true
- How can I achieve to display this damned icon?
- Sizing of the image will be the next Try-Error-Annoying part I guess…
Thanks for your support. Honestly many parts of OH3 improved a lot, UI still is hard to achieve if you’re not a pro in webdesign… But I guess my tries are not that far away from very basic standards, so no rocket science.
Best regards
Joerg