Subtracting values of variables in rules

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
ulfh2018
Normal user
Posts: 30
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Subtracting values of variables in rules

#1 Post by ulfh2018 » 17 Mar 2019, 11:13

I am trying to subtract to values in a rule, but it looks like I am missing on the syntax. I have set up the following rule:

on BadNede do
TaskValueSet 2,1,%eventvalue%
if [Variables#BadNede]>32
TaskValueSet,2,1,32
endif
TaskValueSet 2,2,[Variables#BadNede - Floor#Bad-Nede]
timerSet,1,5
endon

Everything works as expected, except the line TaskValueSet 2,2,[Variables#BadNede - Floor#Bad-Nede], so there must be a syntax error. Can someone please correct me?

The log from ESPEasy shows the following:

EVENT: BadNede=28.50
310694: ACT : TaskValueSet 2,1,28.50
310705: Command: taskvalueset
310768: ACT : TaskValueSet 2,2,


Best regards

Ulf
Last edited by ulfh2018 on 17 Mar 2019, 11:16, edited 1 time in total.

User avatar
grovkillen
Normal user
Posts: 2824
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Subtracting values of variables in rules

#2 Post by grovkillen » 17 Mar 2019, 11:15

Code: Select all

TaskValueSet 2,2,[Variables#BadNede]-[Floor#Bad-Nede]
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:

ulfh2018
Normal user
Posts: 30
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Subtracting values of variables in rules

#3 Post by ulfh2018 » 17 Mar 2019, 11:22

Thank you for your reply (Have'nt I seen you on another forum - you are Swedish if I'm not totally wrong)

Tried that. Result in the log file is like this:

504587: EVENT: BadNede=29.50
504609: ACT : TaskValueSet 2,1,29.50
504619: Command: taskvalueset
504679: ACT : TaskValueSet 2,2,29.50 - 25.69

User avatar
grovkillen
Normal user
Posts: 2824
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Subtracting values of variables in rules

#4 Post by grovkillen » 17 Mar 2019, 11:41

Then do this:

Code: Select all

TaskValueSet 2,2,([Variables#BadNede]-[Floor#Bad-Nede])
And yep, I'm swedish. Located in Hudiksvall and part of the core team of ESP Easy. If you want, join the FB group "ESP Easy Sweden".
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:

ulfh2018
Normal user
Posts: 30
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Subtracting values of variables in rules

#5 Post by ulfh2018 » 17 Mar 2019, 11:49

I'll be happy to join the group!

Still not working.

Have checked that there is a legal value of Floor#Bad-Nede and Variables#BadNede, but the log file now shows me the following result:
330822: HTTP: event,BadNede=29.00
330864: EVENT: BadNede=29.00
330884: ACT : TaskValueSet 2,1,29.00
330894: Command: taskvalueset
330954: ACT : TaskValueSet 2,2,(29.00-25.69)

It's a hard life :D

ulfh2018
Normal user
Posts: 30
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Subtracting values of variables in rules

#6 Post by ulfh2018 » 17 Mar 2019, 12:01

Sorry, must have had a typo. Now it works!

Thank you SOOOOO much :D :D :D :D :D

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests