lifx_dash
- Toggle LIFX lights with an Amazon Dash button
lifx_dash
monitor
-m DASH_MAC_ADDRESS -t LIFX_API_TOKEN
lifx_dash
snoop
lifx_dash
config
lifx_dash is a simple command-line tool to monitor your network for Amazon
Dash button presses and toggle LIFX lights ON and OFF. The tool provides two
commands, monitor
and snoop
.
Use snoop
to listen for Dash presses on your network, and identify the
button's MAC address.
Use monitor
(with a MAC address and LIFX HTTP API token) to respond to
presses, and toggle your lights ON and OFF. You can optionally pass a bulb
selector, or choose to daemonize the monitor
process.
A config
command also exists, allowing you to set default options for
monitor
and snoop
.
lifx_dash
requires at least one LIFX bulb, and any Amazon Dash button. You
will also need a wifi network and root access to sniff packets on your network
adaptor.
Follow Amazon's Dash button setup steps, but stop before choosing a product to purchase. Pressing the button should pulse white while connecting to wi-fi, then flash orange. If necessary, you can factory reset your button and start the setup from scratch.
You will also need a free LIFX API token from here: https://cloud.lifx.com/settings
The snoop command has one optional flag - the network interface to listen on.
-i
, --iface=arg
: Network Interface (default: en0)The monitor
command accepts the following flags, both a mac address and api
token are required.
-m
, --mac-address=arg
: Dash button MAC Address (required)-t
, --token=arg
: LIFX HTTP API Token (required)-s
, --selector=arg
: LIFX Bulb Selector (default: all)-i
, --iface=arg
: Network Interface (default: en0)-d
, --[no-]daemonize
: Dameonize the monitor process (default: no)-l
, --log-file
: Log file location (when running as a daemon) (default: /tmp/lifx_dash.log)Get help on command options and arguments
$ lifx_dash -h
$ lifx_dash monitor -h
$ lifx_dash snoop --help
Snoop for Dash button presses on en1
$ lifx_dash snoop en1
Monitor Dash button presses on en0 with DASH_MAC_ADDRESS and LIFX_API_TOKEN, when pressed, toggle all lights
$ lifx_dash monitor -t LIFX_API_TOKEN -m DASH_MAC_ADDRESS
Monitor Dash button presses on en1 with a DASH_MAC_ADDRESS and LIFX_API_TOKEN, when pressed toggle the light with id 'd3b2f2d97459'
$ lifx_dash monitor --token=LIFX_API_TOKEN --mac-address=DASH_MAC_ADDRESS -s 'd3b2f2d97459' -i en1
Show the current configuration file options
$ lifx_dash config -s
Use the config
command to set values for the command options. These will be
saved to: ~/.lifx_dash.rc.yml and used as defaults. They can still be overridden
by any arguments passed on the command line.
If running as a daemon (-d switch), the lifx_dash monitor
command will log to
/tmp/lifx_dash.log
by default. Use the --log-file flag to override this.
No known bugs. Please report issues here: https://github.com/matthutchinson/lifx_dash/issues
The MIT License: https://raw.githubusercontent.com/matthutchinson/lifx_dash/master/LICENSE.txt
Copyright (c) 2016 Matthew Hutchinson
Matthew Hutchinson, https://matthewhutchinson.net