TaskValueSet and Dummy

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
cmoitintin
New user
Posts: 3
Joined: 17 Dec 2022, 22:58

TaskValueSet and Dummy

#1 Post by cmoitintin » 18 Dec 2022, 07:03

Hello

i have something that i don't understand if anyone can help me with this :

i try to read a RFID tag and save in a Dummy

i write a rule like :

Code: Select all

on RFIDlime#tag>0 do
TaskValueSet 2,1,%eventvalue%
endon
My tag is: 80709466
My Dummy is : 80709464


so i try a rule like :

Code: Select all

on RFIDlime#tag>0 do
TaskValueSet 2,1,80709466
endon
again my Dummy is : 80709464 :?:





Try with others values like 80000002 my Dummy is 80000000
with 70000002 my Dummy is 70000000
Always 2 under de correct value.
So i try to correct it with
TaskValueSetand 2,1,%eventvalue%+2
But my eventvalue get + 6 ...

try:
TaskValueSetandRun = same

any explanation ? is it a bug ?
Attachments
319750689_479179580993474_2994696811931965503_n.jpg
319750689_479179580993474_2994696811931965503_n.jpg (229.19 KiB) Viewed 1169 times

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

Re: TaskValueSet and Dummy

#2 Post by Ath » 18 Dec 2022, 10:01

Dummy tasks store their values using the float data-type. This has some limitations in the accuracy when using large numbers, like a rfid tag. The rfid reader uses a different storage method for storing its value.
What is the reason to store the tag in a dummy task?
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8755
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: TaskValueSet and Dummy

#3 Post by TD-er » 18 Dec 2022, 11:40

You can set the dummy task to be of type "long".
This should try to store the values as integer instead of float.

But the most important question here is indeed why you want to store it in a dummy?
If it is for comparison with a next tag, then store it in a variable as those are of type double.

For more in-depth info about this, see: https://en.wikipedia.org/wiki/IEEE_754# ... ge_formats

cmoitintin
New user
Posts: 3
Joined: 17 Dec 2022, 22:58

Re: TaskValueSet and Dummy

#4 Post by cmoitintin » 18 Dec 2022, 14:46

why am I trying to save my tag in a Dummy?
I wanted to be able to access later the last tag detected. I haven't tested other possibilities, I thought this one was possible.



sorry if my question is a little stupid, but how can i try to store the values as integer instead of float ?
is there any " easy " solution ?


if the solution is too complex for me I will try in this case to register my tag by separating it in 2 different dummy on one side the beginning, on the other the end.

TD-er
Core team member
Posts: 8755
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: TaskValueSet and Dummy

#5 Post by TD-er » 18 Dec 2022, 14:52

Why not store it in a variable?

See: https://espeasy.readthedocs.io/en/lates ... -variables

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

Re: TaskValueSet and Dummy

#6 Post by Ath » 18 Dec 2022, 14:57

Internally, the RFID plugin uses the method mentioned by TD-er, to store and display that, actually 64 bit, unsigned long value.
It can be used to compare against a list of known tags (see: https://espeasy.readthedocs.io/en/lates ... orted-list).

Currently there is no way of storing a long value in a dummy task from the rules.
/Ton (PayPal.me)

cmoitintin
New user
Posts: 3
Joined: 17 Dec 2022, 22:58

Re: TaskValueSet and Dummy

#7 Post by cmoitintin » 18 Dec 2022, 15:04

TD-er wrote: 18 Dec 2022, 14:52 Why not store it in a variable?

See: https://espeasy.readthedocs.io/en/lates ... -variables


ok, I did not know the variables, I will actually look on this side, thank you for this information.

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests