[Plugin] NFC Music: Controlling Music via NFC

Hi, there are several initiatives for NFC controlled playback. My use-case: A kid below 2 who likes to play “Dikkertje Dap” and is stalking me to play it constantly. I like him to be able to put on som “siek” himself and figured an NFC reader and stickers are the way to go.

I couldn’t find a proper NFC plugin, so I’m trying to create one myself. Would anyone be interested in this as well? Might affect the decision to put a little more effort in it and share the repo.

Or… Am I missing something and do you have one already available? Which would be class…

Due to overwhelming enthousiasm. I’m doing this!

this is the only thing i could find:

1 Like

Thanks. Did see this, but also read it wasn’t working anymore. Anyway. I dove in and currently seem to have the flow tag → start song working. On the backlog is adding support for multiple types e.g. albums, playlist (all volumio local) and finally spotify. However due to the current issues with that plugin I’m starting locally.

I’m trying to keep it all modular, using existing plugins as much as possible. I suppose this would be the preferred way?

I’m running into some issues. I have been using axios to start playing albums from the volumio library.

Example:

    async playPlaylist(data) {

        this.logger.info(
            `Playlist starten via Volumio API: ${data.name}`
        );

        const response = await axios.post(
            'http://127.0.0.1:3000/api/v1/replaceAndPlay',
            {
                service: 'playlists',
                type: 'playlist',
                uri: `playlists/${data.name}`
            },
            {
                headers: { 'Content-Type': 'application/json' }
            }
        );

        this.logger.info(
            `Playlist gestart: HTTP ${response.status}`
        );

        return response.status === 200;
    }

However, I’m having difficulty finding playlists and adding them succesfully to the queue. Anyone some ideas on the way to go? Have been experimenting with commandRouter and mpc stop, clear, load, play etc. But no success yet.

take a look here for the proper parameters.

Thanks! I believe I came across a little bug which might impact what I’m trying to achieve.

When I browse the music section → choose playlists → press the play button before the playlist → Nothing happens…

Logging:

Aug 21 10:46:26 test volumio[22103]: info: Preload queue cleared
Aug 21 10:46:26 test volumio[22103]: info: CoreCommandRouter::volumioReplaceandPlayItems
Aug 21 10:46:26 test volumio[22103]: info: CoreStateMachine::ClearQueue
Aug 21 10:46:26 test volumio[22103]: info: CoreStateMachine::stop
Aug 21 10:46:26 test volumio[22103]: info: CoreStateMachine::setConsumeUpdateService undefined
Aug 21 10:46:26 test volumio[22103]: info: CorePlayQueue::clearPlayQueue
Aug 21 10:46:26 test volumio[22103]: info: CorePlayQueue::saveQueue
Aug 21 10:46:26 test volumio[22103]: info: CoreCommandRouter::volumioPushQueue
Aug 21 10:46:26 test volumio[22103]: info: CoreStateMachine::addQueueItems
Aug 21 10:46:26 test volumio[22103]: info: CorePlayQueue::addQueueItems
Aug 21 10:46:26 test volumio[22103]: info: Preload queue cleared
Aug 21 10:46:26 test volumio[22103]: info: Adding Item to queue: playlists/Test123
Aug 21 10:46:26 test volumio[22103]: info: Exploding uri playlists/Test123 in service mpd
Aug 21 10:46:26 test volumio[22103]: error: scanFolder - failure to stat '/mnt/playlists/Test123'

Should I list that bug somewhere?

Edit: Or is it related to this Volumio 2 bug: Playlist options are broken · Issue #1965 · volumio/Volumio2 · GitHub ?

It seems to be a timing issue? Adding items to the queue and playing simultaneously, before the items are actually added.