deviceid always "default" in button handler

Is there any way to get a device specific deviceid in the registered button handler?

https://neeoinc.github.io/neeo-sdk/#lib-device-devicebuilder.js-addbuttonhandler

.addButtonHandler((name, deviceid) => {
   console.log('[NEEO] ButtonPressed "%s" on %s', name, deviceid);
});
Even with multiple devices it's always "default". How can I provide or get a unique id? Or this a bug? I would like to use the same button handler for multiple devices because they call the same service, but I need to know which device triggered it.

Of course I could register individual handlers, but deviceid would be a very simple way handling it...

Reply
10replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Are you using device discovery? The deviceid refers to the id returned by your discovery function https://github.com/NEEOInc/neeo-sdk-examples/blob/master/lib/device/discoverableLightDevice/controller.js#L78

    Reply Like
    • No, just a simple neeoapi.startServer call with multiple devices. I don't see why I need a discovery function, but if that's the only way I'll give it a try...

      Reply Like
    • Markus Zehnder From what I've done so far I don't think NEEO sends the device name through with the request unless you have device discovery :( Would be happy to be proven wrong however

      Reply Like
    • Markus Zehnder Hi, had a look at your LIRC project and I second Jake Blatchford here.

      I think in stead of creating an array of neeodevice objects you should create one device in your index.js and use the .enableDiscovery to pass the list of remotes the LIRC is managing; When doing so, you will be responsible to provide the unique devideID which will then be populated as you expect it to be.

      This way, when adding a device in Neeo's App, you will get the list of available remotes and select the one you want to add.

      The driver acts as a gateway to LIRC which acts as a gateway to the devices it manages so should be only 1 instance ...

      Hope this helps.

      Reply Like
  • Hi, how do you register / declare these multiple devices ?

    Reply Like
  • Markus Zehnder  Did you solved this? If yes, how? Because I have the same problem. Do already provide the devices as an array.

    Reply Like
  • Has this been solved? I'm running into a similar problem.

     

    I've built a Roku IP driver and I would like to target the driver to multiple roku's but the onbuttonpressed action only returns default for the deviceid.

    Reply Like
    • Rodney Betts 

      Can you share your code? I would like to have a look at it.

      Reply Like
    • Paul Spee yeah it's pretty much the same as the first comment. The deviceId variable in console.log is returning "default". If I could get something unique I would be golden. 

      onButtonPressed(name, deviceId) {
        /*
         * Since we added 4 button groups in index:
         * Volume, Numpad, Menu and Back, Controlpad
         *
         * We need to handle all of the buttons these groups define here:
         * - DIGIT 0 though DIGIT 9
         * - CURSOR ENTER
         * - CURSOR UP
         * - CURSOR DOWN
         * - CURSOR LEFT
         * - CURSOR RIGHT
         * - MENU
         * - BACK
         * - VOLUME UP
         * - VOLUME DOWN
         * - optionally MUTE TOGGLE
         *
         * See https://github.com/NEEOInc/neeo-sdk#neeo-macro-names for more details
         * on button groups.
         */
        console.log('first test: ' + deviceId);
        console.log(`[CONTROLLER] ${name} button pressed for device ${deviceId}`);

       

      }

       

      Separately, is there anyway I can specify an ip address when setting up the device within the app? I keep seeing references to discovery but I would like to manually specify since I have several Roku's/Roku TV's.

      Reply Like
reply to topic
Like1 Follow