FHEM Forum

FHEM - Entwicklung => FHEM Development => Thema gestartet von: malc_b am 09 Februar 2020, 20:07:42

Titel: Newbie questions
Beitrag von: malc_b am 09 Februar 2020, 20:07:42
Hi,

I'm coding my first module.  I'm using reload module a lot.  I'm not sure I completely understand the process.  It seems like reload reruns X_Initialise  but doesn't rerun X_Define.  Is that correct?

Any module scope variables I assume are lost too, yes?  So all variables need to be attached to the hash?  Or of course locals in the sub, or module constants (variables that don't change that is).  Do I just access these hash variables as normal?  E.g. $hash->{myvar}  or  $hash->{.myvar}.  If so what it the purpose of InternalVal()?

Thanks
Titel: Antw:Newbie questions
Beitrag von: rudolfkoenig am 09 Februar 2020, 20:43:50
ZitatI'm using reload module a lot.  ....  It seems like reload reruns X_Initialise  but doesn't rerun X_Define.  Is that correct?
Yes. Instead of reload consider starting FHEM in a terminal with "attr global logfile -", and restarting it with "CTRL-C,Arrow-UP,RETURN" for the next development cycle.

ZitatIf so what it the purpose of InternalVal()?
Makes life easier for people hating special characters :)
It is meant for end user: if you use $defs{DeviceName}{InternalName}, and mistype DeviceName, then a lot of hard-to-debug things will happen.