Hello…
I’m experimenting with a plugin on similar lines to gpio-buttons, but to respond to events from a touch enabled i2c sensor.
My plugin can quite happily detect the touch events, but I’m struggling to get these connected to say ‘play’. the code is very similar to gpio-buttons.
self.logger.info("Emitting state")
socket.emit('getState', '');
socket.once('pushState', function (state) {
console.log(state)
if (state.status == 'play' && state.service == 'webradio') {
socket.emit('stop');
} else if (state.status == 'play') {
socket.emit('pause');
} else {
socket.emit('play');
}
});
But I get no response to the ‘getstate’ and the ‘play’ is never honoured. Where as gpio-buttons works just fine.
(my code is currently at https://github.com/mbwhite/volumio-plugins-sources/blob/1caf675463b5b122d0e75c140277f65bdf5b2fbd/touch_buttons/index.js#L49)
Sure I’m missing something obvious!
Cheers Matthew