{"id":20576612,"url":"https://github.com/hobbyquaker/dashbutton2mqtt","last_synced_at":"2025-04-14T18:22:27.544Z","repository":{"id":149126649,"uuid":"67301213","full_name":"hobbyquaker/dashbutton2mqtt","owner":"hobbyquaker","description":"Publish dash button presses to a MQTT broker 🔘📡","archived":false,"fork":false,"pushed_at":"2018-01-05T09:54:15.000Z","size":16,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T06:51:10.541Z","etag":null,"topics":["dashbutton","mqtt","smarthome"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hobbyquaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-03T16:52:29.000Z","updated_at":"2020-12-09T04:29:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ae104b1-ee7e-4272-9bd4-8316567cd3b0","html_url":"https://github.com/hobbyquaker/dashbutton2mqtt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fdashbutton2mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fdashbutton2mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fdashbutton2mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fdashbutton2mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hobbyquaker","download_url":"https://codeload.github.com/hobbyquaker/dashbutton2mqtt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933591,"owners_count":21185508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dashbutton","mqtt","smarthome"],"created_at":"2024-11-16T05:46:22.504Z","updated_at":"2025-04-14T18:22:27.490Z","avatar_url":"https://github.com/hobbyquaker.png","language":"JavaScript","funding_links":[],"categories":["Interfaces"],"sub_categories":["Misc"],"readme":"# dashbutton2mqtt\n\n[![mqtt-smarthome](https://img.shields.io/badge/mqtt-smarthome-blue.svg)](https://github.com/mqtt-smarthome/mqtt-smarthome)\n[![NPM version](https://badge.fury.io/js/dashbutton2mqtt.svg)](http://badge.fury.io/js/dashbutton2mqtt)\n[![Dependency Status](https://img.shields.io/gemnasium/hobbyquaker/dashbutton2mqtt.svg?maxAge=2592000)](https://gemnasium.com/github.com/hobbyquaker/dashbutton2mqtt)\n[![Build Status](https://travis-ci.org/hobbyquaker/dashbutton2mqtt.svg?branch=master)](https://travis-ci.org/hobbyquaker/dashbutton2mqtt)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![License][mit-badge]][mit-url]\n\n\u003e Publish dash button presses to a MQTT broker. 🔘📡\n\nBased on [node-dash-button](https://github.com/hortinstein/node-dash-button) by \n[Alex Hortin](https://github.com/hortinstein) - all credits belong to him.\n\n\n## Getting started\n\nTested on macOS and Linux. If you're running on Linux you have to install libpcap-dev:\n\n* Ubuntu, Debian, Raspbian, ... `$ sudo apt-get install libpcap-dev`\n* Fedora, CentOS `$ sudo yum install libpcap-devel`\n\n#### Install\n\nPrerequisite: Node.js version 6.0 or above. I suggest to use https://github.com/tj/n to install a recent version of \nNode.js.\n\n`$ sudo npm install -g dashbutton2mqtt`\n\n\n#### Find dash buttons\n\n`$ sudo dashbutton2mqtt --scan`\n\nThe scan shows only MAC Addresses that are known to be registered by Amazon. If you want to see all detected addresses\nadd the option `-v debug`.\n\n\n#### Create a JSON mapping file\n\nCreate a JSON file that maps dash button mac addresses to MQTT topics and payloads. \n\nExample:\n```json\n{\n    \"50:f5:da:60:20:10\": {\n        \"topic\": \"dashbutton/foo\"\n    },\n    \"50:f5:da:60:20:11\": {\n        \"topic\": \"dashbutton/bar\",\n        \"payload\": \"press\"\n    }\n}\n```\n\nIf you omit the payload attribute an empty string will be published.\n\n\n#### Start \n\n`$ sudo dashbutton2mqtt -m /path/to/mapping.json`\n\n\n## Caveats\n\n* Since node-dash-button uses libpcap to scan for dash button arp packets this tool must be run with superuser.\n* This tool has to be executed on a host that is connected to the same wifi network as the dash buttons.\n* Due to the nature of the dash buttons there will be a latency of ~4 seconds between a button press and the MQTT \npublish.\n* As long as the LED of the dash button is blinking you can't do further button presses.\n\n\n## Binding To Specific Network Interface \n\nBy default this tool binds to the first network interface. To bind to a specific interface, such as `eth1`, pass the \nname of the interface with the `--interface` option.\n\n\n## Adjusting the Timeout \n\nIf multiple presses are detected you can increase the timeout between presses. Default is 5000ms, depending on your\nnetwork this may not be enough, you can set a higher timeout with the `--timeout` option.\n\n\n## Command line options\n\n``` \nUsage: dashbutton2mqtt [options]\n\nOptions:\n  -v, --verbosity  possible values: \"error\", \"warn\", \"info\", \"debug\"\n                                                               [default: \"info\"]\n  -s, --scan       scan for dash buttons\n  -m, --mapping    json file containing dashbutton-mqtt mappings (see Readme)\n         [default: \"/Users/basti/WebstormProjects/dashbutton2mqtt/example.json\"]\n  -n, --name       instance name. used as mqtt client id and as prefix for\n                   connection topic                      [default: \"dashbutton\"]\n  -u, --url        mqtt broker url. See\n                   https://github.com/mqttjs/MQTT.js#connect-using-a-url\n                                                   [default: \"mqtt://127.0.0.1\"]\n  -i, --interface  bind to network interface to listen for dash button presses\n                                                                 [default: null]\n  -p, --protocol   protocol to use for button detection. possible values: \"arp\",\n                   \"udp\", \"all\"                                 [default: \"all\"]\n  -t, --timeout    timeout between button presses.               [default: 5000]\n  -h, --help       Show help                                           [boolean]\n  --version        Show version number                                 [boolean]\n```\n\n## Run as service\n\nI suggest [PM2](https://github.com/Unitech/pm2) to run _dashbutton2mqtt_ in the background and start on system boot.\n\n\n## Contributions\n  \nPull requests welcome! 😀\n\n\n## License\n\nMIT © [Sebastian Raff](https://github.com/hobbyquaker)\n\n[mit-badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat\n[mit-url]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobbyquaker%2Fdashbutton2mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhobbyquaker%2Fdashbutton2mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobbyquaker%2Fdashbutton2mqtt/lists"}