Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a28078f
Update Node.js versions in workflow configuration
ashenshugarRET Apr 2, 2026
f2a3a81
Update GitHub Actions to use latest versions
ashenshugarRET Apr 2, 2026
f9fdf3a
Update dependencies and devDependencies versions
ashenshugarRET Apr 2, 2026
0b19bfe
Update dependencies to latest versions
ashenshugarRET Apr 26, 2026
04a0ea2
Update package-lock.json with latest dependency versions
ashenshugarRET Apr 26, 2026
e69354b
Add engines field specifying Node.js and npm requirements
ashenshugarRET Apr 26, 2026
68acf35
Create setup_tests.js for jest fetch mock configuration
ashenshugarRET Apr 26, 2026
fa7db96
Updating Claude's optimistic versioning
ashenshugarRET Apr 26, 2026
ce4bb27
Update package dependencies to newer versions, correcting Claude
ashenshugarRET Apr 26, 2026
3901b1f
Updating package-lock.json to latest version
ashenshugarRET Apr 26, 2026
da620ef
Merge branch 'main' of https://github.com/ashenshugarRET/node-sonos-nfc
ashenshugarRET Apr 26, 2026
56f20c2
Update to README.md to reflect changes for Debian Trixie
ashenshugarRET Apr 28, 2026
fcb9e4b
Update README.md
ashenshugarRET Apr 28, 2026
111781b
Updating README.md for clarity
ashenshugarRET Apr 28, 2026
be7cd95
Update README.md
ashenshugarRET Apr 28, 2026
fa3cd27
Update README.md
ashenshugarRET Apr 28, 2026
978ada8
Update README.md
ashenshugarRET May 3, 2026
9374ed3
Bump @babel/plugin-transform-modules-systemjs from 7.29.0 to 7.29.4
dependabot[bot] May 9, 2026
9031554
Update README.md
ashenshugarRET May 9, 2026
7709dd2
Merge pull request #1 from ashenshugarRET/dependabot/npm_and_yarn/bab…
ashenshugarRET May 9, 2026
34f5984
Updates to README.md and renaming of usersettings.json.example
ashenshugarRET May 10, 2026
f9c33a4
Re-establishing usersetting.json
ashenshugarRET May 10, 2026
2ff47ee
Update usersettings.json
ashenshugarRET May 10, 2026
7158de0
Update README.md
ashenshugarRET May 17, 2026
d296063
Update README.md
ashenshugarRET May 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,21 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [20.x, 22.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
uses: actions/checkout@v4

- name: Install system dependencies
run: sudo apt install libpcsclite1 libpcsclite-dev pcscd

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm ci
- run: npm run build --if-present
- run: npm test
69 changes: 60 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,32 @@ $ sudo apt install libpcsclite1 libpcsclite-dev pcscd
If you're running a version of Linux, your computer may try to use the nfc kernel module to talk to tyour ACR122U. You don't want it to do this, so make sure the nfc and enabling modules are not loaded. In Ubuntu/Debian/Raspberry Pi OS, blacklist pn533, pn533_usb, nfc modules so that they don't hijack the card reader.

```
$ printf '%s\n' 'pn533' 'pn533_usb' 'nfc' | sudo tee /etc/modprobe.d/blacklist-nfc.conf
$ printf '%s\n' 'blacklist pn533' 'blacklist pn533_usb' 'blacklist nfc' | sudo tee /etc/modprobe.d/blacklist-nfc.conf
```

To make sure everything is square, it's probably a good idea to reboot. In Ubuntu/Debian/Raspberry Pi OS:
To ensure the NFC reader has the correct permissions on newer versions of Debian (Trixie onwards?) the following files are required
Create /etc/polkit-1/rules.d/60-pcscd.rules with this content:
```
polkit.addRule(function(action, subject) {
if (action.id == "org.debian.pcsc-lite.access_pcsc" &&
subject.isInGroup("plugdev")) {
return polkit.Result.YES;
}
});
```
If using the ACR122U reader create /etc/udev/rules.d/99-acr122.rules with this content:
```
SUBSYSTEM=="usb", ATTRS{idVendor}=="072f", ATTRS{idProduct}=="2200", GROUP="plugdev", MODE="0660"
```

Reload udev rules:
```
sudo udevadm control --reload-rules
```

To make sure everything is square, it's probably a good idea to reboot. In Ubuntu/Debian/Raspberry Pi OS:
```
$ sudo reboot
$ sudo reboot now
```

## Setup Node
Expand All @@ -54,7 +73,7 @@ Install node and npm, e.g. download or follow the [official instructions](https:
so that you can run this code. On Ubuntu/Debian/Raspberry Pi OS, I do this:

```
$ curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
$ curl -sL https://deb.nodesource.com/setup_22.x | sudo -E bash -
$ sudo apt-get install -y nodejs
```

Expand All @@ -76,7 +95,7 @@ $ npm install

For simplicity, [sonos-http-api](https://github.com/jishi/node-sonos-http-api), needed for this program to work, is included as a dependency, though you don't need to use it if you already have an http api running elsewhere.

If you _DO_ want to use the included Sonos HTTP API, you'll need to configure it. Rename the `usersettings.json.example` to `usersettings.json` and edit it to your liking. You'll need to set the `spotify` and/or `apple` sections to your credentials. You can also set the `http` section to your liking. The defaults should work fine for most people.
If you _DO_ want to use the included Sonos HTTP API, you'll need to configure it. Rename the `settings.json.example` in the `node_modules\sonos-http-api` directory to `settings.json` and edit it to your liking. You'll need to set the `spotify` and/or `apple` sections to your credentials if you want to use those services. You can also set the `http` section to your liking. The defaults should work fine for most people. FOr more information refer to the [sonos-http-api](https://github.com/jishi/node-sonos-http-api) repository.

## Run all the time

Expand All @@ -86,11 +105,37 @@ running, install pm2 globally:
```
$ sudo npm install -g pm2
```
### For the ACS readers with Debian Trixie or later

and spin-up sonos_nfc and sonos-http-api:
If you are using Debian Trixie and an ACS reader (other readers probably also need sudo, but I haven't tested that), it is necessary to run as sudo due to incompatibilities with the ACR122U NFC reader and Debian Trixie:

```
$ pm2 start npm -- run start-all
$ sudo pm2 start npm --name sonos-nfc -- run start-all
```

Then, to configure your system to run the startup, follow the instructions given when you run

```
$ sudo pm2 startup
```

e.g.

```
$ sudo pm2 save
```

If you already have the http API running elsewhere, you can direct this program to that server via the `usersettings.json` (update to how you would like to use) and instead run just this program via `npm start`, so replace the `sudo pm2 start` command above with

```
$ sudo pm2 start npm --name sonos-nfc -- start
```

### For Debian distribution earlier than Trixie with the ACR122U or if you are using a more modern reader
For debian distributions earlier than Trixie or if you are not using the ACR122U reader with Trixie, spin-up sonos_nfc and sonos-http-api as follows:

```
$ pm2 start npm --name sonos-nfc -- run start-all
```

Then, to configure your system to run the startup, follow the instructions given when you run
Expand All @@ -105,10 +150,10 @@ e.g.
$ sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
```

If you already have the http API running elsewhere, you can direct this program to that server via the `usersettings.json` (rename it from .example and update to how you would like to use) and instead run just this program via `npm start`, so replace the `pm2 start` command above with
If you already have the http API running elsewhere, you can direct this program to that server via the `usersettings.json` (update to how you would like to use) and instead run just this program via `npm start`, so replace the `pm2 start` command above with

```
$ pm2 start npm -- start
$ pm2 start npm --name sonos-nfc -- start
```

## Debug
Expand All @@ -119,6 +164,12 @@ You can monitor the process output to see what's going on. If you're using pm2,
$ pm2 log
```

or for Debian Trixie

```
$ sudo pm2 log
```

# Programming cards

## Card record format
Expand Down
Loading
Loading