From df00d9631ad058ba375c618217ded3c1afd9b0b4 Mon Sep 17 00:00:00 2001 From: ignasiduelo Date: Fri, 8 Nov 2024 14:46:41 +0100 Subject: [PATCH] feat:add support to store multiple commands in NFC card text field, separated by line break --- lib/sonos_nfc.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/sonos_nfc.js b/lib/sonos_nfc.js index 5a96d63..0b193b2 100644 --- a/lib/sonos_nfc.js +++ b/lib/sonos_nfc.js @@ -60,6 +60,13 @@ const sonos_nfc = (nfc) => { case 'text': const received_text = record.text; console.log('Read from NFC tag with message: ', received_text); + // splt lines to accommodate for multiple commands + var lines = received_text.split("\n"); + console.log('Lines read from NFC tag: ', lines); + + for (const command of lines) { + await process_sonos_command(command); + } await process_sonos_command(received_text); }