Notify on temperature lower than 3°C

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Beliar_666
New user
Posts: 8
Joined: 11 Apr 2019, 00:08

Notify on temperature lower than 3°C

#1 Post by Beliar_666 » 22 Jan 2021, 16:40

Hello,
i have following Problem, i want to use a temperaturesensor and a buzzer to inform me if the temperature goes below 3°C. I tried with following rule:

Code: Select all

on Aussen#temperature<3.00 do
 notify 1
endon


Now the Buzzer beeps continuosly if the temperature is below 3°C till temp raises over 3°C. But i just want it to beep once. If i use = instead of < in the rule, it only beeps if temperature is 3°C.

Is there any way to do it like i want?

TD-er
Core team member
Posts: 8728
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notify on temperature lower than 3°C

#2 Post by TD-er » 22 Jan 2021, 16:49

You can do several things here.

The most obvious one is to only set a flag once and inspect it when you receive a temp update event.
But I can imagine it would be useful to set a loop timer (and reset it when the temperature is above some threshold) in which you play a sound or send a notify.

N.B. I suggest to not match the value in the event on...do section, but rather use %eventvalue1% in the handling of the event.

Code: Select all

On System#Boot do
  Let,1,0  // Make sure variable 1 is set to 0 at boot
endon

on Aussen#temperature do
  if %eventvalue1% < 3
    if [int#1] = 0
      Let,1,1
      notify 1
    endif
  else
    Let,1,0
  endif
endon
Not tested, but I guess you get the idea.

Beliar_666
New user
Posts: 8
Joined: 11 Apr 2019, 00:08

Re: Notify on temperature lower than 3°C

#3 Post by Beliar_666 » 22 Jan 2021, 17:03

Wow. Many thanks, that works.

TD-er
Core team member
Posts: 8728
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notify on temperature lower than 3°C

#4 Post by TD-er » 22 Jan 2021, 17:14

Nice! :)

ciscomike
Normal user
Posts: 28
Joined: 20 Jan 2021, 10:07

Re: Notify on temperature lower than 3°C

#5 Post by ciscomike » 17 Mar 2021, 01:31

That was really helpful, thanks a lot.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests