ESP easy rules temperature

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Sven
New user
Posts: 2
Joined: 26 Jan 2024, 13:48

ESP easy rules temperature

#1 Post by Sven » 26 Jan 2024, 13:55

Dear all,

I have a problem and for some reason, I am not able to solve it.

I am trying to switch a gpio on wenn a certain temperature is exceeded and and off in case the temperature drops below a certain value, as per example below:

on DHT22#Temperature do
if [DHT22#Temperature] > 25
gpio,13,1
endif
if [DHT22#Temperature] < 24
gpio,13,0
endif
endon

I have connected a led to d7 (gpio13) but the led dosent turn on (led is not defect)

Any hints for me please?

Many thanks in advance
Attachments
espeasy2.png
espeasy2.png (51.06 KiB) Viewed 1126 times
espeasy_1.png
espeasy_1.png (103.45 KiB) Viewed 1126 times
easpeasy3.png
easpeasy3.png (118.23 KiB) Viewed 1126 times

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

Re: ESP easy rules temperature

#2 Post by TD-er » 26 Jan 2024, 14:07

You can simplify the rules like this:

Code: Select all

on DHT22#Temperature do
  if %eventvalue1% > 25
    gpio,13,1
  else
    gpio,13,0
  endif
endon
To check if the LED is working, you can give some command on the tools page in the command input field.

Code: Select all

gpio,13,0
Or set it to 1 if the LED is off when the pin is set to 0.

You can also add some logentry command in this rules block to see via the logs whether the event is even being dealt with.

Code: Select all

on DHT22#Temperature do
  if %eventvalue1% > 25
    gpio,13,1
  else
    gpio,13,0
  endif
  logentry,"DHT22#Temperature: %eventvalue1%"
endon

bidrohini
Normal user
Posts: 105
Joined: 03 Nov 2022, 16:24

Re: ESP easy rules temperature

#3 Post by bidrohini » 26 Jan 2024, 14:10

Confirm that your DHT22 sensor is providing accurate temperature readings. You can cross-check with another microcontroller.
You can check this project too. ESP Room SmartMonitor V3. It is based on EspEasy.
https://www.pcbway.com/project/sharepro ... e5a39.html

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

Re: ESP easy rules temperature

#4 Post by TD-er » 26 Jan 2024, 14:13

One other thing...
Do you have the checkbox "Single event with all values:" checked in the task settings of the DHT22?
If so, then your rules should be changed to act on "DHT22#All"

Sven
New user
Posts: 2
Joined: 26 Jan 2024, 13:48

Re: ESP easy rules temperature

#5 Post by Sven » 26 Jan 2024, 14:27

ahhh thank you so much guys :-D, the problem was the "Single event with all values:"

many thanks for the hint!

Now it is working

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests