FHEM Forum

FHEM => English Corner => Thema gestartet von: franc am 14 April 2015, 04:33:11

Titel: off-in-timer ?
Beitrag von: franc am 14 April 2015, 04:33:11
Hi,

I have a motion sensors in each room that turn the lights for some period of time. When I go in to a room it also sets timers to turn lights in other rooms off (it's not immediate in case I am moving between rooms).

I am wondering if their is a standard way of doing this as my solution is pretty messy

thanks
Titel: Antw:off-in-timer ?
Beitrag von: rudolfkoenig am 15 April 2015, 15:51:14
I have just added the defmod command, which may help.

define mdRoom1Ntfy notify motionDetect.* {
  my $room = AttrVal($NAME, "room", "");
  if(!data{mdRoom} || $data{mdRoom} ne $room) {
    fhem("defmod mdOff at +00:05 set room!=$room:FILTER=comment=mdSwitch:FILTER=STATE!=off off");
  }
  $data{mdRoom} = $room;
}


I assumed that all your motiondetectors are prefixed with motionDetect, that they have the same room attribute, as the corresponding switches, that all of your switches can be switched off with the off command, and that only the devices with the comment attribute containing mdSwitch should be affected.

Note that you have to add ;; and \ if changing the code directly in fhem.cfg

Caveat: you have to stay at least 5 minutes in the same room.
Titel: Antw:off-in-timer ?
Beitrag von: franc am 16 April 2015, 10:31:46
thanks,

I'll read through your approach to understand it

cheers
Titel: Antw:off-in-timer ?
Beitrag von: franc am 22 April 2015, 14:51:01

The defmod command is useful - thanks

However, Rre-reading my original email, I realised that I did not describe situation correctly.

The messy part of what I want to do is that I only want to modify the off timer if it would make the lights turn off sooner. If a light in one room was just about to turn off I don't want a new 'off timer' to come along and give it another 'N' minutes.

cheers