PN532 and Home Assistant
Moderators: grovkillen, Stuntteam, TD-er
PN532 and Home Assistant
Hi,
I have a nodemcu running the Release mega-20181022 stable version along with a PN532. I am able to read the tags. I have also integrated the same into my home assistant.
While setting up automation i found that home assistant does not realize the same tag being read multiple times. In order to avoid the same is there anyway i can use rules to reset the readings of the PN532 after 3 seconds of every read. i.e. once the card is detected, after 3 seconds, the value should be something other than what was read.
Thank you
I have a nodemcu running the Release mega-20181022 stable version along with a PN532. I am able to read the tags. I have also integrated the same into my home assistant.
While setting up automation i found that home assistant does not realize the same tag being read multiple times. In order to avoid the same is there anyway i can use rules to reset the readings of the PN532 after 3 seconds of every read. i.e. once the card is detected, after 3 seconds, the value should be something other than what was read.
Thank you
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: PN532 and Home Assistant
Are the tag numbers integers or is there letters inside them? If they are numbers only (=integers) then you can store them inside the newly added internal variables (1...16) or use traditional dummy devices.
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: PN532 and Home Assistant
tag numbers are all intergers. sorry this is very new to me. can you tell me where can i find the internal variable or traditional dummy devices
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: PN532 and Home Assistant
If you look in the wiki regarding rules you get a good start. After that you can come here and I'll help you out.
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: PN532 and Home Assistant
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: PN532 and Home Assistant
so going through the rules this is what i came up with. the rfid is connected to i2c whichi would be GPIO-4 for SDA and GPIO-5 for SCL
On Rules#Timer=1 do
if[esp004#tag]>0
gpio,4,%value%
else
gpio,4,000000000
endif
timerSet,1,3
endon
is this correct
On Rules#Timer=1 do
if[esp004#tag]>0
gpio,4,%value%
else
gpio,4,000000000
endif
timerSet,1,3
endon
is this correct
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: PN532 and Home Assistant
No you need to create either a dummy device or use the newly added system variables. So either you do it like this:
Old way with dummy devices (I place them on task number 12 in this example, naming them Dummy#CurrentTag and Dummy#ZeroTag), if your esp004#tag device is on task number 1 and value number 1 this would then hopefully work.
New way would be to use this:
I'm typing this out of my head so please get back here if something is not working as you was hoping.
Old way with dummy devices (I place them on task number 12 in this example, naming them Dummy#CurrentTag and Dummy#ZeroTag), if your esp004#tag device is on task number 1 and value number 1 this would then hopefully work.
Code: Select all
'
On System#Boot Do
taskValueSet,12,2,123456789
EndOn
On esp004#tag Do
taskValueSet,12,1,[esp004#tag] //Setting dummy vaue 1 to the tag code
TimerSet,1,3
EndOn
On Rules#Timer=1 Do
If [esp004#tag] = [Dummy#CurrentTag] //If the tag code is still the same after 3 seconds clear it
taskValueSet,1,1,[Dummy#ZeroTag]
EndIf
EndOn
Code: Select all
On System#Boot Do
Let,1,123456789
EndOn
On esp004#tag Do
Let,2,[esp004#tag]
TimerSet,1,3
EndOn
On Rules#Timer=1 Do
If [esp004#tag] = %v2%
taskValueSet,1,1,%v1%
EndIf
EndOn
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: PN532 and Home Assistant
New way would be to use this:
Code: Select all
Let,1,123456789
Can you enlighten us about this new way?
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: PN532 and Home Assistant
It's only a couple of days old. I will add more info about it but in short:
Let,<value number 1...16>,<float>
Example
Let,1,10
Let,2,20
Publish,Answer/%v1%+%v2,(%v1%+%v2%)
This would render in this being published
Topic
Answer/10+20
Message
30
Let,<value number 1...16>,<float>
Example
Let,1,10
Let,2,20
Publish,Answer/%v1%+%v2,(%v1%+%v2%)
This would render in this being published
Topic
Answer/10+20
Message
30
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: PN532 and Home Assistant
Ohhh great
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Who is online
Users browsing this forum: No registered users and 1 guest