Dummy device value (with formula or not)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
xzsdre
New user
Posts: 8
Joined: 25 Apr 2021, 22:56

Dummy device value (with formula or not)

#1 Post by xzsdre » 08 Sep 2021, 10:55

Hello everybody. Please tell me who knows. I want to create a dummy device that would show the value from a sensor with an additional calculation according to the formula. However, even without a formula, for example, I create an entry in the rules, and I don't get any value .... What am I doing wrong?

https://prnt.sc/1rk4c16
https://prnt.sc/1rk4ffh

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Dummy device value (with formula or not)

#2 Post by Micha_he » 08 Sep 2021, 11:55

In a rule you need an event like this:

Code: Select all

on Water_level#Distance do
  TaskValueSet,9,1,[Water_level#Distance]
endon

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Dummy device value (with formula or not)

#3 Post by Ath » 08 Sep 2021, 11:57

Please post messages as attachments in the forum so they are readable, also after a couple of weeks when the external service has cleaned them ;)
Please post Rules etc. as Code in the forum, so we can properly read it.

Now my answer:

Your code isn't a complete rule yet. It needs to have defined on what event it should be executed, and the variable must be referenced correctly:

Code: Select all

on Water_Level#distance do
  TaskValueSet,Water_Volume,volume1,[Water_Level#distance] // calculate the volume from the distance here
endon
/Ton (PayPal.me)

xzsdre
New user
Posts: 8
Joined: 25 Apr 2021, 22:56

Re: Dummy device value (with formula or not)

#4 Post by xzsdre » 08 Sep 2021, 14:03

Micha_he wrote: 08 Sep 2021, 11:55 In a rule you need an event like this:

Code: Select all

on Water_level#Distance do
  TaskValueSet,9,1,[Water_level#Distance]
endon
Thanks!
Ath wrote: 08 Sep 2021, 11:57 Please post messages as attachments in the forum so they are readable, also after a couple of weeks when the external service has cleaned them ;)
Please post Rules etc. as Code in the forum, so we can properly read it.

Now my answer:

Your code isn't a complete rule yet. It needs to have defined on what event it should be executed, and the variable must be referenced correctly:

Code: Select all

on Water_Level#distance do
  TaskValueSet,Water_Volume,volume1,[Water_Level#distance] // calculate the volume from the distance here
endon
Please excuse me. I wanted to attach images right here, but didn't figure out how to do it ... :-(. And further, I don't quite understand how to write the formula correctly. For example, I need the volume1 value to be considered as ([Water_level # Distance] - 30) * 10.
How to write it down correctly?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Dummy device value (with formula or not)

#5 Post by Ath » 08 Sep 2021, 15:17

That could be something like:

Code: Select all

on Water_Level#distance do
  TaskValueSet,Water_Volume,volume1,([Water_Level#distance]-30)*10 // calculate the volume from the distance here
endon
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Dummy device value (with formula or not)

#6 Post by Ath » 08 Sep 2021, 15:27

Ath wrote: 08 Sep 2021, 15:17 That could be something like:

Code: Select all

on Water_Level#distance do
  TaskValueSet,Water_Volume,volume1,([Water_Level#distance]-30)*10 // calculate the volume from the distance here
endon
If that doesn't work as expected, adding an extra indirection would help:

Code: Select all

on Water_Level#distance do
  let,30,([Water_Level#distance]-30)*10 // calculate the volume from the distance here
  TaskValueSet,Water_Volume,volume1,[var#30] // Could also use %v30% here
endon
/Ton (PayPal.me)

xzsdre
New user
Posts: 8
Joined: 25 Apr 2021, 22:56

Re: Dummy device value (with formula or not)

#7 Post by xzsdre » 08 Sep 2021, 15:30

Ath wrote: 08 Sep 2021, 15:17 That could be something like:

Code: Select all

on Water_Level#distance do
  TaskValueSet,Water_Volume,volume1,([Water_Level#distance]-30)*10 // calculate the volume from the distance here
endon
It seems to have worked! Thank you very much for your help!

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Dummy device value (with formula or not)

#8 Post by Ath » 08 Sep 2021, 15:33

Great, you're welcome, thanks for the feedback. :)
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 29 guests