Code Monkey home page Code Monkey logo

dasher's Introduction

Dasher!!

⚠️ Dasher is sunsetted ⚠️

This project is no longer under active development. I neither use it, nor do I use Amazon Dash buttons in my home automation. I found their latency and general way of working to not be a great solution as a smart button for my household.

Nekmo/amazon-dash is a great alternative. It has support for all kinds of actions and is actively developed. It's way better than mine!

What it is

Dasher is a simple way to bridge your Amazon Dash buttons to HTTP services.

Do you have a Home Automation service set up like Home Assistant, openHab, or maybe a SmartThings hub? Using Dasher, you can easily command them to do something whenever your Dash button is pressed.

This of course goes for anything you can reach via HTTP. That includes IFTTT by way of the Maker channel 🤘

How it works

It's pretty simple. Press a button and an HTTP request is made or local command is ran. That's it.

You configure your Dash button(s) via config/config.json. You add its network address and either a url, an http method, and optionally a content body and headers or a local command to execute.

When Dasher starts, it will listen for your button being pressed. Once it sees it, it will then make the HTTP request or run the command that you defined for it in your config.

Configuration

You define your buttons via the config/config.json file. It's a simple JSON file that holds an array of buttons.

Here's an example.

{"buttons":[
  {
    "name": "Notify",
    "address": "43:02:dc:b2:ab:23",
    "interface": "en0",
    "timeout": "60000",
    "protocol": "udp",
    "url": "https://maker.ifttt.com/trigger/Notify/with/key/5212ssx2k23k2k",
    "method": "POST",
    "json": true,
    "body": {"value1": "any value", "value2": "another value", "value3": "wow, even more value"}
  },
  {
    "name": "Party Time",
    "address": "d8:02:dc:98:63:49",
    "url": "http://192.168.1.55:8123/api/services/scene/turn_on",
    "method": "POST",
    "headers": {"authorization": "your_password"},
    "json": true,
    "body": {"entity_id": "scene.party_time"},
    "formData": {
      "var1":"val1",
      "var2":" val2"
    }
  },
  {
    "name": "Start Cooking Playlist",
    "address": "66:a0:dc:98:d2:63",
    "url": "http://192.168.1.55:8181/playlists/cooking/play",
    "method": "PUT"
  },
  {
    "name": "Debug Dash Button",
    "address": "41:02:dc:b2:ab:23",
    "debug": true
  },
  {
    "name": "Command Exec Button",
    "address": "41:02:dc:b2:10:12",
    "cmd": "/home/user/dash_button.sh"
  }  
]}

Buttons take up to 8 options.

  • name - Optionally give the button action a name.
  • address - The MAC address of the button.
  • interface - Optionally listen for the button on a specific network interface. (enX on OS X and ethX on Linux)
  • timeout - Optionally set the time required between button press detections (if multiple pressese are detected) in milliseconds. Default is 5000.
  • protocol - Optionally set the protocol for your Dash button. Options are udp, arp, and all. Default listens to arp. The "newer" JK29LP button from ~Q2 2016+ tends to use udp.
  • url - The URL that will be requested.
  • method - The HTTP method of the request.
  • headers - Optional headers to use in the request.
  • json - Optionally declare the content body as being JSON in the request.
  • body - Optionally provide a content-body that will be sent with the request.
  • formData - Optionally add formData that will be sent with the request.
  • debug - Used for testing button presses and will -not- perform a request.
  • cmd - Used to run a local command rather than an HTTP request. Setting this will override the url parameter.

Setting and using these values should be enough to cover almost every kind of request you need to make.

You can find more examples in the example config.

Protips

Here are few protips about Dash buttons that will help you plan how to use them.

  • Dash buttons take ~5 seconds to trigger your action.
  • Use DHCP Reservation on your Dash button to lower the latency from ~5s to ~1s.
  • Dash buttons are discrete buttons. There is no on or off. They just do a single command.
  • Dash buttons can not be used for another ~10 seconds after they've been pressed.
  • If your Dash button is using udp, specify it in the button config.
  • Listening over wifi is unreliable. I highly recommend using ethernet, especially on Raspberry Pi

Dash buttons should be used to trigger specific things. I.E. a scene in your home automation, as a way to turn everything off in your house, or as a simple counter.

Setup

You'll want to set up your Dash buttons as well as Dasher.

Dash button

Setting up your Dash button is as simple as following the instructions provided by Amazon EXCEPT FOR THE LAST STEP. Just follow the instructions to set it up in their mobile app. When you get to the step where it asks you to pick which product you want to map it to, just quit the setup process.

The button will be set up and available on your network.

Find Dash Button

Once your Dash button is set up and on your network, you need to determine its MAC address. Run this:

script/find_button

Click your Dash button and the script will listen for your device. Dash buttons should appear as manufactured by 'Amazon Technologies Inc.'. Once you have its MAC address you will be able to configure it in Dasher by modifying config/config.json after installing Dasher.

Dasher app

Simply install the dependencies and clone the repository.

note: You might need to install libpcap-dev or npm on Linux first.

sudo apt-get install libpcap-dev
sudo apt-get install npm

note Raspberry Pi users may need to update node arm which will automatically remove nodejs-legacy. Credit @legotheboss

sudo apt-get install node

wget http://node-arm.herokuapp.com/node_latest_armhf.deb 
sudo dpkg -i node_latest_armhf.deb

Clone and Set up Dasher

git clone https://github.com/maddox/dasher.git
cd dasher
npm install

Then create a config.json in /config to set up your Dash buttons. Use the example to help you. If you just want to test the button press, use the debug button example with the MAC address you found running script/find_button.

Running It

Listening for Dash buttons requires root. So you need to launch Dasher with sudo.

sudo npm run start

Auto Start on OS X

After setting it up with script/bootstrap just run script/install to load Dasher with launchd. Dasher will now start on boot.

You can uninstall it with script/uninstall and restart it with script/restart.

Raspberry Pi

Having problems running npm install?

Raspberry Pi users may need to update node arm which will automatically remove nodejs-legacy. One you are on node mainline, force the update to the latest version of node for arm. This may not be needed if you are running a first generation pi. If you are on a Pi and run into problems with npm install, try this. Credit @legotheboss

Replace nodejs-legacy with node and manually update to the latest version of node arm.

sudo apt-get install node
wget http://node-arm.herokuapp.com/node_latest_armhf.deb 
sudo dpkg -i node_latest_armhf.deb

Quick Start Works as of (1/27/17)

Starting from a fresh Raspberry Pi Build?

sudo apt-get install libpcap-dev
sudo apt-get install npm

sudo apt-get install node
wget http://node-arm.herokuapp.com/node_latest_armhf.deb 
sudo dpkg -i node_latest_armhf.deb

git clone https://github.com/maddox/dasher.git
cd dasher
sudo npm install

sudo ./script/find_button
# update /config/config.json with mac address of your button 
sudo npm run start

Auto Starting

Advanced information on autostarting Dasher on your Raspberry Pi can be found here.

Contributions

  • fork
  • create a feature branch
  • open a Pull Request

dasher's People

Contributors

aceostar avatar bhardie avatar digininja avatar eastonboy99 avatar henrikbengtsson avatar lorenzos avatar maddox avatar rbflurry avatar walkerdb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dasher's Issues

Issues with install

Raspberry Pi 3 with HASSbian install, ethernet install.

I tried running NPM. Got this.

npm WARN engine [email protected]: wanted: {"node":">= 4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">= 0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.32"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})

[email protected] install /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher
node-gyp rebuild

make: Entering directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher/build'
CXX(target) Release/obj.target/socketwatcher/socket_watcher.o
In file included from ../socket_watcher.hpp:8:0,
from ../socket_watcher.cpp:5:
../../nan/nan.h:324:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
^
socketwatcher.target.mk:82: recipe for target 'Release/obj.target/socketwatcher/socket_watcher.o' failed
make: *** [Release/obj.target/socketwatcher/socket_watcher.o] Error 1
make: Leaving directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.34-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the socketwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls socketwatcher
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.4.34-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/dasher
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/dasher/npm-debug.log
npm ERR! not ok code 0

Amazon dash does nothing when press

Hello (again) Sorry for bad english im from france !

Now 90 percent of this is working ^^

but when i launch i got

[email protected] start /home/bell/dasher
node app.js

[2017-04-22T14:01:06.158Z] Porte added.

And even if i press there is nothing hapening :-/

Here is my configuration ! ( a friend gave it to me so i don't know if it's okay)

{"buttons":[
{
"name": "Porte",
"address": "your:dash:mac:40:B4:CD:87:CE:F4
"url": "$
"method": "POST"
}
]}

i know the ifttt url is correct bcs i can launch it manually with chrome.

can someone help ? thx ^^

Dasher crash

After a few hours of running from the init.d script, I get this error in the dasher.err file.

pi@pi:~ $ tail -f /var/log/dasher.err
&& _.isEqual(packet.payload.payload.sender_ha.addr,
^

TypeError: Cannot read property 'addr' of undefined
at PcapSession. (/home/pi/dasher/node_modules/node-dash-button/index.js:78:66)
at emitOne (events.js:96:13)
at PcapSession.emit (events.js:188:7)
at PcapSession.on_packet_ready (/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/pcap.js:99:10) at packet_ready (/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/pcap.js:44:14)
at SocketWatcher.pcap_read_callback [as callback] (/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/pcap.js:64:45)

how to disable post to amazon

thanks for this, your instructions and code worked well for me -- i'm able to hit ifttt and do what i wanted to do, but amazon still knows the button is being pressed and sends a "finish setting up your dash" notification on every press, which is messy traffic on top of my ifttt notification -- any plans to intercept and squelch that call to amazon?

sudo npm run start

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: node app.js
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /home/pi/Dasher/dasher
12 error Linux 4.4.11-v7+
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
14 error node v4.4.5
15 error npm v2.15.5
16 error code ELIFECYCLE
17 error [email protected] start: node app.js
17 error Exit status 1
18 error Failed at the [email protected] start script 'node app.js'.
18 error This is most likely a problem with the dasher package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node app.js
18 error You can get information on how to open an issue for this project with:
18 error npm bugs dasher
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls dasher
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

BLE support?

I got your dasher setup working beautifully on my rpi2, with auto-startup.
I'm new to github so pardon if this is the wrong place. Was wondering, with the rpi3 out now, if you've considered using BLE with node to expand the project. I've been reading on the Misfit Flash/Link (recently on sale from manufacturer for $5/ $3) and thinking with the ability for multiple functions (single press, double press, etc) that it would be an excellent next expansion/evolution for this project.

Add Pushover

Hi,

Is it possible to get help to add Pushover integration?
I guess that I have to modify config.json to add code below,regarding to https://pushover.net/api#friendly:

  {
    "name": "Pushover test",
    "address": "XX:XX:XX:XX:XX:XX",
    "url": "https://api.pushover.net/1/messages.json",
    "method": "POST",
    "json": true,
    "body": {"token": "tokenvalue", "user": "uservalue", "message": "test"}
  }

Any help will be appreciated 😃

Use dasher with letsencrypt

Hi !

my config for one of my dash button is

{
    "name": "Depart",
    "address": "xx:xx:xx:xx:xx:xx",
    "url": "http://192.168.1.XX:8123/api/services/scene/turn_on",
    "method": "POST",
    "headers": {"x-ha-access": "xxxxxxxxxxxxxx"},
    "json": true,
    "body": {"entity_id": "scene.depart"}
  },

and it works !

I installed Letsencrypt and every certificates, and I have access from outdoor with https (great) !
But unfortunetely, my dash buttons don't worked, because my lan access is bloqued...

I tried with my duckdns adress : but no result

{
    "name": "Depart",
    "address": "xx:xx:xx:xx:xx:xx",
    "url": "https://hass-example.duckdns.org/api/services/scene/turn_on",
    "method": "POST",
    "headers": {"x-ha-access": "xxxxxxxxxxxxxx"},
    "json": true,
    "body": {"entity_id": "scene.depart"}
  },

How can I modified my config.json to pass over the certification ? (or other if it works :) )

thank you !!

Find script not picking up an amazon tech mac address

After running the find script i get a bunch of mac addresses rolling in, mostly my server and a couple nodemcu units i have around the house. There is one unknown manufacturer mac, but is not directly related to button pushes. What am i missing?

Add logic to only allow one "request" per 30 seconds?

I started to block the requests to amazon cloud (toprevent the app popups) which causes the button to send the requests twice with only a single button press.

Would it be possible to set a timer the first time the button is pressed and not send the request if it is fired again too quickly?

Find_button Error

find_button is throwing an error. Here's the log with the libpcap-dev installed, npm install completed and then the traceback.

Setting up libpcap-dev (1.3.0-1) ...
(homeassistant) pi@carlo-pi ~/dasher $ npm install
\
> [email protected] install /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher
> node-gyp rebuild

make: Entering directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher/build'
  CXX(target) Release/obj.target/socketwatcher/socket_watcher.o
  SOLINK_MODULE(target) Release/obj.target/socketwatcher.node
  COPY Release/socketwatcher.node
make: Leaving directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher/build'

> [email protected] install /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap
> node-gyp rebuild

make: Entering directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/build'
  CXX(target) Release/obj.target/pcap_binding/pcap_binding.o
  CXX(target) Release/obj.target/pcap_binding/pcap_session.o
  SOLINK_MODULE(target) Release/obj.target/pcap_binding.node
  COPY Release/pcap_binding.node
make: Leaving directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/build'
[email protected] node_modules/node-dash-button
âââ [email protected]
âââ [email protected] ([email protected], [email protected])
(homeassistant) pi@carlo-pi ~/dasher $ cd script/
(homeassistant) pi@carlo-pi ~/dasher/script $ ls
bootstrap  find_button  install  restart  server  uninstall  upgrade
(homeassistant) pi@carlo-pi ~/dasher/script $ sudo ./find_button
module.js:338
    throw err;
          ^
Error: Cannot find module '/home/pi/dasher/script/node_modules/node-dash-button/bin/findbutton'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Connecting to Home Assistant

Im trying to get my Dashes to communicate with home assistant. I have my config as follows:

{
  "buttons": [{
    "name": "Dash A",
    "address": "10:ae:60:32:8c:40",
    "url": "https://maker.ifttt.com/trigger/Dash.A/with/key/bGkPmYg-xRMe1KapddJedg",
    "method": "POST"
  },{
  "name": "Dash B",
  "address": "f0:27:2d:0e:eb:5c",
  "url": "http://192.168.2.123:8123/api/services/switch/toggle/",
  "method": "POST",
  "json": true,
  "body": {
    "entity_id": "switch.closet"
  }
}]
}```

The Dash B sections is the Home Assistant part. What am I doing wrong. It comes back with:

Dash B pressed.
Not a 200
null


Why clues on what is the problem?

Might not work with Buttons that link to 1 product

I am not sure if anything has changed with configuration, but when I connected my button to Wifi but skipped the product selection page, it still ordered the item on button press. I suspect it might be because the button is linked to a single product so Amazon auto-selects it for you.

KIV while I test it out on another button that is coming soon

Fresh Raspbian Not Installing

I've tried to install dasher on both the lite and full versions on a clean Raspbian build using image 2016-09-23-raspbian-jessie, but neither have worked.

I also tried sudo npm install -g npm as suggested in another thread, and as you can see in the logs it stopped the "npm WARN engine" errors, but the install still failed.

The pastebin log shows everything entered after a fresh raspbian install:

http://pastebin.com/y7dAzZ1Z

Can I use it to switch on/off the lights in Philips Hue?

Hello,
The docs say this is just a trigger, there is no state, only one action.
Is it possible to trigger an action to reverse the current state of my lights? that is, switch on if they are switched off, and switch off if they are switched on.
Should I use IFTTT or connect to my Philips Hue route directly (which is in the same network)?
Thanks.

Can't open find_button

Hello !!

since something about 1 hour i try to open "find_button"

and here is what i have :-/

module.js:339
throw err;
^

Error: Cannot find module '/home/pi/dasher/script/node_modules/node-dash-button/bin/findbutton'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3

Can someone help me ? thx

init.d script throws error on boot

I created the init.d script per your instructions for my raspberry pi 2. I can run this command manually and the script starts dasher correctly.

sudo /etc/init.d/dasher start

However, on boot of the raspberry pi, it throws this error into the /var/log/dasher.err file and dasher does not start

    at create_session (/home/pi/dasher/node_modules/node-dash-button/index.js:28:15)
    at register (/home/pi/dasher/node_modules/node-dash-button/index.js:47:24)
    at new DasherButton (/home/pi/dasher/lib/dasher.js:12:21)
    at Object.<anonymous> (/home/pi/dasher/app.js:8:16)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

here is the beginning of my init.d dasher file.

#!/bin/sh
### BEGIN INIT INFO
# Provides: dasher
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

dir="/home/pi/dasher"
cmd="DEBUG=* node app.js"
user="root"

name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"

script/find_button

when I run pi@raspberrypi:~/dasher $ script/find_button it gives me the error below. What am I doing wrong:

module.js:472
    throw err;
    ^

Error: Cannot find module '/home/pi/dasher/node_modules/node-dash-button/bin/findbutton'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)

This could be because when I run pi@raspberrypi:~/dasher $ npm install it comes up with:

Usage: npm <command>

where <command> is one of:
    access, adduser, bin, bugs, c, cache, completion, config,
    ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
    help, help-search, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, tst, un, uninstall,
    unpublish, unstar, up, update, v, version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    /home/pi/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] /usr/lib/node_modules/npm


Also how can I run this on a RPI 1 as I cannot install node.js v7?

``

Thanks

Works when it auto starts, error when launching 'npm run start' (Raspi)

Hello,

I am running dasher on a Raspberry Pi 3 and receive the following error when running the sudo npm run start

`npm ERR! Linux 4.4.50-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! node v4.8.1
npm ERR! npm v2.15.11
npm ERR! path /home/pi/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/npm-debug.log
`

But when I use sudo /etc/init.d/dasher start, it works perfectly.

Dasher detects multiple button presses

When I start Dasher the below lines print
single element detected
Open Garge Door added.

Then when I press the button I get the below line
Open Garge Door pressed.

Then approximately 30-40 seconds later I get the following two line and the HA scene is run again.
Open Garge Door pressed.
Open Garge Door pressed.

Any idea how to fix this? I see something similar when running the find button. I get the following output from one button press.

possible dash hardware address detected: 10:ae:60:XX:XX:XX
possible dash hardware address detected: 10:ae:60:XX:XX:XX
~ 30 seconds passes then the below 2 print out.
possible dash hardware address detected: 10:ae:60:XX:XX:XX
possible dash hardware address detected: 10:ae:60:XX:XX:XX

I just stopped working...

I managed to get it working and then it just stopped working and I'm getting this error (Help Please!):

sudo npm run start
Password:

[email protected] start /Users/USER/dasher
node app.js

module.js:590
throw err;
^

SyntaxError: /Users/USER/dasher/config/config.json: Unexpected end of JSON input
at Object.parse (native)
at Object.Module._extensions..json (module.js:587:27)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/USER/dasher/app.js:2:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dasher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

How to do something different?

Can I use this to check whether either of my cell phones is connected to my wifi at 11 pm every night, then if it is, trigger the maker channel URL?

For example:

At 11:00 PM, if [MAC ADDRESS 1] or [MAC ADDRESS 2] is connected to [WIFI NETWORK] then [IFTTT MAKER CHANNEL URL]

Error on find_button (Unexpected identifier)

I get an error if i execute the find_button script, but if i go into the node_modules folder node_modules/node-dash-button/bin/ and execute the script direct i works.
Any idea?

sudo node script/find_button

/home/pi/dasher/script/find_button:3
sudo node node_modules/node-dash-button/bin/findbutton
     ^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

update dasher

Hi, can you tell me the easiest way to update my dasher installation from November 2016?

Regards, M

HTTP Requests not working. Getting response undefined error

I can't figure out what the issue is here. I followed /u/bruhautomation tutorial to get Dasher up and running.

When I use the IFTTT method, it works perfectly (granted, with an expected delay). When I try to use the HTTP request method to shorten the delay, nothing happens.
Here is the code I am using:

{"buttons":[
  {
    "name": "Gatorade",
    "address": "ADDRESS",
    "url": "https://NAME.duckdns.org/api/services/scene/turn_on",
    "method": "POST",
    "headers": {"x-ha-access": "PASSWORD"},
    "json": true,
    "body": {"entity_id": "scene.morning"}
  }
]}

Im using the exact same information with another app that sends HTTP requests and it works perfectly, so Im not sure what the issue is here.
Ive tried a variety of combinations of the above code as well, including appending the port number (which shouldnt be necesary for DNS) and changing x-ha-access to authorization, as I saw you have that in your example but it all results in the same errors.

This is the terminal readout when I try to run everything:

pi@hassbian:~/dasher $ sudo npm run start

> [email protected] start /home/pi/dasher
> node app.js

[2017-04-06T13:04:19.030Z] Gatorade added.
[2017-04-06T13:04:28.974Z] Gatorade pressed. Count: 1
[2017-04-06T13:06:36.562Z] there was an error
[2017-04-06T13:06:36.562Z] Response undefined
[2017-04-06T13:07:23.418Z] there was an error
[2017-04-06T13:07:23.418Z] Response undefined

Program is installed and running correctly, but not finding the button press

I can see my button by its mac address in the attached devices, but cannot seem to dasher hear the request (it happened once, but I cannot reproduce). I

user@PC:$ cd dasher
user@PC:
/dasher$ sudo npm run start
[sudo] password for user:

[email protected] start /home/user/dasher
node app.js

[2016-12-08T13:50:27.023Z] Notification added.

And the it just does not do anything, including responding to button presses. Any idea what I can try to do to fix the problem. Thank you!

Dasher not loaded after reboot in El Capitan

On El Capitan (10.11.3) Dasher would run be loaded when installed with script/install but would not be loaded again by launchd after a reboot. As such, it stopped working every time I rebooted the server.

The service name was present when running "sudo launchctl list | grep -i dasher" before a reboot, but was entirely missing when running the same command after reboot. Installing again would bring it back up, but it would disappear again after the next reboot.

This appears to be due to the way Apple has mucked about with launchd recently.

This fixed it (at least for me):
Move Dasher launchd plist from LaunchAgents to LaunchDaemons
"mv /Library/LaunchAgents/org.dasher.plist /Library/LaunchDaemons"
Load into launchd with new bootstrap command:
"sudo launchctl bootstrap system /Library/LaunchDaemons/org.dasher.plist"

Self-signed SSL certificates

Hi

currently dasher crashes when the config points to URLs that are using self-signed certificates.
A new config option à la "skip-ssl-cert": true would be great.

Thanks for this great project.

EDIT: it does not crash right away, but when the HTTP request is made (ie. the dash button was pressed)

Issues Installing

New to Pi, so this is confusing for me. Can anyone help, this is what I get when running npm install.

pi@magicmirror:~/dasher $ sudo npm run start

[email protected] start /home/pi/dasher
node app.js

warning: SIOCGIFADDR: en0: No such device - this may not actually work
[Error: SIOCGIFHWADDR: No such device]
Failed to create pcap session: couldn't find devices to listen on.
Try running with elevated privileges via 'sudo'
/home/pi/dasher/node_modules/node-dash-button/index.js:28
throw new Error('Error: No devices to listen');
^

Error: Error: No devices to listen
at create_session (/home/pi/dasher/node_modules/node-dash-button/index.js:28:15)
at register (/home/pi/dasher/node_modules/node-dash-button/index.js:47:24)
at new DasherButton (/home/pi/dasher/lib/dasher.js:12:21)
at Object. (/home/pi/dasher/app.js:8:16)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)

npm ERR! Linux 4.4.37-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v4.2.1
npm ERR! npm v4.0.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dasher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/dasher/npm-debug.log
pi@magicmirror:/dasher $ node -v
v4.2.1
pi@magicmirror:
/dasher $ npm -v
4.0.3

Cheapo SSL cert not trusted.

Looks like my 5 buck a year certificate from SSLS.COM is throwing some sort of error when hitting Home-Assistant.

[2016-11-23T20:54:36.146Z] Brooklyn DASH pressed.
[2016-11-23T20:54:36.559Z] there was an error
{ [Error: unable to verify the first certificate] code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
/home/pi/dasher/lib/dasher.js:46
    if (response && response.statusCode < 200 || response.statusCode > 299) {
                                                         ^

TypeError: Cannot read property 'statusCode' of undefined
    at Request.onResponse [as _callback] (/home/pi/dasher/lib/dasher.js:46:58)
    at self.callback (/home/pi/dasher/node_modules/request/request.js:186:22)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at Request.onRequestError (/home/pi/dasher/node_modules/request/request.js:845:8)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at TLSSocket.socketErrorListener (_http_client.js:259:9)
    at emitOne (events.js:77:13)
    at TLSSocket.emit (events.js:169:7)

it looks like this require module might fix the issue for people with broken chains (as in my case).

https://github.com/Daplie/node-ssl-root-cas

Any Shot of incorporating this fix?
Thanks

problem with npm install

I seem to be running into a problem when with setting this up on a raspberry pi 2 with wheezy. Following the readmi, after $ sudo apt-get install libpcap-dev and $ sudo apt-get install npm, I attempt $ npm install but get errors. Any help is appreciated. Thanks!

pi@raspberrypi ~/projects/dasher $ npm install
npm http GET https://registry.npmjs.org/node-dash-button
npm http GET https://registry.npmjs.org/request

npm ERR! Error: failed to fetch from registry: request
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request. (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.g (events.js:156:14)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report this log at:
npm ERR! http://bugs.debian.org/npm
npm ERR! or use
npm ERR! reportbug --attach /home/pi/projects/dasher/npm-debug.log npm
npm ERR!
npm ERR! System Linux 4.4.16-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/projects/dasher
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: request
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/projects/dasher/npm-debug.log
npm not ok

Doesn't start - seems to want to use en0 instead of wlan0

sudo npm run start

[email protected] start /home/pi/dasher
node app.js

warning: SIOCGIFADDR: en0: No such device - this may not actually work
Error: SIOCGIFHWADDR: No such device
at Error (native)
at new PcapSession (/home/pi/dasher/node_modules/pcap/pcap.js:49:39)
at Object.exports.createSession (/home/pi/dasher/node_modules/pcap/pcap.js:123:12)
at create_session (/home/pi/dasher/node_modules/node-dash-button/index.js:24:28)
at register (/home/pi/dasher/node_modules/node-dash-button/index.js:47:24)
at new DasherButton (/home/pi/dasher/lib/dasher.js:12:21)
at Object. (/home/pi/dasher/app.js:8:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
Failed to create pcap session: couldn't find devices to listen on.
Try running with elevated privileges via 'sudo'
/home/pi/dasher/node_modules/node-dash-button/index.js:28
throw new Error('Error: No devices to listen');
^

Error: Error: No devices to listen
at create_session (/home/pi/dasher/node_modules/node-dash-button/index.js:28:15)
at register (/home/pi/dasher/node_modules/node-dash-button/index.js:47:24)
at new DasherButton (/home/pi/dasher/lib/dasher.js:12:21)
at Object. (/home/pi/dasher/app.js:8:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)

npm ERR! Linux 4.1.19v7-aufs
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dasher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/dasher/npm-debug.log
npm-debug.log.txt

Please help...Error with "sudo npm run start". What should I do to fix?

joey@joey-GM5664:$ cd /home/joey/dasher
joey@joey-GM5664:
/dasher$ sudo npm run start

[email protected] start /home/joey/dasher
node app.js

module.js:428
throw err;
^

SyntaxError: /home/joey/dasher/config/config.json: Unexpected token ]
at Object.parse (native)
at Object.Module._extensions..json (module.js:425:27)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/joey/dasher/app.js:2:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)

npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dasher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/joey/dasher/npm-debug.log
joey@joey-GM5664:~/dasher$

Here is the npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 silly lifecycle [email protected]
prestart: no script for prestart, continuing
7 info lifecycle [email protected]start: [email protected]
8 verbose lifecycle [email protected]
start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]start: PATH: /usr/share/npm/bin/node-gyp-bin:/home/joey/dasher/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle [email protected]
start: CWD: /home/joey/dasher
11 silly lifecycle [email protected]start: Args: [ '-c', 'node app.js' ]
12 silly lifecycle [email protected]
start: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: node app.js
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess. (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:821:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid [email protected]
16 verbose cwd /home/joey/dasher
17 error Linux 4.4.0-21-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
19 error node v4.2.6
20 error npm v3.5.2
21 error code ELIFECYCLE
22 error [email protected] start: node app.js
22 error Exit status 1
23 error Failed at the [email protected] start script 'node app.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the dasher package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node app.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs dasher
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls dasher
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Not authenticated

Hello.
I get some error messages:
[2017-02-18T15:27:17.449Z] DashButton1 pressed. Count: 1
[2017-02-18T15:27:17.596Z] Not authenticated
[2017-02-18T15:27:17.597Z] null
[2017-02-18T15:27:17.597Z] Unsuccessful status code
[2017-02-18T15:27:17.598Z] null

I use an Raspberry Pi3 with Pi-Hole and FHEM (Homeautomatik system)
Pi-Hole is configured as an DHCP and DNS server.
I want to use dasher with http push.
I am a linux noob, so anyone can help me ?

sudo npm run start (Error: Cannot find module 'request')

Having an issue with getting dasher to run on my mac mini, any help is appreciated.

From terminal:
Daves-Mac-mini:dasher daveandalyssa$ sudo npm run start
Password:

[email protected] start /Users/daveandalyssa/Applications/dasher
node app.js

module.js:327
throw err;
^

Error: Cannot find module 'request'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/daveandalyssa/Applications/dasher/lib/dasher.js:3:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! This is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dasher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/daveandalyssa/Applications/dasher/npm-debug.log
Daves-Mac-mini:dasher daveandalyssa$

Here is the log file contents:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: node app.js
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /Users/daveandalyssa/Applications/dasher
12 error Darwin 15.6.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
14 error node v4.4.7
15 error npm v2.15.8
16 error code ELIFECYCLE
17 error [email protected] start: node app.js
17 error Exit status 1
18 error Failed at the [email protected] start script 'node app.js'.
18 error This is most likely a problem with the dasher package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node app.js
18 error You can get information on how to open an issue for this project with:
18 error npm bugs dasher
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls dasher
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

Could not start dasher on raspberry pi zero

Hey, everytime I try to start dasher on my pi, it gives me the following error:

npm ERR! Linux 4.4.32+ npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start" npm ERR! node v4.3.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! [email protected] start: node app.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script 'node app.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the dasher package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node app.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs dasher npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls dasher npm ERR! There is likely additional logging output above.

my node version is 4.3.0

any suggestions?

New Pi Zero - Used to run manual, now does not work after trying to get it to auto start

I installed on my new Pi Zero W and when started manually, it would work fine. Even over the wifi. When I disconnect ssh, it would quit working. Understandable as the user logged out.

When I have attempted to set ti up to run via the auto start instructions, it would not run.

Auto Starting

Advanced information on autostarting Dasher on your Raspberry Pi can be found here.

Issue #47 says an issue was fixed in #35 but my limited knowledge says that was incorporated into the code we installed. Where mine is a fresh install, it should already be there.

I tried setting up auto start to the init.d folder with a script and it would not start. Also tried doing it as a service as I found a suggestion for. It would say it was running as a service, but not acting on button presses.

I am not getting a /var/log/dasher.err or /vol/log/dasher.log file created.

How can I get the error logs so I can have something to troubleshoot with?

Can't get it to install on the RPI2.

this is the error log after running npm install

pcap_binding.target.mk:86: recipe for target 'Release/obj.target/pcap_binding/pcap_binding.o' failed
make: *** [Release/obj.target/pcap_binding/pcap_binding.o] Error 1
make: Leaving directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 4.1.6-v7+
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Linux 4.1.6-v7+
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the pcap package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls pcap
npm ERR! There is likely additional logging output above.

Let me know if you need the log file.

Issues on Raspberry Pi

Trying to get this to run on raspberry pi 1 b+, cannot run dasher after using sudo npm run start

Here is my log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: node app.js
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:818:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /home/pi/dasher
12 error Linux 4.1.17+
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
14 error node v4.2.1
15 error npm v2.14.7
16 error code ELIFECYCLE
17 error [email protected] start: node app.js
17 error Exit status 1
18 error Failed at the [email protected] start script 'node app.js'.
18 error This is most likely a problem with the dasher package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node app.js
18 error You can get their info via:
18 error npm owner ls dasher
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

Errors during 'sudo npm run start' on Mac OSX Sierra

I've tried 3 different versions of NodeJS, and still get the same error below;

Any chance this is a known issue?

Adams-MacBook-Pro:dasher adamowen$ sudo npm run start

[email protected] start /Users/adamowen/dasher
node app.js

module.js:440
return process.dlopen(module, path._makeLong(filename));
^

Error: Module version mismatch. Expected 47, got 48.
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (/Users/adamowen/dasher/node_modules/pcap/pcap.js:3:21)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)

npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v5.7.1
npm ERR! npm v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dasher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/adamowen/dasher/npm-debug.log

Errors During 'npm install' in Two Environments

Hey - Thanks for the script. Trying to use, but cannot get working. Have tried setting up in two separate linux environments with same issue. Below is environment, procedure i followed, and results. Any suggestions? Thanks

Environment

  • Raspberry Pi 3 /w Raspbian Installed
  • Connected via ethernet to LAN

I also tried Ubuntu 15.10 inside VM Workstation /w bridged NIC and got similar results

Procedure

  1. Obtained MAC of Dash from router
  2. Ran 'apt-get update' to update source
  3. Installed git, npm, & libpcap-dev without issue
  4. Created SSH key and added to my git account
  5. Ran 'git clone [email protected]:maddox/dasher.git' to clone repo successfully
  6. Ran 'npm install'. Got following echo...
pi@KNCar:~ $ npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/home/pi/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Linux 4.1.19-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! path /home/pi/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/npm-debug.log
npm ERR! not ok code 0

  1. Since it couldn't find package.json, I changed directory to the dasher root (~/dasher) and ran 'npm install' again to get this echo:
pi@KNCar:~/dasher $ npm install
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})

> [email protected] install /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher
> node-gyp rebuild

make: Entering directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher/build'
  CXX(target) Release/obj.target/socketwatcher/socket_watcher.o
In file included from ../socket_watcher.hpp:8:0,
                 from ../socket_watcher.cpp:5:
../../nan/nan.h:324:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
   static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
                                               ^
socketwatcher.target.mk:82: recipe for target 'Release/obj.target/socketwatcher/socket_watcher.o' failed
make: *** [Release/obj.target/socketwatcher/socket_watcher.o] Error 1
make: Leaving directory '/home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.1.19-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/dasher/node_modules/node-dash-button/node_modules/pcap/node_modules/socketwatcher
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the socketwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls socketwatcher
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.1.19-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/dasher
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN engine [email protected]: wanted: {"node":">=0.10.32"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/dasher/npm-debug.log
npm ERR! not ok code 0
  1. Finally, I decided to try to launch it anyways to see what happened so from the root of ~/dasher ran 'sudo npm run start' and got the below:
pi@KNCar:~/dasher $ sudo npm run start

> [email protected] start /home/pi/dasher
> node app.js


module.js:340
    throw err;
          ^
Error: Cannot find module 'node-dash-button'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/pi/dasher/lib/dasher.js:2:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

npm ERR! [email protected] start: `node app.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls dasher
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.1.19-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! cwd /home/pi/dasher
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/dasher/npm-debug.log
npm ERR! not ok code 0

Any suggestions? Am I leaving out a big step? Thanks!

UPDATE
After posting, I went back to the Ubunutu 15 VM. I installed nodejs-legacy then tried again and this time 'npm install' again and this time it completed without errors. I had tried installing it in Raspbian on my RP, but it was already installed and up to date so doesn't help there. Would still much prefer to run on RP so the above post is still valid as all notes come from its installation. Thanks!

UPDATE #2
OK, ok, I spoke too soon...
'npm install' seemed to be successful as I didn't see any error messages. I edited the example config file (below) and then saved it in the same path as config.json. While still in the 'dasher' root, I then ran 'sudo npm run start' - it started! I clicked my dash button and after a few seconds, the terminal flooded with about 20 mesage about EthernetFrame. The trigger from IFTTT never went so I clicked the button again. Almost instantly, I got the echo "undefined press" followed by many lines of echo in the terminal. I quit npm, then tried launching it again but got errors. All of the events described are below followed by my config file...

ben@ubuntu:~/dasher$ sudo npm run start

> [email protected] start /home/ben/dasher
> node app.js

undefined added.
undefined added.
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
node_pcap: EthernetFrame() - Don't know how to decode ethertype 35033
undefined pressed.
there was an error
[Error: SELF_SIGNED_CERT_IN_CHAIN]

/home/ben/dasher/lib/dasher.js:38
    if (response.statusCode === 401) {
                ^
TypeError: Cannot read property 'statusCode' of undefined
    at Request.onResponse [as _callback] (/home/ben/dasher/lib/dasher.js:38:17)
    at self.callback (/home/ben/dasher/node_modules/request/request.js:200:22)
    at Request.EventEmitter.emit (events.js:95:17)
    at Request.onRequestError (/home/ben/dasher/node_modules/request/request.js:831:8)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at CleartextStream.socketErrorListener (http.js:1547:9)
    at CleartextStream.EventEmitter.emit (events.js:95:17)
    at SecurePair.<anonymous> (tls.js:1389:19)
    at SecurePair.EventEmitter.emit (events.js:92:17)
    at SecurePair.maybeInitFinished (tls.js:982:10)

npm ERR! [email protected] start: `node app.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls dasher
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-16-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! cwd /home/ben/dasher
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ben/dasher/npm-debug.log
npm ERR! not ok code 0
ben@ubuntu:~/dasher$ sudo npm run start

> [email protected] start /home/ben/dasher
> node app.js


module.js:485
    throw err;
          ^
SyntaxError: /home/ben/dasher/config/config.json: Unexpected token ]
    at Object.parse (native)
    at Object.Module._extensions..json (module.js:482:27)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/ben/dasher/app.js:2:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

npm ERR! [email protected] start: `node app.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls dasher
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-16-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! cwd /home/ben/dasher
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ben/dasher/npm-debug.log
npm ERR! not ok code 0

My (Edited) config.json file

{"buttons":[
  {
    "address": "mymacaddress",
    "url": "https://maker.ifttt.com/trigger/Notify/with/key/mykey",
    "method": "POST"
  },
]}

Thoughts? Thanks!

Trying to run getting following error

Anyone know whats going on? Thanks


pi@raspberrypi:~/dasher $ sudo npm run start

[email protected] start /home/pi/dasher
node app.js

module.js:453
throw err;
^

SyntaxError: /home/pi/dasher/config/config.json: Unexpected token ]
at Object.parse (native)
at Object.Module._extensions..json (module.js:450:27)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/home/pi/dasher/app.js:2:14)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)

npm ERR! Linux 4.1.13-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! This is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/dasher/npm-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.