Hi created some NFC tags in HA wrote on the tag using the Ha android app.
All works except very long delay.
When I scan tag it says on my Samsung S20 Ultra processing tag and takes up to 10 seconds to activate.
If I go to the created automation in HA and press execute it executes instantly.
Seen about phone putting ha app to sleep so removed anything to do with in battery optimizations.
But at same time shouldn’t be the problem since I tried 4 times back and forth between app execute command and scan tag one after the other and results are the same.
Also scanned tag while in HA app.
What can be causing the ± 10 second delay only when scanning?
BTW this is on all tags I have
The phone read the tag fast then it show something like “sending the tag” a long moment then 10 sec later the command associate with the tag is executed. It seem to be the communication between the phone and ha that is slow.
Executing same command directly from the phone (toggle a switch) is fast.
I have a similar issue with widgets. When I tap on a widget it takes about 10 seconds until the action is executed. I figured out, it has something to do with internal and external URL. When I switch of wifi (so external URL is used) the action is executed immediately. You have to notice, that in my setup the external URL is not reachable from my wifi, due to router configuration. So I think the issue is, that the external URL is used by default with a timeout of 10 seconds, and only after that the internal URL is used. Maybe it is the same with NFC Tags. The widget should use the internal URL at first when on wifi. With this behavior the widgets are pretty much useless for me
if you do not have location permissions granted, location is turned off or GPS is turned off then the app is unable to get the SSID and therefore is unable to try the internal URL first
Thanks for the hint. Do I need to add a separate permission for the widgets? And if so, where can I do it? The app itself works good and fast, therefore I assume the app uses the internal address. Also the wifi sensor of the app in HA shows me the right SSID, so I’m pretty sure the app recognizes the wifi.
same as tobi-bo the app iself works fine if I execute the command. Problem is only when I scan with phone.
if I use the phone and go to the nfc tag created in HA and press execute it is instant.
I also have all permissions granted
If you guys are seeing a delay in scanning the tag then that could just be your HA system responding slow. I am unable to reproduce this issue, so unless you guys can get logs and show that there is some error its probably something to do with your device or HA networking setup.
I have the exact same results here. Curiously, it does take exactly 10s of “Processing tag” before anything happens, but only on my home WiFi. If I switch to mobile data, and therefore, using my external address (as I’m in the same boat as tobi-bo, with no internal access while using the external address), it takes a consistent 3s instead.
I have permissions granted to my app, as well as my internal/external addresses and home SSIDs setup (5G and 2G, just in case my phone hops networks unexpectedly).
Did a test last night and same thing only happens on wifi. If going through external address took about 3 seconds.
Not sure where to look any more. I checked permissions and all granted
weird is if I press execute the tag on the app from my phone and connected wifi also takes only 3 seconds or less.
So if a connection issue why when I tag it takes that much time but executing the tag doesn’t.
If it helps narrow it down to see if it our phones, I have a Samsung ultra S20 and was on android 10 and now 11 with Ui3.0 and same thing with both operating systems.
What are your phones others are having same problem? any Iphones? other than samsung’s
Honestly it sounds like an internal networking issue causing the delay, you can pull up the logcat logs to see if there is some exception happening but all the app does after scanning the tag is send the data back home.
execution happens after HA receives the call…the issue is how long it takes for the call to hit HA.
I also noticed that actionable notifications which rely on events are similarly slow to execute on WiFi. Ones that open a URI aren’t, but it seems HA doesn’t even receive the event until the 10s delay is over.
you should work on solving your internal network issue I wish I had more to give you but my own setup is different my router supports NAT loopback and all my commands execute quickly. Others have even mentioned upon switching to nabu casa the delay went away which also suggests its an internal networking issue.
What thing would we need to be looking for in our networks? It seems entirely odd to me that for some reason, an internal IP address responds slower that a looped back one… but only for this. I posit that the Home Assistant event bus is actually doing something wrong, as I can only replicate this particular issue with events. No other device or function in my instance reacts this slowly to any other stimulus, inside or out of my home network.
Also, I am using Nabu Casa for its Google Home integration, but found that remote access over Nabu Casa was quite sluggish (not delayed, just very slow) for me, so have gone back to using the “manual” method of LE/DuckDNS/Nginx.
my thoughts exactly. if network issue why would tags be slow and executing the command using the created tag work right away. can’t see how that can be coming from my network or even where to look first
Humor us and switch to Nabu Casa remote and see if its working for you properly. My own setup involves using NAT Loopback on my router so I only use external address and I experience no delays. Others with nabu casa make use of the internal connection URL feature. By switching to Nabu Casa you take your own proxy etc… out of the mix and let the app do its thing which tells us where the issue is.
Its a 2 step process…the phone first scans the tag and then the app sends the event data to your HA server, then you pick up the event and execute the automation…the issue here is the sending of the data that takes longer in certain setups but not all.
After spending some more time thinking about the different cases this can be an issue I have create a PR, to help test out and provide feedback please read and follow this comment very carefully. Big emphasis on carefully once you read it.