Hello,
I am quiet new to openhab and currently try to create a custom widget which uses variables.
Is it possible to initialize custom variables?
In the code below I would like the variables to be initialized as follows: vars.weekDay = “monday” and vars.command = “0”. How can I achive this?
uid: TimerList_PopUp_Add
tags: []
props:
parameters:
- context: item
description: Item that can be used to add a Timer
label: Add Timer
name: add_Timer
required: true
type: TEXT
- context: item
description: String item which holds all configured timers
label: Timer List
name: timerListItem
required: true
type: TEXT
- context: item
description: Item that should get controlled by timer
label: Item controlled by Timer
name: controlledItem
required: true
type: TEXT
parameterGroups: []
timestamp: Apr 10, 2021, 4:39:49 PM
component: f7-card-content
config:
padding: false
class:
- margin-vertical
- display-flex
- flex-direction-column
- flex-justify-content-flex-start
- flex-align-items-center
slots:
default:
- component: oh-list
config:
id: weekday
slots:
default:
- component: oh-list-item
config:
id: weekday
radio: true
title: Montag
action: variable
actionVariable: weekDay
actionVariableValue: monday
defaultChecked: true
checked: = vars.weekDay == "monday"
- component: oh-list-item
config:
id: weekday
radio: true
title: Dienstag
action: variable
actionVariable: weekDay
actionVariableValue: thuesday
checked: = vars.weekDay == "thuesday"
- component: oh-list-item
config:
radio: true
title: Mittwoch
action: variable
actionVariable: weekDay
actionVariableValue: wednesday
checked: = vars.weekDay == "wednesday"
- component: oh-list-item
config:
radio: true
title: Donnerstag
action: variable
actionVariable: weekDay
actionVariableValue: thursday
checked: = vars.weekDay == "thursday"
- component: oh-list-item
config:
radio: true
title: Freitag
action: variable
actionVariable: weekDay
actionVariableValue: friday
checked: = vars.weekDay == "friday"
- component: oh-list-item
config:
radio: true
title: Samstag
action: variable
actionVariable: weekDay
actionVariableValue: saturday
checked: = vars.weekDay == "saturday"
- component: oh-list-item
config:
radio: true
title: Sonntag
action: variable
actionVariable: weekDay
actionVariableValue: sunday
checked: = vars.weekDay == "sunday"
- component: f7-col
slots:
default:
- component: f7-row
slots:
default:
- component: Label
config:
text: Stunde
- component: oh-stepper
config:
large: true
variable: hour
id: hour
raised: true
init: true
value: 0
name: minute
autorepeat: true
autorepeatDynamic: true
min: 0
max: 23
manualInputMode: true
- component: f7-row
slots:
default:
- component: oh-stepper
config:
large: true
variable: minute
id: minute
raised: true
autorepeatDynamic: true
init: true
value: 0
name: minute
autorepeat: true
min: 0
max: 59
manualInputMode: true
- component: oh-slider
config:
min: 0
max: 100
label: true
scale: true
variable: command
unit: "%"
default: =50
- component: oh-label-item
config:
title: "Timer:"
after: = props.timerListItem + "@+" + props.controlledItem + "," + vars.command + "," + vars.weekDay + "," + vars.hour + ":" + vars.minute
- component: oh-button
config:
popupClose: true
round: true
fill: true
large: true
text: ="Speichern"
action: command
actionItem: = props.add_Timer
actionCommand: = props.timerListItem + "@+" + props.controlledItem + "," + vars.command + "," + vars.weekDay + "," + vars.hour + ":" + vars.minute
class:
- margin-horizontal
regards
Jochen