Hi All,
When FHEM starts it seems like all variables are undefined. For example, I have a loungelight defined as follows:
define LOUNGELIGHT TRX_LIGHT LIGHTWAVERF F1028702 lounge
attr LOUNGELIGHT icon FS20.on
attr LOUNGELIGHT room Lighting
define a12 at *06:00 {fhem "set LOUNGELIGHT on" if (Value("myTwilight") < 5)}
define a14 at *{ReadingsVal("myTwilight","sr_indoor","00:00:10")} set LOUNGELIGHT off
and when I first look at it's status, it is reported as ??? until I switch it myself or it is switched by an event. Is it possible to initialise a device to a known state? Also, can the same be done for dummy variables?
Thanks
Homer
Hi Mr. Simpson ;)
I do it this way:
define Func_Start_Init_W watchdog . 00:00:01 SAME { \
\
fhem("set CUNO_LAN raw B00");;\
fhem("set Dum_Radio_con_D off");;\
fhem("set Dum_Kl_Sperr_D off");;\
fhem("set Dum_SM_D Systemstart");;\
}
This code will be executed at every system start. My variables shown here, are all dummies. But you are free to put every code of your coice in this function. Just make sure that this function appears in the CFG below the definitions of the used variables or devices.
Best regards
Frank
FHEM saves the state of all devices in the fhem.state file at shutdown, and it evaluates this file after digesting the fhem.cfg at startup.
If this does not work for you, you can set the values in a notify triggered by the global:INITIALIZED event.
Great. Thanks both for your help. I'll give these suggestions a try.