Rules with an analog value

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Dick60
Normal user
Posts: 243
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Rules with an analog value

#1 Post by Dick60 » 06 Aug 2023, 19:06

I have an ESP32 loaded with the latest firmware. Connected an LDR as an Analog device. That wordks fine, give s correct measurement (for me). Now I try to get a switch switching on a particular level, but the switch does not change from 0 to 1. It is al experimental, to learn more about Rules and read the documents related to this item but still I cannot see the problem in this script.

Code: Select all

On ZP_220_verklikker#Analog do
If %eventvalue1%>2000
GPIO,21,1
Endif
Endon

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Rules with an analog value

#2 Post by Ath » 06 Aug 2023, 20:48

You can use the logevent command to show the current value:

Code: Select all

On ZP_220_verklikker#Analog do
  If %eventvalue1%>2000
    GPIO,21,1
  Endif
  LogEvent,"LDR Analog value: %eventvalue1%"
Endon
then look at the (serial) logging what's actually being measured, and if the event is being fired, as for this one to go, the Single event with all values: checkbox should be unchecked ;)
/Ton (PayPal.me)

Dick60
Normal user
Posts: 243
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Rules with an analog value

#3 Post by Dick60 » 06 Aug 2023, 21:29

It was the checkbox for the single event that had to be unchecked. II was already starting to doubt myself; such a simple script and not getting that done yet??? :D Thanks for the help

Post Reply

Who is online

Users browsing this forum: No registered users and 40 guests