Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFC support #504

Closed
LagaV opened this issue Mar 6, 2023 · 16 comments
Closed

NFC support #504

LagaV opened this issue Mar 6, 2023 · 16 comments
Assignees

Comments

@LagaV
Copy link

LagaV commented Mar 6, 2023

Just had a similar thought as in here: #67.

Having an NFC tag on each container being scanned with the mobile phone would launch Beanconqueror and start a „repeat“ for the last brew of this roast.

Are there any updates to the NFC framework support, as this was the reason to shelf the original request?

@graphefruit
Copy link
Owner

The latest release of the plugin was 2020 - so a "bit" outdated.
I'd need to test it, and I'd need NFC-Tags at home myself for writing, which I don't have actually.

@LagaV
Copy link
Author

LagaV commented Mar 7, 2023

I’m using 50ct tags (via eBay bought 10 as a set) to initiate homeautomation tasks (home assistant).

Not sure if you would need to have an embedded NFC capability within the app. For iOS I leverage the Shortcuts automation functionality. This requires (published ?) URL handler capability for the intended app. So Beanconquerer would need a URL handler to start a new brew for a bean sort.

Advantage (within iOS) is, that the app not necessarily needs to be active if the tag is scanned.

@graphefruit
Copy link
Owner

The issues with this kind of solution is, you'd also need to know how to write an NFC Tag, and without any guidelines it will be a tricky topic.
Also you'd need to get the Bean-ID out of beanconqueror, so there need to be atleast one new option to show and copy maybe this kind of information, and generate an URL for tagging.

Yes you're right, there would be some ways of workaround, but wouldn't it be great to just "..." the beans -> Write NFC Tag?
Would be much more handy.

@reox
Copy link
Contributor

reox commented Mar 21, 2023

This would be a great feature!

Basically, what you would have to do is:

  1. Have dialog to initialize NFC Tags. In this dialog, a NDEF Message is written onto the tag, containing some random ID. The App keeps track of the IDs it has written
  2. Link a tag to a bag. Here, one could also setup the brew type (espresso, filter etc) or defaults that should be used for this bean (specific grinder, water, ...)
    2a) the tag is reused, while the bag is still in use. Maybe ask the user if the bag shall be archived or simply linked to the new bag.
  3. Now the app knows which NDEF message is connected to which bag. Scanning the tag opens the app and starts the brew
  4. When the bag is empty, the tag is removed from the bag and can be used for the next bag

btw, you do not need actual NFC Tags to test most of the functionality, QR codes containing the same URI as the NDEF message work as well ;)

@graphefruit I have a bag full of 15693 Icode Tags (coin shaped w/o glue). If you like I send you a few for free. I bought them years ago when I did a project with NFC and have not used them since them, except one tag for Home assistant (which works great, btw)

for a university project, we used an URL handler with a custom scheme. For example you could use brew://coffeebag/<random_ID> in the NDEF message and simply register for the brew:// scheme.
However, this has the drawback/advantage (you can see it both ways actually!) that a phone without beanconqueror installed cannot handle these tags. If you use something like https://beanconqueror.com/tag/<random_ID>, a user that does not have the app, or has it improperly configured, will be send to the webbrowser instead. Homeassiant has it configured that way and sends you here: https://www.home-assistant.io/tag/randomid

and for the fun: Working prototype of the Coffee-nfc-taggifier-9001:
image

😁

@reox
Copy link
Contributor

reox commented Mar 21, 2023

As a workaround, if writing NFC Tags is too much effort, you can simply enable the URL handler. without resorting to NFC Reading/Writing.
At least on Android, the NFC Reading is done by the OS and only the URL is forwarded to the App. You could then do the following. If an URL is presented ...

  • that is not in the database of tags, add it
  • that is in the database but not in use, ask on which bag to attach it
  • that is in the database and attached to an coffee, start the brew

You could basically setup everything except reading/writing of tags. Tags can easily be written manually with another app.

@graphefruit
Copy link
Owner

@reox I'm not deep inside NFC Tags, but would it be possible to go like:
beanconqueror://NFC?beanId=1827318273461827365&brewId=81726364718?
Therefore I could just pass the internal UUID's, instead of referencing to a new ID which would need to be saved.

@LagaV
Copy link
Author

LagaV commented Mar 23, 2023

On iOS I was able to write the sample tag to an NFC tag with „NF21 Tools“. When reading the text it launches Beanconquerer. So seems operable. This approach might also work with QR codes as launcher.

@graphefruit
Copy link
Owner

On iOS I was able to write the sample tag to an NFC tag with „NF21 Tools“. When reading the text it launches Beanconquerer. So seems operable. This approach might also work with QR codes as launcher.

Yes beanconqueror:// is the internal address, wich is already connected for bean-qr scans from roasteries.
If the text is the same it doesn't matter if qr-code or nfc-tag, but NFC-Tags need a plugin to read NFC and a device which has NFC, qr-codes has already a build in scanner in BQ, or you can use normally the camera or plugins, so theres quite a "bit" of a difference.

@LagaV
Copy link
Author

LagaV commented Mar 23, 2023

Generally to me the (NFC) URL approach seems a very good option, as this also launches the Beanconquerer app in one „swipe“. Having QR codes as a parallel option also makes sense. I would put NFC tags on dedicated bean containers and QR tags on in-use bean bags.

@reox
Copy link
Contributor

reox commented Mar 23, 2023

@reox I'm not deep inside NFC Tags, but would it be possible to go like: beanconqueror://NFC?beanId=1827318273461827365&brewId=81726364718? Therefore I could just pass the internal UUID's, instead of referencing to a new ID which would need to be saved.

My last experience with NFC on Android was in ... uhhhmmm ... 2013 I guess 😆
So maybe things have changed...
But I guess the answer to your question is yes and no.

You can use the beanconqueror:// scheme without any problems. The only downside is, as explained, if someone scans the tag without having the app installed OR having the app misconfiguration (i think you can remove scheme associations manually), then nothing will happen. If you use http(s):// scheme instead, a browser will be opened and you could redirect to a help page.

For the parameters, I guess the approach you have in mind would link always one tag with one bag - right?
That would however mean that you need to store the bag ID on the tag, every time you create a new bag.

What you would have to do is to simply give each tag a random ID, i.e., the NDEF Message would link to beanconqueror://NFC?tagId=9cc0bebf-b108-436e-a224-7ea4f9f1861e.
Inside the app you then have to make the connection which tag is currently attached to which bag, as described above.

This approach requires you to write the tag once and IMHO you can then rely on the reading capabilities of the OS to send you the data into the app. I.e., no need for NFC reading capabilities in the App itself. And you can do the same with QR Codes - for example, print out some QR codes and laminate them to re-use.

@graphefruit
Copy link
Owner

@LagaV @reox
Its finally after updating to capacitor, and a new maintained cordova-plugin, this is coming.
You'll be able to write or read a NFC-tag for a coffee-bag.

graphefruit added a commit that referenced this issue Oct 13, 2024
…pi requests (don't use fetch() if performance is needed). Addded permission for android for bleutooth

#808 - Added bean sort/filter for bean selection
#809 - added ios dark mode icon
#504 - Added NFC-Support to write tags
#810 - Added qr code to start brew
@graphefruit graphefruit self-assigned this Nov 24, 2024
@graphefruit
Copy link
Owner

@LagaV @reox In the next release it will be possible to read or write NFC-Chips for beans.
And choose the action: Add a brew, add a brew and choose preparation method, view bean or edit bean.

You can also choose QR-Code or NFC-Tag :)

@zshenker
Copy link

zshenker commented Dec 2, 2024

@graphefruit are there any particular types of NFC tags that will be supported by this feature/any in particular that you are testing with?

@graphefruit
Copy link
Owner

@graphefruit are there any particular types of NFC tags that will be supported by this feature/any in particular that you are testing with?

I just bought me some: NFC Tag Ntag215 to test. (They are working)
If you have other NFC-Tags, I can pass you a development version APK if needed, so you could test

@zshenker
Copy link

zshenker commented Dec 2, 2024

@graphefruit I was planning to order some NTAG216 tags. I would be happy to test once I get them, but would you have an iOS build(TestFlight?)?

@graphefruit
Copy link
Owner

@graphefruit I was planning to order some NTAG216 tags. I would be happy to test once I get them, but would you have an iOS build(TestFlight?)?

I have, but I do this via Google Firebase, please write me an email with your google-mail address so I can add you: [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants