Basic scripting question;
I have this config file;
define sun Twilight 5 6
define frontdoor.mainhall FS20 5362 5a
attr frontdoor.mainhall group doorwindowsensors
attr frontdoor.mainhall model fs20tfk
define lamp.mainhall FS20 aa55 02
attr lamp.mainhall group lights
And I want to use a notify script. I've read some perl syntax, but I'm not sure if I can use the FHEM variables in Pearl. But I have come up with this; (not tested jet)
define maindoorscript notify frontdoor.mainhall:off {
if (sun.light !=6) || (lamp.mainhall.state=off) {
set lamp.mainhall on-for 420
}
#fire notifry (notify me on my phone...)
system("/opt/fhem/scripts/main_door_opening.sh")
}
So I want the hall light to go on for 7 minutes when the front door opens, only when it's not full sunlight...
Maybe there is a better way to achive this?
Thanks for your help!
Hi,
I use ReadingsVal for this:
if ((ReadingsVal("sun","light","") ne "6") || (ReadingsVal("lamp.mainhall","state","") eq "off"))
brgds, Groby
So that sums up as;
define maindoorscript notify frontdoor.mainhall:off {
if ((ReadingsVal("sun","light","") ne "6") || (ReadingsVal("lamp.mainhall","state","") eq "off")) {
fhem("set lamp.mainhall on-for 420")
}
#fire notifry (notify me on my phone...)
system("/opt/fhem/scripts/main_door_opening.sh")
}
I'm gonna try that Groby, vielen dank!
Chrome is the fastest browser, compared to Internet Explorer and Firefox. And yes, it is supported well in FHEM.