Maths in Rules malfunction?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
defender52
Normal user
Posts: 10
Joined: 05 Mar 2018, 23:06

Maths in Rules malfunction?

#1 Post by defender52 » 27 Feb 2019, 05:26

Hello,
Could you please clarify if I'm wrong or is it Rules malfunction?
I'm going to provide hysteresis to the heating system, so trying the next:

if [sniff2#1floortemp]<[targetT#1floor]-0.3 and [sniff#1floor]=1
mcpgpio,11,1
TaskValueSet 3,1,1
endif

sniff2#1floortemp and targetT#1floor are MQTT-import devices.
It seems that "-0.3" is ignored.
Is that normal behavior?

GIT version: mega-20190108

TIA
Alexander
Rgds,
Alexander

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

Re: Maths in Rules malfunction?

#2 Post by grovkillen » 27 Feb 2019, 05:34

This is normal yes, for the if statement you cannot add maths. Use the formula within the task settings. For targetT#1floor you just add %value%-0.3 to the formula line.

The being said, you can use math in rules but not in the if statement.
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:

defender52
Normal user
Posts: 10
Joined: 05 Mar 2018, 23:06

Re: Maths in Rules malfunction?

#3 Post by defender52 » 27 Feb 2019, 05:42

Thanks for reply.
Well, in my case formula won't help since the whole piece of rule is:

if [sniff2#1floortemp]<[targetT#1floor]-0.3 and [sniff#1floor]=1
mcpgpio,11,1
TaskValueSet 3,1,1
endif
if [sniff2#1floortemp]>[targetT#1floor] or [sniff#1floor]=0
mcpgpio,11,0
TaskValueSet 3,1,0
endif

As you can see, the next lines should use "clean" targetT#1floor, so the hysteresis is 0.5 degree.
Is there any other best practice except creating of dedicated dummy device?

TIA
Alexander
Rgds,
Alexander

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

Re: Maths in Rules malfunction?

#4 Post by grovkillen » 27 Feb 2019, 05:50

Code: Select all

Let,1,[targetT#1floor]-0.3

If [sniff2#1floortemp]<[VAR#1] and [sniff#1floor]=1
mcpgpio,11,1
TaskValueSet 3,1,1
EndIf
A not full rule but a concept of how you could do it.
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:

defender52
Normal user
Posts: 10
Joined: 05 Mar 2018, 23:06

Re: Maths in Rules malfunction?

#5 Post by defender52 » 27 Feb 2019, 05:56

Perfect! Thanks a lot.
I haven't heard about this function before.
Please consider adding it to the Wiki: https://www.letscontrolit.com/wiki/inde ... rial_Rules

TIA
Alexander
Rgds,
Alexander

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

Re: Maths in Rules malfunction?

#6 Post by grovkillen » 27 Feb 2019, 06:03

That wiki is in the process of being replaced by "read the docs". It's not fully completed though.

https://espeasy.readthedocs.io/en/latest/
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:

defender52
Normal user
Posts: 10
Joined: 05 Mar 2018, 23:06

Re: Maths in Rules malfunction?

#7 Post by defender52 » 27 Feb 2019, 06:08

Got it thanks.
Rgds,
Alexander
Rgds,
Alexander

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 36 guests