If statement

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

If statement

#1 Post by anthropo » 23 Oct 2019, 21:55

Hello,
sorry but it's minutes i can't get a solution. My if always goes to // On allume, trop froid
even when

EVENT: Consignes#Jour=23.00
EVENT: Consignes#Nuit=17.00
EVENT: Consignes#Hysteresis=1.00
EVENT: Consignes#Actuelle=23.00
EVENT: Capteur#Temperature=26.00

Code: Select all

on Capteur#Temperature do 
  if [Capteur#Temperature] > [Consignes#Actuelle]  //+[Consignes#Hysteresis]
    // On éteint, trop chaud
    gpio,12,0
  endif
  if [Capteur#Temperature] < [Consignes#Actuelle]  //-[Consignes#Hysteresis]
    // On allume, trop froid
    gpio,12,1
  endif
endon
Can you help please ?

anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

Re: If statement

#2 Post by anthropo » 23 Oct 2019, 22:56

One detail : i'm using global sync. Capteur#Temperature is on another Unit. Do i have do prefix if ? How ?

Thank you

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

Re: If statement

#3 Post by grovkillen » 24 Oct 2019, 09:01

Just as a test:

Code: Select all

on Capteur#Temperature do 
  if [Capteur#Temperature] > [Consignes#Actuelle]
    // On éteint, trop chaud
    gpio,12,0
 else
    // On allume, trop froid
    gpio,12,1
  endif
endon
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:

anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

Re: If statement

#4 Post by anthropo » 24 Oct 2019, 09:52

I tried at the beginning. But it doesn't work.

In fact it is Capteur#Temperature that is in fault. I read it from another unit, and it gets no value . If for example i do a taskValueSet with Capteur#Temperature, in the log there is a blank behind TaskValueSet 12,1,

I have no idea how to get Capteur#Temperature value from this another unit. But the log shows EVENT: Capteur#Temperature=26.00.
I suppose there is a bug

If on the unit with the temperature sensor i try the if statement with Capteur#Temperature it works.

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

Re: If statement

#5 Post by grovkillen » 24 Oct 2019, 10:21

Do you have the task left free on the receiving unit?
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:

anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

Re: If statement

#6 Post by anthropo » 24 Oct 2019, 10:37

yes. And as i said i see the temperature and it is updated every 30s as i asked. But i cant get the value in rules
Attachments
Sélection_042.png
Sélection_042.png (46.34 KiB) Viewed 9069 times

anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

Re: If statement

#7 Post by anthropo » 24 Oct 2019, 10:40

On the 'emitting' unit :
Attachments
Sélection_043.png
Sélection_043.png (50.13 KiB) Viewed 9066 times

anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

Re: If statement

#8 Post by anthropo » 24 Oct 2019, 10:48

On the emitting unit if i set a rule :

Code: Select all

on Capteur#Temperature do 
  if [Capteur#Temperature] > 23 do 
    // On éteint, trop chaud
    gpio,13,1
  else
    // On allume, trop froid
    gpio,13,0
  endif 
endon
it works, and i see it in the logs.

BUT the same rule on the receiving unit doesn't work. Capteur#Temperature is always empty

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

Re: If statement

#9 Post by grovkillen » 24 Oct 2019, 10:57

You should have it enabled.
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:

anthropo
New user
Posts: 8
Joined: 23 Oct 2019, 21:50

Re: If statement

#10 Post by anthropo » 24 Oct 2019, 14:00

So simple ? i spent hours on this.

THANK YOU

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 35 guests