Autor Thema: Timer for Motion sensor  (Gelesen 782 mal)

Offline Nagib

  • Newbie
  • Beiträge: 1
Timer for Motion sensor
« am: 13 Dezember 2021, 16:27:12 »
Hi Everyone

I am recently starting learning about FHEM and I am facing some problems with the timer.
So what I want to do is that, I constructed a scenario when the reed switch is off AND the PIR sensor is  showing noMotion, the HVAC will be off
define s2 notify PIR IF ([Reed] eq "off" && [PIR] eq "off") (set HVAC off)

But, I want to make it in a way that if there is no motion for 30 consecutive seconds the HVAC will be off
How can I do that

Thank you in advance 

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 18729
Antw:Timer for Motion sensor
« Antwort #1 am: 13 Dezember 2021, 16:47:55 »
Hi, first of all: welcome to the FHEM forum.

Sounds like you are looking for some kind of watchdog functionality, so e.g.
define watchdog_PIR watchdog PIR:off 00:00:30 PIR:on { if (ReadingsVal('Reed','state','unknown') eq 'off') {fhem("set HVAC off") } }
attr watchdog_PIR autoRestart 1

Thist might need some tweaking in detail, but it's not that easy to help when just some short lines are provided.

Having a look on the opportunities the so called Event-Monitor offers:

PS.: please format code using code tags (the # symbol above the smilies) in the future :)
Server: HP-T620@Debian 11, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files