Volumio Information
Volumio Version: 2.834
Hardware: Raspberry 4
DAC: None - using HDMI
I am trying to implement additional commands for an remote ir to select predefined webradio stations - basically following this discussion: IR Remote Controller Plugin and extra remote control.
However, I couldn’t get this to work. So I used a simple JS script to test communication with the socket api - this is more or less copied from WebSocket: Home Automation:
#!/bin/node
var io=require('socket.io-client');
var socket= io.connect('http://localhost:3000');
//Report successful connection
socket.on('connect', function () {
console.log('Client Connected');
});
//Report disconnection
socket.on('disconnect', function () {
console.log('Client Disconnected');
});
//Notify on player state changes, this includes volume changes, songs etc
socket.on('pushState', function (data) {
console.log(data);
});
//Notify just the volume value
socket.on('pushState', function (data) {
console.log(data.volume);
});
//Set Volume to 15
socket.emit('volume', 15);
Saved to disk and called in the command line:
cd /usr/local/bin/myscripts
node test.js
This starts without error but never terminates, no message displayed. Also no message in the system log.
npm install socket.io-client carried out sucessfully.
What am I doing wrong? Is there any authentication needed? Can’t I run the script simply from the command line?