Implemented new plugin "NFC Commands"#4655
Conversation
|
From my point of view, this is very nice research project. But it's targeting just a few people, maybe. Nothing with mass usage. I keep this open for discussion. |
|
Thanks for the quick response. I am not entirely sure what you mean by “research.” I understood it as suggesting that this feature has limited practical value, and I would disagree with that assessment. For me, this plugin provides a real improvement in daily use. Being able to trigger a command by tapping an NFC tag at places like the shower or kitchen table is much more convenient than navigating through multiple menus each time. More broadly, AndroidAPS already includes a number of optional features that are only relevant to smaller groups of users. That is part of its strength: users can configure it to fit their own needs and workflows. I see the NFC Commands plugin in the same category. From an engineering perspective, the implementation is cleanly separated through the existing plugin system and follows the same command model and safeguards as closely as practical. In my view, it is a safe and maintainable addition. Unfortunately, I do not have the time to actively promote the plugin outside the normal contribution process. If it is not accepted into the main repository, and later documented in Read the Docs, most users will likely never discover it, since many do not regularly follow issue discussions. If there are specific technical, safety, or maintenance concerns, I would be happy to discuss them and improve the implementation where needed. |
|
That's why keeping this open for discussion. If there will be more people interested, I can change my mind ... |
|
A shower NFC tag to trigger a 30 min disconnect would be great, I often just don't trigger a disconnect due to it being annoying to do, or not thinking about it. Simply hitting a NFC tag in my bathroom would be huge. |
|
I use NFC tags with Home Assistant already, the ability to trigger things in AAPS would be handy with tags around the house. Start the breakfast/meal pre-bolus or temp target with a tap would be ace, rather than using time based that becomes hard if you sleep in etc. |
9eff6d5 to
76c8797
Compare
76c8797 to
45c874b
Compare
|
I improved the UX a bit. Also, I added a branch for everybody to try the plugin based on AAPS 3.4.2.1 --> https://github.com/juehv/AndroidAPS/tree/patch-nfc |
|
|
I have hundred of old FSL sensors (I had FSL v1 with a miaomiao transmitter a long time ago 😉) All FSL sensors includes NFC communication. Does your plugin work with this kind of NFC tag?
|
This is a very interesting idea! I will definitely dig into that. But on the other hand, the set of 30 NTAGS in sticker size is around 5 EUR... So the question for a user is more "Does it relax my daily routine or not". And for me it's a game changer: I have one at my shower to disconnect pump, one at my kitchen table to set target eating soon and the same in my office on the door. Since I have them, I not only have to do less menu clicking, but also with the tags in my sight I forget it less often. |
|
I tried to install on my dev config to test your PR but it still requires a few updates:
For read only NFC tags, if you have a unique ID available for each tag, do you need write access?
|
|
I dive a bit on NFC tags (I build my first transmitter with an ESP32 for BT communication associated with a BM019 hardware for NFC communication 7 years ago...) Communication protocol of NFC 1 and 2 is ISO/IEC 15693
It could probably work if we limit communication to only read the UID of the FSL sensor and nothing else... (then everything should be stored on phone side associated with the UID)... |
I agree this should work fine, but this is quite a bit less secure. At the moment I write a JWT that includes the ID of the token on the token. It has a limited lifetime which gets automatically renewed every now and then. That means I'm always 100% sure the token is placed and written by me, and no other person could change the command that is executed. For me this feels quite secure (and safe in a consequence). I think it won't be too complicated to add a read-only option but it's hard to communicate non technical people the difference... Or do you think that's non of an issue? |
Ah yes, I saw the GUI is changing quite a bit. I developed the plugin before the last merge. Baseline question is, will the plugin be merged or not. Because if I'm the only user I'd rather target the master branch, as I'm using the plugin every day. |
All new features will now be targeted in v4.0 and following versions. You can of course continue to use it in your local version with v3, but your PR should be updated with V4 for a potential merge.
Not sure to understand correctly the way it works currently, and security impact (better or worse) with a read only tag (if we keep the idea to re-use old FSL sensor) 🤯. In your current solution, where are the commands associated to a tag? Within the tag or within AAPS?
|
Ok thanks for clarification.
Currently the command is written on the tag as part of the JWT token. However, the phone manages a redundant database of the commands on the tags (but only for reference). Changing to only reading the tag id and ignoring any content requires the command chain to be on the phone. If we consider the phone as "safe", both designs are equally secure (according to a security expert colleague of me). If you think that provides a value to someone I would spend a weekend to change the implementation (along with some other items on my todo list). Would be great if you can check if that works well with the FSL1 tags. |
|
@juehv I just installed "NFC Tools" in my phone to scan my different old FSL sensors 😯(I'm really a rooky on this topic 😂)
I now understand a bit better the standard way to use NFC tags (writing commands on tag), but information stored within NFC tags should not be "sensitive" on a safety/security point of view. For me it's not the case concerning an AAPS command (deliver bolus, stop loop, etc are in my mind very sensitive so they shouldn't be stored within tags). I think that keeping every sensitive information within AAPS is probably easier (code simplified) and much more secure:
Just my thoughts 😉 |
Ok then let's do it. This weekend is already full but next week I have the time to do it. Although I still have to figure out how the new UI is working ... but I'll manage :D I'll update the existing pull request as soon as I'm done. |
|
Yeh I agree, from a security perspective the only think on the tag should be a unique identifier that AAPS can read to trigger an action / automation. All the logic on this should be within AAPS i'd say, but configurable on what the string/code/hex value is that is read from the tag. Then you could really use any tag that already has a readable value on it to trigger that automation without the need to write anything to a tag (unless you wanted too for some reason). Ideally when setting up the automation you could tap the tag to read the value into the trigger field within that automation to make easy of use better? |
…_commands # Conflicts: # app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt # app/src/main/kotlin/app/aaps/di/PluginsListModule.kt # implementation/src/main/kotlin/app/aaps/implementation/userEntry/UserEntryPresentationHelperImpl.kt # plugins/main/src/main/kotlin/app/aaps/plugins/main/di/PluginsModule.kt # ui/src/main/res/drawable/ic_nfc.xml
|
@Philoul I worked this weekend on the NFC Plugin and run into a potential issue: What if FSL is used as glucose source and a new tag is scanned? Android's passive NFC dispatch follows a strict priority chain: Proposed approach (three layers):
What are your thoughts on this? |
|
I just tried your plugin on my dev phone:
|
|
Yeah .. that's I did not implement the support for non NDEF tags yet 😅 But the UI migration is done and the UID only feature is in place for NDEF tags. So multiple user could use the same tag with different actions. |
|
Second test with a spare tag I have (from an old Arduino kit...)
I have several little comments (UI improvement, code, ...) but I was able to test it and it worked as expected. FSL users should probably also test it: Normally NFC is only used to start the sensor and not later, but I don't know if we can disable NFC to let AAPS use older tag without conflicts... And it could vary according to user configuration (juggluco, xDrip+ and LibreLink, ...) |
…otification_spam Fix excessive Android Auto pop-ups from persistent notification
|
|
@Philoul |






The PR is related to
#4613