Ich habe folgendes DOIF, das u.a. ein time-Wert hat, das einen Anschaltzeitpunkt für eine Lichterkette aufnehmen soll. Beim Definieren dieses Wertes ist mir aufgefallen, dass die GUI als default wenn noch kein Wert gesetzt wurde, wohl einfach den
STATE des Devices annimmt.
list
Internals:
.eventMapCmd on:noArg off:noArg
CFGFN
DEF (
[$SELF:control] eq q(on)
and [[$SELF:morning_time,"06:00"]]
and [general.seasons.state:state] =~ qr(winter|christmas)
)
(
set out.lights.ambience.fairy.flower_box.kitchen.all on-till 10:00,
setreading $SELF last_executed {( TimeNow() )},
)
FUUID 61a52aa6-f33f-a67d-24db-cea7851728438a16
MODEL FHEM
NAME out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning
NOTIFYDEV out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning,global,general.seasons.state
NR 20580
NTFY_ORDER 50-out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning
STATE off
([out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning:last_executed])
TYPE DOIF
VERSION 24905 2021-09-01 18:35:54
.attraggr:
.attrminint:
Helper:
DBLOG:
cmd:
general.system.log.db:
TIME 1638268860.88295
VALUE 0
control:
general.system.log.db:
TIME 1638233835.84823
VALUE off
READINGS:
2021-11-30 11:41:00 cmd 0
2021-11-30 01:57:15 control off
2021-11-30 11:41:00 mode enabled
2021-11-30 11:41:00 state initialized
2021-11-30 11:41:00 timer_01_c01 01.12.2021 06:00:00
Regex:
accu:
collect:
cond:
general.seasons.state:
0:
state ^general.seasons.state$:^state:
out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning:
0:
control ^out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning$:^control:
itimer:
out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning:
itimer:
morning_time ^out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning$:^morning_time:
attr:
wait:
0:
random(5)
condition:
0 ::ReadingValDoIf($hash,'out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning','control') eq q(on) and ::DOIF_time_once($hash,0,$wday) and ::ReadingValDoIf($hash,'general.seasons.state','state') =~ qr(winter|christmas)
days:
do:
0:
0 set out.lights.ambience.fairy.flower_box.kitchen.all on-till 10:00, setreading out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning last_executed {( TimeNow() )},
1:
helper:
DEVFILTER ^global$|^out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning$|^general.seasons.state$
NOTIFYDEV global|out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning|general.seasons.state
globalinit 1
last_timer 1
sleeptimer -1
intervalfunc:
localtime:
0 1638334800
readings:
all out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning:control general.seasons.state:state
realtime:
0 06:00:00
time:
0 [out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning:morning_time,"06:00"]
timeCond:
0 0
timer:
0 0
timers:
0 0
triggertime:
1638334800:
localtime 1638334800
hash:
uiState:
uiTable:
Attributes:
alias Lichterketten am Morgen anschalten
cmdIcon off:mdt-close-circle-outline@black on:mdt-checkbox-marked-circle@black
devStateIcon off:mdt-close-circle-outline@42BC0A:on on:mdt-checkbox-marked-circle@E50005:off
do always
eventMap /control on:on/control off:off/
group Lichterketten am Küchenfenster
icon mdt-head-cog-outline@black
readingList control morning_time
room Außen->Beleuchtung->Ambiente
setList control:on,off morning_time:time
sortby 3000-actions-1000
stateFormat [$name:control]
([$name:last_executed])
wait random(5)
webCmd on:off:morning_time
Es handelt sich um Reading
morning_time, das aktuell noch nicht gesetzt wird. In der GUI wird das Feld so vorausgefüllt:
https://abload.de/img/screenshot-doif-gui-bwcjy0.pngIm Langtext:
off([out.lights.ambience.fairy.flower_box.kitchen.all.actions.on_for_the_morning:last_executed])Das ist der Inhalt von
STATE.