I am trying to create a module which plays music from a directory. I wanted to use two buttons to control it. One for Pause/Play and one to skip the current song. But unfortunately when I start the MM2 I always get the message that it is not able to find the helper for my module. I’m new to node.js so maybe there are just some basic mistakes.
and the class organnizing it has a refrence to that button and subscribes to the click event and triggers said callback when clicked.
How can I use module.sendSocketNotification in this configuration for the button callback?
@bez252 Actually what they describe might also work for you, based on a quick glance through the setup code.
To shutdown from the node_helper you need to change some code in the file(will be in MMM-Button/node_helper.js in your file system). Here is an example from my module to shut down the RPi, you can replace the self.sendSocketNotification(...) in the node_helper with a similar command:
exec('sudo shutdown -h now', null);
Also, at the beginning of the file you need to include the exec function, like here: