RFID update values when removing tag

Moderators: grovkillen, TD-er, Stuntteam

Post Reply
Message
Author
sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

RFID update values when removing tag

#1 Post by sawo » 26 Mar 2020, 12:33

Hi all,

I would like to apologize in advance if this has already been asked several times before.

My current project is to control a water hose with a RFID token.
Current setup:
- Wemos D1 mini (espeasy)
- RDM6300 RFID
- Relais for magnetic valve
- Homematic (Generic HTTP controller)
- iobroker (rules)

The water should turn on when I place the RFID Tag on reader and should turn off when removing it, but the ESPeasy stores the last RFID ID value . see picture "001.jpg"
even when I remove it.
How can I clear the value when RFID token has been removed?

Thanks
sawo
Attachments
001.JPG
001.JPG (20.63 KiB) Viewed 1856 times

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

Re: RFID update values when removing tag

#2 Post by grovkillen » 26 Mar 2020, 15:32

I would use a timer for it. And clear if after x seconds.
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:

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#3 Post by sawo » 27 Mar 2020, 08:08

hi grovkillen,

thanks for your reply.
Okay I'll give it a try. Never set up a rule in espeasy before :)

thanks
sawo

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#4 Post by sawo » 31 Mar 2020, 12:53

Hi,

so last night I had time to learn about the rules and I have managed to create the rules.

The value will be set to "0" when token is removed.:-)

But now I have the next issue, the rule causes the wemos to reboot after 24 seconds..... and also the load will be by 100%

Could any one check my 2 rules please, to see if I made something wrong?

Rule 1:
On rfid_tag_water#Tag do
timerSet,1,5
endon

On Rules#Timer=1 do
TaskValueSet,1,1,0
SendToHTTP 192.168.1.10,8181,x.exe?Antwort=dom.GetObject("Tag").State(0)
GPIO,4,0
endon


Rule 2: to switch on the relais when token is available
On rfid_tag_water#Tag do
if [rfid_tag_water#Tag]=3364040
GPIO,4,1
endif
endon

thx so far.
sawo
Attachments
log.JPG
log.JPG (64.77 KiB) Viewed 1713 times
info.JPG
info.JPG (36.56 KiB) Viewed 1713 times

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

Re: RFID update values when removing tag

#5 Post by Ath » 31 Mar 2020, 13:03

On what interval is your rfid reader (device in ESPEasy) set? If that interval is too short, like 1 second, then the load will be (close to) 100%, causing intermittent crashes & reboots.

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#6 Post by sawo » 31 Mar 2020, 13:21

Hi,

attached you´ll find a picture of the device settings.
Nothing to change or setup.

Sawo
Attachments
device.JPG
device.JPG (33.5 KiB) Viewed 1708 times

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#7 Post by sawo » 31 Mar 2020, 13:24

When I remove the rules and place the rfid token on the reader, it will reboot after 70 seconds.

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

Re: RFID update values when removing tag

#8 Post by TD-er » 31 Mar 2020, 13:34

I do see an error you could not post the data to the selected controller.
So maybe you're running out of memory while trying.

Can you set the queue depth of the active controller to 1 as a test?

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#9 Post by sawo » 31 Mar 2020, 13:40

Hi TD-er,

I have removed it, now it will reboot after 44 seconds.
Maybe I´ll some thing different.

Once the rfid token is placed on the reader it will turn on the valve until I place the token again on the reader.
In this case I will not send so much data.

Could any one help me with this rule or give me a hint what to do?

SAWO

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#10 Post by sawo » 31 Mar 2020, 17:34

So now it tested my new rules:

on water_on do
gpio,4,1
endon

on water_off do
gpio,4,0
endon

on rfid_tag_water#Tag do
timerSet,1,2
if [water_pump#On]=1
event,water_off
else
event,water_on
endif
endon

On Rules#Timer=1 do
TaskValueSet,1,1,0
endon

but when I hold the token on the reader it always switches the relay twince. see attached log file:

I have now idea why.

sawo
Attachments
log2.JPG
log2.JPG (62.22 KiB) Viewed 1679 times

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

Re: RFID update values when removing tag

#11 Post by grovkillen » 31 Mar 2020, 17:49

Instead of :

TaskValueSet,1,1,0

Try

TaskValueSetAndRun,1,1,0
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:

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#12 Post by sawo » 31 Mar 2020, 18:58

Hi grovkillen,

sorry that makes no difference.
Even when I remove this part of the rule:
On Rules#Timer=1 do
TaskValueSetAndRun,1,1,-3342336
SendToHTTP 192.168.1.10,8181,x.exe?Antwort=dom.GetObject("Tag").State(0)
endon

it still switches twince or even more often.

Sawo
Attachments
video1.gif
video1.gif (2.99 MiB) Viewed 1669 times

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

Re: RFID update values when removing tag

#13 Post by grovkillen » 31 Mar 2020, 19:18

Please give me the full rules set, or is it that one above?
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:

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#14 Post by sawo » 31 Mar 2020, 19:27

here you go.

on water_on do
gpio,4,1
endon

on water_off do
gpio,4,0
endon

on rfid_tag_water#Tag do
timerSet,1,2
if [water_pump#On]=1
event,water_off
else
event,water_on
endif
endon


THX

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

Re: RFID update values when removing tag

#15 Post by grovkillen » 31 Mar 2020, 19:31

I would do it like this (without knowing your setup 100%)

Code: Select all

on rfid_tag_water#Tag=3364040 do
timerSet,1,2
Let,1,[water_pump#On]
gpio,4,[VAR#1#!Z]
endon

On Rules#Timer=1 do
TaskValueSet,1,1,0
endon
EDIT: updated rules.
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:

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

Re: RFID update values when removing tag

#16 Post by grovkillen » 31 Mar 2020, 19:32

You can read up on how to format data: https://espeasy.readthedocs.io/en/lates ... Rules.html

In the section "Formatting refered values"
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:

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

Re: RFID update values when removing tag

#17 Post by grovkillen » 31 Mar 2020, 19:40

Or if you want any tag to trigger the rule:

Code: Select all

on rfid_tag_water#Tag>0 do
timerSet,1,2
Let,1,[water_pump#On]
gpio,4,[VAR#1#!Z]
endon

On Rules#Timer=1 do
TaskValueSet,1,1,0
endon
Your rule would trigger when you have set the tag value = 0 which isn't what you wanted.
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:

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#18 Post by sawo » 31 Mar 2020, 19:50

Hi grovkillen,

thanks a lot for helping me.
One question, what does the [VAR1#!Z] stand for, do I need to create a variable or device?
When I copy your rule nothing happends, what do you need to know from my setup?

thx

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

Re: RFID update values when removing tag

#19 Post by grovkillen » 31 Mar 2020, 20:09

I had an error in my rule which I have corrected.

Let,1,[task#value] <---- this sets the first internal variable (16 maximum) to what ever value your pump have.
[VAR#1] is now the same value as [pump#state] (or whatever you called your task and value).
[VAR#1#Z] is making a transformation of the value, but we want this transformation to be inverted and thus:
[VAR#1#!Z]

You can read about it in the page I linked to.
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:

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#20 Post by sawo » 31 Mar 2020, 23:49

Hi grovkillen,

thanks a lot for explaining.
But the issue still exists, I think that the interval of the RDM6300 is set to high.
When I quickly put the tag on and off it only swichtes once, but if I old it on for about a 1/1,5 second it will switch 2 or more times.
Is there a possibility to pause the reading of the RDM6300, by rule, for a few seconds or increase the interval?

attached is the log from around 1 second, holding the tag on the reader.

thx
sawo
Attachments
log3.JPG
log3.JPG (72.88 KiB) Viewed 1614 times

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

Re: RFID update values when removing tag

#21 Post by grovkillen » 01 Apr 2020, 02:05

That sounds like a design flaw. Please open a issue on GitHub and refer to this thread
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:

sawo
Normal user
Posts: 14
Joined: 26 Mar 2020, 12:20

Re: RFID update values when removing tag

#22 Post by sawo » 01 Apr 2020, 09:19

@grovkillen
thanks a lot for helping, I have created an issue.

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

Re: RFID update values when removing tag

#23 Post by grovkillen » 01 Apr 2020, 09:50

sawo wrote:
01 Apr 2020, 09:19
@grovkillen
thanks a lot for helping, I have created an issue.
Great! And thank you for reporting this issue.
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:

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests