IR Remote Controller Plugin and extra remote controll

Great! :sunglasses:

I think you could use the WebSocket APIs https://volumio.github.io/docs/API/WebSocket_APIs.html. I would put together a node.js script and call the script like this from lircrc config = /usr/local/bin/yourscript.js "yourwebradio"
The script could contain something like posted here https://volumio.org/forum/few-useful-node-scripts-t6247.html#p30667. See the third example for playing webradio. Maybe a shorter timeout suffices but I had no time to test the code at all.

I successfully tested the following code:[code]#!/bin/node

var io = require(‘socket.io-client’);
var socket = io.connect(‘http://localhost:3000’);
socket.emit(‘clearQueue’);
var fs = require(‘fs’);
var content = fs.readFileSync(’/data/favourites/my-web-radio’);
var webradios = JSON.parse(content);
var radio = webradios.find(o => o.name === process.argv[2]);

if (radio == null) {
socket.disconnect();
} else {
socket.emit(‘addPlay’, {‘service’:radio.service,‘title’:radio.name,‘uri’:radio.uri});
socket.on(‘pushState’, function() { socket.disconnect(); } );
}

setTimeout(function() { socket.disconnect(); }, 500);

[/code]
To create a .js file with the code above in e.g. /usr/local/bin connect to volumio via ssh and open the nano editor:

nano /usr/local/bin/yourscript.js

Copy and paste the code into nano then close nano saving the file:

Ctrl+x y Return
The script needs socket.io-client. If it has not been installed yet run npm install socket.io-client
After that lircrc can call the script with the name of the desired webradio station (which has to be be added to “My Web Radios” before of course) as parameter:

config = /usr/local/bin/yourscript.js "yourwebradio"

Edit:
The example above covers selecting a radio station from my web radios and not from radio favourites. But that is easily possible, too. Just change “var content = fs.readFileSync(’/data/favourites/my-web-radio’);” to var content = fs.readFileSync('/data/favourites/radio-favourites'); and “socket.emit(‘addPlay’, {‘service’:radio.service,‘title’:radio.name,‘uri’:radio.uri});” to socket.emit('addPlay', {'service':radio.service,'title':radio.title,'uri':radio.uri});

Thanks gvolt! This was just what I wanted. :slight_smile:

Good to see, it’s helpful. :slight_smile:

can you help me about web radios i couldnt do it :frowning:

reason is ;

1 Like

Please can u help me :slight_smile:

1 Like

You need to run npm install socket.io-client first.

First off all thank u so much to your answer i am very glad to see your post :slight_smile: last night a few hours tried to solve but i can’t
I already did it but i think some problem during install

[code]npm install socket.io-client
npm WARN saveError ENOENT: no such file or directory, open ‘/home/volumio/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/home/volumio/package.json’
npm WARN volumio No description
npm WARN volumio No repository field.
npm WARN volumio No README data
npm WARN volumio No license field.

  • socket.io-client@2.3.0
    updated 1 package in 6.961s
    [/code]

Looks just like warnings. Did you try running your script nonetheless?

How can i run?

CLT-L09 cihazımdan Tapatalk kullanılarak gönderildi

2 Likes

I did everything assign a button lirc folder but button not work how can i run the script in putty

CLT-L09 cihazımdan Tapatalk kullanılarak gönderildi

1 Like

Like you already tried: node /usr/local/bin/yourscript.js

1 Like

when i run this message i got;

[code]volumio@mutfak:~$ node /usr/local/bin/yourscript.js
module.js:549
throw err;
^

Error: Cannot find module ‘socket.io-client’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/bin/yourscript.js:3:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
[/code]

Why i get this error?.. :frowning:

CLT-L09 cihazımdan Tapatalk kullanılarak gönderildi

Could be you need to install built-essential sudo apt-get install build-essential then install socket.io-client package again.

1 Like

sorry i did it but the same error again

[code]volumio@mutfak:~$ sudo apt-get install build-essential
Reading package lists… Done
Building dependency tree
Reading state information… Done
build-essential is already the newest version.
build-essential set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
volumio@mutfak:~$ ^C
volumio@mutfak:~$ node /usr/local/bin/yourscript.js
module.js:549
throw err;
^

Error: Cannot find module ‘socket.io-client’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/bin/yourscript.js:3:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
volumio@mutfak:~$ npm install socket.io-client
npm WARN saveError ENOENT: no such file or directory, open ‘/home/volumio/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/home/volumio/package.json’
npm WARN volumio No description
npm WARN volumio No repository field.
npm WARN volumio No README data
npm WARN volumio No license field.

  • socket.io-client@2.3.0
    updated 1 package in 7.128s
    volumio@mutfak:~$ node /usr/local/bin/yourscript.js
    module.js:549
    throw err;
    ^

Error: Cannot find module ‘socket.io-client’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/bin/yourscript.js:3:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
[/code]

Gvolt do you have another idea?..
Last night again minimum 3 hours tried but no solution :frowning:

CLT-L09 cihazımdan Tapatalk kullanılarak gönderildi

You could have a look into /usr/local/bin. Amongst others there should be a file “package-lock.json” and a folder named “node-modules” containing a folder “socket.io-client” with the files of the socket.io-client module. If these files and/or folders should be missing this would be the reason of your error. If they should exist rename the file “package-lock.json” and the folder “node-modules” to keep them just as a precaution. Then run npm install socket.io-client from /usr/local/bin.

Back on working on the player.
Yesterday, After installing a fresh copy of Volumio on my SmartiPi Touch 2 I took the Jumper wire and connect to gpio22 on the Pi 4 and access the Volumio in the browser. I went over and selected Justboom ir remote and the gpio configuration also to gpio22 and saved and restarted the player. Out of the blue on the JustBoom remote, i started pressing buttons on it and noticed on the screen that it volume/ Mute/ Radom/ shuffle and power button was working but not for the play, next pause and the Ok button would work. But the volume would. Today, i booted up the SmartiPiTouch 2 and nothing wouldn’t work not even the volume and mute buttons. So, i had to do another install of Volumio and select gpio17 on the Pi and in the configuration. So, why would it work one day and the next, it didn’t work

Because you don’t read or do what has been asked.
I’ve told you to check which GPIO’s are in use by your DAC (Hifiberry)
So read it and determine if GPIO-17 was a smart choice. (Hint: No)