Rfid pn532

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Rfid pn532

#1 Post by marktn » 21 Jan 2021, 18:47

Hi,

I have update my node mcu v3 to the latest version.
In my log i do see my rifd tags. Only not under devices? Any solution for that?
It worked with the old version.

Code: Select all

[58283: PN532: New Tag: 2898276914 3
58285:  Domoticz: Sensortype: 20 idx: 4746 values: 2898276914
58583: PN532: Old Tag: 2898276914 4
58883: PN532: Old Tag: 2898276914 5
59183: PN532: Old Tag: 2898276914 6
59483: PN532: Old Tag: 2898276914 7
59784: PN532: Old Tag: 2898276914 8
60284: RFID : Removed Tag
60286:  Domoticz: Sensortype: 20 idx: 4746 values: 0
62180: WD   : Uptime 1 ConnectFailures 0 FreeMem 20448 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
/code]

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

Re: Rfid pn532

#2 Post by TD-er » 21 Jan 2021, 21:59

Does it show if you refresh the devices page?

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#3 Post by marktn » 21 Jan 2021, 22:10

TD-er wrote: 21 Jan 2021, 21:59 Does it show if you refresh the devices page?
No, the value stays 0.
Reboot, refresh, and add the pn532 new without result.
And in the log it works, i see the rifd tags.

It also sends 0 to domoticz.

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

Re: Rfid pn532

#4 Post by TD-er » 21 Jan 2021, 22:28

How do you send it to Domoticz? Via a connected controller, or via rules?

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#5 Post by marktn » 21 Jan 2021, 22:30

TD-er wrote: 21 Jan 2021, 22:28 How do you send it to Domoticz? Via a connected controller, or via rules?
With the controller, same setting as the old version esp easy. (ESPEasy_v2.0.0-dev12_normal_4096.bin old version number)
I have also a switch, that works fine. Value goes to 1, and communication with domoticz works.

Normaly the value is changing in the number of the rfid. But stays 0

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

Re: Rfid pn532

#6 Post by Ath » 22 Jan 2021, 08:51

It looks like the tag is reset (to 0) after 500 msec, meaning you're not able to refresh the Devices screen fast enough to actually read the tag's value :?

See the log:

Code: Select all

59784: PN532: Old Tag: 2898276914 8
60284: RFID : Removed Tag
There is a recently merged PR #3449 for the Wiegand RFID reader that now has extra settings to control the reset tag behavior. These could also be applied to this plugin, if desired.

A possible issue with both of these plugins (and maybe with some other plugins) is that the scanned tag id is split into 2 variables for storage, because of inaccuracy with higher values of the float type that is used there, and only the 1st value (lowest part) is displayed. (Sending to Controllers is handled correctly, AFAICS)
I'm trying to think of ways how to correctly display the combined values there. But then I'd also want to be able to format other types of data correctly, like # seconds of today (%syssec_d% and friends) converted into HH:MM:SS display. Hmm, something is g(r/l)owing here (in my mind) :D
/Ton

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

Re: Rfid pn532

#7 Post by TD-er » 22 Jan 2021, 10:39

Ath wrote: 22 Jan 2021, 08:51 [...] like # seconds of today (%syssec_d% and friends) converted into HH:MM:SS display.
We already have those.

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

Re: Rfid pn532

#8 Post by Ath » 22 Jan 2021, 11:43

TD-er wrote: 22 Jan 2021, 10:39
Ath wrote: 22 Jan 2021, 08:51 [...] like # seconds of today (%syssec_d% and friends) converted into HH:MM:SS display.
We already have those.
But not in the Devices page (for Dummy Devices), AFAICS...
/Ton

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

Re: Rfid pn532

#9 Post by TD-er » 22 Jan 2021, 12:14

System variable should be usable anywhere.
For example in display plugins, controller publish path etc.

Or do you mean a new output type?
If you're thinking about those, please take a quick step back and have a look at the Domoticz controllers to realize what a potential mess it may become when adding new output types.
That's something we should discuss first or else a lot of Domoticz users will be very unhappy.

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#10 Post by marktn » 22 Jan 2021, 12:24

So acutualy it is working, but not the way i want :D Good news is there is a good support :D

What is the best solution for me?
It looks like this?
There is a recently merged PR #3449 for the Wiegand RFID reader that now has extra settings to control the reset tag behavior. These could also be applied to this plugin, if desired.
I need the RIFD number in domoticz for a event.


This is no problem?
62180: WD : Uptime 1 ConnectFailures 0 FreeMem 20448 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
/code]

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

Re: Rfid pn532

#11 Post by TD-er » 22 Jan 2021, 12:26

It will also send an event which you can use in the rules to act on it.

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

Re: Rfid pn532

#12 Post by TD-er » 22 Jan 2021, 12:28

marktn wrote: 22 Jan 2021, 12:24
This is no problem?
62180: WD : Uptime 1 ConnectFailures 0 FreeMem 20448 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
[/code]
That's a log entry appearing every minute, and looking good. (unless it was an unintentional reboot, given the uptime of 1 minute)

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#13 Post by marktn » 22 Jan 2021, 12:52

TD-er wrote: 22 Jan 2021, 12:26 It will also send an event which you can use in the rules to act on it.
Okay. Should i do anything? Or will there be an udpate of the espeasy?

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

Re: Rfid pn532

#14 Post by Ath » 22 Jan 2021, 13:28

The event should be generated like taskname#valuename, for example if your Task is named 'RFID' and the (single) value 'Tag', the event RFID#Tag is generated, and can be used in the rules like this:

Code: Select all

on RFID#Tag do // the tag will be the first argument provided, %eventvalue1%
  // Send to an external system or whatever
  SendToHTTP,website.server.com,80,"/lastseen_tag.php?tag=%eventvalue1%"
endon
/Ton

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

Re: Rfid pn532

#15 Post by Ath » 22 Jan 2021, 13:31

TD-er wrote: 22 Jan 2021, 12:14 Or do you mean a new output type?
If you're thinking about those, please take a quick step back and have a look at the Domoticz controllers to realize what a potential mess it may become when adding new output types.
That's something we should discuss first or else a lot of Domoticz users will be very unhappy.
I'll start a new thread, later today ;)
/Ton

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#16 Post by marktn » 22 Jan 2021, 14:04

Ath wrote: 22 Jan 2021, 13:28 The event should be generated like taskname#valuename, for example if your Task is named 'RFID' and the (single) value 'Tag', the event RFID#Tag is generated, and can be used in the rules like this:

Code: Select all

on RFID#Tag do // the tag will be the first argument provided, %eventvalue1%
  // Send to an external system or whatever
  SendToHTTP,website.server.com,80,"/lastseen_tag.php?tag=%eventvalue1%"
endon
I will do that, and wait for the new thread.
It's new for me, i will use this example.

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

Re: Rfid pn532

#17 Post by Ath » 22 Jan 2021, 20:32

Ath wrote: 22 Jan 2021, 13:31 I'll start a new thread, later today ;)
I've opened the discussion here
/Ton

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#18 Post by marktn » 22 Jan 2021, 21:23

I have done some testing.
When i read the RFID it sends the tag to domoticz, but it also send immediately a 0. (visible in the log of the text sensor)
I made a blocky, but that isn't fast enough to read the Rifd code.

Under rules i have made this rule, on RFID#Tag do SendToHTTP,192.168.1.5,8080,"/lastseen_tag.php?tag=%eventvalue1%"
endon

Is there a way te prevent 0, or with a delay. Domoticzs needs some time to read.
Maybe i am doing something completely wrong.... rules under esp is new for me. :shock:

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

Re: Rfid pn532

#19 Post by Ath » 22 Jan 2021, 21:32

marktn wrote: 22 Jan 2021, 21:23 Is there a way te prevent 0, or with a delay. Domoticzs needs some time to read.
I'll try to add the extra settings I did for P008 also to P017, so you'll be able to configure it more flexible.
/Ton

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#20 Post by marktn » 22 Jan 2021, 21:51

Ath wrote: 22 Jan 2021, 21:32
marktn wrote: 22 Jan 2021, 21:23 Is there a way te prevent 0, or with a delay. Domoticzs needs some time to read.
I'll try to add the extra settings I did for P008 also to P017, so you'll be able to configure it more flexible.
Thanks! Can you give a notification here when it's done.

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

Re: Rfid pn532

#21 Post by Ath » 22 Jan 2021, 22:15

The PR is here

A few things to do, most notably documentation, that's currently unavailable, but it'll describe the settings only, I guess.

Looking at my test unit:
Screenshot - 22_01_2021 , 22_13_19.png
Screenshot - 22_01_2021 , 22_13_19.png (9.94 KiB) Viewed 1331 times
If desired I can provide a test build, what build type are you using? (name of the current bin file)?
/Ton

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#22 Post by marktn » 22 Jan 2021, 22:45

Ath wrote: 22 Jan 2021, 22:15 The PR is here

A few things to do, most notably documentation, that's currently unavailable, but it'll describe the settings only, I guess.

Looking at my test unit:

Screenshot - 22_01_2021 , 22_13_19.png

If desired I can provide a test build, what build type are you using? (name of the current bin file)?
version, ESP_Easy_mega_20210114_normal_ESP8266_4M1M

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

Re: Rfid pn532

#23 Post by Ath » 23 Jan 2021, 10:42

Test build attached, please report your findings here.
Attachments
ESP_Easy_mega_20210123_normal_ESP8266_4M1M.zip
(580.12 KiB) Downloaded 11 times
/Ton

marktn
Normal user
Posts: 19
Joined: 06 Nov 2015, 19:43

Re: Rfid pn532

#24 Post by marktn » 23 Jan 2021, 17:20

Ath wrote: 23 Jan 2021, 10:42 Test build attached, please report your findings here.
It works!! I have disabled Automatic Tag removal, and it works again. :D :D
I will do some testing with tag removal time.

Thanks for support!

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

Re: Rfid pn532

#25 Post by Ath » 23 Jan 2021, 17:37

marktn wrote: 23 Jan 2021, 17:20 I will do some testing with tag removal time.
Valid range is 250 to 60000 msec, so from 0.25 to 60 seconds.
marktn wrote: 23 Jan 2021, 17:20 Thanks for support!
You're welcome :)
/Ton

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 12 guests