Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Alex Hortin
    @hortinstein
    hey I would be curious if anyone has feedback on the structure of the api. I have a few ideas in mind.
    Alex Hortin
    @hortinstein

    potentially expanding to something that could be used like this:

    dash_button = require('node-dash-button');
    var dash = dash_button(["8f:3f:20:33:54:44","2e:3f:20:33:54:22"]); //address from step above
    dash.on("8f:3f:20:33:54:44", function (){
        console.log("omg found");
    });
    dash.on("2e:3f:20:33:54:22", function (){
        console.log("omg found the other one!");
    });

    thoughts?

    BTW: The throttle should be implemented soon, it is contained in the throttle branch right now, just at work and cannot test it.
    Sam Weber
    @sweber6106
    It looks like Amazon has ruined everything by changing the Dash application. The application will no longer save the WiFi credentials to the Dash if you don't complete the "this is what I want to order" step.
    Alex Hortin
    @hortinstein
    Interesting. Well you could set it up with an account with bad cc info so it doesn't order. When did they change it?
    Sam Weber
    @sweber6106
    So I bought one about three weeks ago after I read the original blog post, got it and set it up just like the post said. Then last weekend I decided to try to take the device apart to see if I could tell what wireless chip and processor they were using. Unfortunately, I damaged the circuit board taking the device apart. I immediately ordered another one which arrived earlier this week. When I tried to set up the new one, the process no longer allows you to abandon the setup without choosing a product to buy.
    Sam Weber
    @sweber6106
    What the world needs is an open source version of this button. There is a $9 computer that boots Linux so how hard could it be to make one of these buttons for a few dollars?
    Shawn Miller
    @freshlogic

    It looks like Amazon has ruined everything by changing the Dash application. The application will no longer save the WiFi credentials to the Dash if you don't complete the "this is what I want to order" step.

    I tried this today and it worked fine. Instead of clicking "cancel" links in the app at step 3 I simply force quit the app.

    Alex Hortin
    @hortinstein
    ok just added in some testing code for the throttle and committed the pull requests. Anyone have opinions about the API?
    Dan Kordik
    @dkordik
    :thumbsup:
    import registerDashButton from 'node-dash-button';
    import { toggleLights } from './lib/lights.js';
    
    var lightSwitch = registerDashButton("74:c2:46:0c:4a:c9");
    
    console.log("Listening for Dash button presses...");
    
    lightSwitch.on("detected", () => {
        console.log("Light switch pressed.", new Date());
        toggleLights(1);
    });
    ^here's how I'm using it so far. I kinda like the one address per register call, just because it would make the code read like
    var lightSwitch = registerDashButton("74:c2:46:0c:4a:c9");
    var playButton = registerDashButton("aa:bb:cc:dd:ee:ff");
    
    lightSwitch.on("detected", () => { /* light switch stuff */ })
    playButton.on("detected", () => { /* play button stuff */ })
    Dan Kordik
    @dkordik
    though I get that combining them would let you share a single pcap session, which seems way worth it
    what about something like this:
    import DashButtonListener from 'node-dash-button';
    
    var dashButtonListener = new DashButtonListener(); //init pcap here, establish instance context
    
    var lightSwitch = dashButtonListener.register("aa:bb:cc:dd:ee:ff");
    var playButton = dashButtonListener.register("dd:ee:ff:aa:bb:cc");
    Alex Hortin
    @hortinstein
    Yeah the shared pcap session was what I was looking for. When I get a few min I'll do it in the altapi branch
    Hmmm I might also want to add an optional argument for capture device too
    Dan Kordik
    @dkordik
    Does anybody have a good grasp of how unix privilege separation works? hitting a snag when I need to listen to apps at the user level put need to listen for the dash network traffic as root… within the same app. Not looking to derail the room or anything, but thinking it might come up for you guys too when you’re using this module. I’ve tried using process.setgid/process.setuid to drop root privileges.. but that doesn’t seem to put you in the same user space as launching an app as that user. somehow.
    Dan Kordik
    @dkordik
    In Mac OS, apps commonly fire Distribution Notification events that other apps can listen to. In my case, I’m listening for Rdio/Spotify/iTunes to tell me they’re playing, so that when I press my PLAY/PAUSE Dash button, I can play or pause the proper player :) Thinking about splitting into separately launched processes- one that listens for Dash presses (as root) and one that takes actions (as user), and have them communicate through some intermediary like Redis or something. Seems less than ideal though
    Dan Kordik
    @dkordik
    Ended up launching two processes and implementing a simple pub-sub via a file and the fsevents package for them to communicate. Works well enough. And you can tuck the dual process launching into an npm task, like sudo node process1.js & node process2.js
    new article on the IoT button
    Sam Weber
    @sweber6106
    @freshlogic Thanks for making me go back and try the procedure again. Works as you say. I appreciate the tip.
    Brody Berson
    @bhberson
    @hortinstein haha nice. This is exactly what I'm doing.. but with a <redacted> product ;)
    The "hack" of the amazon dash button is ready to go, but working on the IoT Button version of it and releasing them together
    Dan Kordik
    @dkordik
    @hortinstein whoa, sweet!
    Alex Hortin
    @hortinstein
    hey i updated the tests so it will compile in CI, but I have found an issue with pcap compiling in node 4. I will open up an issue tomorrow on the node_pcap board to see if there is anyway to compile it correctly in node 4.
    ...and i have an IoT button on the way. I will update this library to support it
    Aaron Mead
    @Aaronm14
    A little late to the party here I believe, but if anyone is looking - what version of node did you use for this node module? Having a lot of issues getting socketwatcher to install, on OS X
    Aaron Mead
    @Aaronm14
    @hortinstein
    Aaron Mead
    @Aaronm14
    Had to use node 4 and update xcode turns out
    Aaron Mead
    @Aaronm14
    Follow up qeustion though, how do you avoid getting so many notifications from the amazon app for finishing set up of dash button
    Brody Berson
    @bhberson
    Glad you were able to get it figured out! Unfortunately, there isn't any way to avoid that besides turning off notifications for that app entirely... it's something on Amazon's end, there will never be a way to block their push notifications.