GPIO not change state from rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
gdrak0
New user
Posts: 4
Joined: 14 Mar 2018, 17:18

GPIO not change state from rules

#1 Post by gdrak0 » 14 Mar 2018, 18:12

Hi All
I use nodemcu 8266 and ESPEasy v2.0-20180312.
I've made a thermostat through the rules and everything works normally except for the change in gpio.

Code: Select all

on System#Boot do
// thermostat - default value at boot
 TaskValueSet 2,1,19 
endon
 
on UP#val do 
 // Button - Up setpoint 
 TaskValueSet 2,1,([thermostat#setpoint]+0.5)
 if [thermostat#setpoint]>30
 TaskValueSet 2,1,30
 endif
endon
 
on DOWN#val do 
 // Button  - down setpoint
 TaskValueSet 2,1,([thermostat#setpoint]-0.5)
 if [thermostat#setpoint]<15
 TaskValueSet 2,1,15
 endif
endon

on sensor#Temperature do 
 if [sensor#Temperature]>[thermostat#setpoint]
 GPIO,16,1
 endif
endon
 
on sensor#Temperature do 
 if [sensor#Temperature]<[thermostat#setpoint]
 GPIO,16,0
 endif
endon
The rule runs normally without any problems and I also see all commands running correctly through the console.
The problem is that there are no changes in the gpio,16,1 and gpio,16,0 commands.
I mean the voltage on this pin remains 0 but if I run from the browser this command (http://192.168.6.100/control?cmd=GPIO,16,1) the change is done correctly.
I have tried previous versions and other gpio but again without success.
There is something wrong or something that escapes me ??
Thank you.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: GPIO not change state from rules

#2 Post by grovkillen » 14 Mar 2018, 18:33

You have two sensor#Temperature which makes the rule parser not getting what to do. You need to have a else instead. Please study the wiki.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

gdrak0
New user
Posts: 4
Joined: 14 Mar 2018, 17:18

Re: GPIO not change state from rules

#3 Post by gdrak0 » 14 Mar 2018, 18:55

Some help if you want about it ...

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: GPIO not change state from rules

#4 Post by grovkillen » 14 Mar 2018, 19:32

Have you looked at the wiki?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: GPIO not change state from rules

#5 Post by kimot » 14 Mar 2018, 23:16

instead of:

Code: Select all

on sensor#Temperature do 
 if [sensor#Temperature]>[thermostat#setpoint]
 GPIO,16,1
 endif
endon
 
on sensor#Temperature do 
 if [sensor#Temperature]<[thermostat#setpoint]
 GPIO,16,0
 endif
endon
You can use only one "sensor#Temperature" event, not two
Use:

Code: Select all

on sensor#Temperature do 
 if [sensor#Temperature]>[thermostat#setpoint]
     GPIO,16,1
  else
     GPIO,16,0
 endif
endon
Or use timer and check temperature every minute or 5 minutes for example

gdrak0
New user
Posts: 4
Joined: 14 Mar 2018, 17:18

Re: GPIO not change state from rules

#6 Post by gdrak0 » 15 Mar 2018, 10:58

Bingo !!
It works great.
Thank you for all..

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests