Saturday, December 09, 2017

Raspberry Pi, Amazon Dash button hack for LIFX Control

Update: I cleaned and revised the python code, added code for addition lights and multiple lights on 1 button

This is my journey on getting Amazon Dash button to control my LIFX lights with the help of a Raspberry Pi.

It was not as simple as I'd hoped as some of the resources were out of date so I decided to document my journey from scratch. Starting with a clean build on a Raspberry Pi.

The crux of the project is using the Pi to run a python script that continually listens to and intercepts Dash button presses on the Ethernet LAN network.

What you're going to need...


·  LIFX bulb(s)
·  Rasberry Pi with Micro SSD keyboard, screen and power to get started
·  Amazon Button(s)

Software installed on the Pi

·  Pi OS - Raspbian Stretch Lite
·  Python 2
·  PIP for Python 2
·  lifxlan
·  SSH and Putty for network access to the PI
·  Nano or another text editor

To detect the Dash Button Mac Address you'll also need

·  GIT
·  Node.js
·  npm
·  node-dash-button

I started with a clean install on a Raspberry pi 3 running Linux raspberry pi 4.9.59-v7+

So, to get things started I used my Windows 10 PC to install the image onto a micro SD card for the Pi.

I have my Pi connected to my network via Ethernet cable but wireless should be good too on this version. you will need a screen, keyboard and network connection to get started.

First login, set new password


use configure regional settings, connect to wifi and general config setup fo the Pi use

sudo raspi-config

you can also enable SSH remote access to allow control via Putty.

Once connected to the internet, check for updates

sudo apt-get update
sudo apt-get dist-upgrade

Python installation, (Version 2, not version 3)

sudo apt-get install python-picamera
sudo apt-get install python-pip

check version

python --version

use pip to install pip lifxlan

pip install lifxlan

Install scapy

sudo apt-get install python-scapy

That's the base software needed to get things going.  However, there still a bit of work to do to get the hardware MAC addresses of the Dash Buttons, if you're able to get these addresses from your router you can skip these steps.

Get the hardware MAC addresses of the Dash Buttons

I got the details from here

First you'll need to install Node JS

curl -sLS | sudo bash

sudo apt-get install node

Check Version

node -v

Install Node-Dash-Button

sudo apt-get install npm

npm install git

sudo apt-get install libpcap-dev

npm install node-dash-button

Connect the Dash Button to WIFI without Ordering anything

When you get a Dash button, Amazon gives you a list of setup instructions to get going. Just follow these but don’t complete the final step, that is, don’t select the product you want ordered. Via the Amazon App on my phone I just quit the setup at this stage.

Find the Dash Button MAC hardware Address

cd node_modules/node-dash-button

sudo node bin/findbutton

The Python Code

Finding your lights

There is a very useful script from - called

it's a good test that everything we've done so far is working as expected.

This will find each light and tell you everything about it!

Now for the Code

I used nano to create the python script

It's little messy and bastardised from code I saw elsewhere (I'm not a coder), the main problem with was the newer version of python-scapy not liking RAW mode. The orignal code source can be found here.


Save the File (Ctrl+x)

change file permissions for the script to ensure it's executable

chmod +x

Run the Code

sudo python

Run the code after a reboot and at start-up

crontab -e

add the following 

@reboot sudo python /home/pi/ &

(Ctrl X to close and save)


My code differs slightly from that listed above as my first room has 2 bulbs, so I needed a bit of extra code that determined if either of the lights were on or off and then do the opposite i.e. turn them both off or both on.


Monday, August 08, 2016

Google Chrome & SSD 'waiting for Cache' system lockups

I have for a very long time suffered on my home PC with this extremely frustrating problem in Google Chrome.

Every so often my frustrations motivated me to  try to resolve the problem, I failed each time, gave up, waited a few months and then tried again.

The common factor seemed to be those of us with SSDs.

First I had cloned my old OS drive to the new SSD, so there was that to consider. But a clean install of Windows 10 didn't solve it.

I removed all the plugins, failed.

I switched to x64 installation of the Chrome. No Luck.

Checked trim settings. Nope.

Then last week I applied the Windows 10 anniversary update. This then started with a similar ~30 system lockup soon after boot time.

A look through the system and application logs showed errors with access to webache log timing out and complaining of a hardware fault as the cause.

A few Googles trying to find a solution and I stumbled upon the Eureka moment.

My system, the Motherboard, to be more precise still had my SATA connections set to IDE mode!

Of course you can't just change to AHCI as Windows will fail to boot. Thankfully there is a simple fix for that here.

Since this change, I've not had the problem and Chrome has in 3 days so far not locked up with 'waiting for cache' issue!

Wednesday, June 22, 2016

SCCM 2012 R2 PXE boot HP Zbook 15u G3 - reboot fix

Standard boot of PXE (x64 image) was failing. After initially connecting, I got a brief "Preparing Network Connections" before it rebooted.

The driver pack for this Laptop does not contain the required drivers for PXE!
It's the one listed here
Useful to download and inject the drivers into your build image, but useless for the PXE boot requirement.

1. Download and unpack the latest drivers direct from Intel. I used this link for the I219-LM driver.

Extract the drivers and import into SCCM via the usual method.

Select all the NDIS64 drivers and import to your Boot x64 boot image.

Update distribution point if you didn't tick the option when running the import driver wizard.

Monday, May 23, 2016

New Android Device (6P) migration of Data and Apps from a Nexus 5, a horror story

So the battery life on my Nexus 5 was getting shitty, then my wife dropped hers and smashed the screen. So we a decent excuse for new phones, I ordered myself a 6P and a nice 5X for the troubleandstrife.

New phone arrived, yay!

Right, let's see how I get all my apps and settings moved across?
  1. login to new device with google ID... All the google apps install and start syncing no problem.
  2. What about my other apps? Nothing... What about those App settings...? No idea. search search search
  3. There's an App for that. 'Carbon' from Clockwork mod. Download, installs, all ready - doesn't work. Something about desktop backup password needing to be blank, it was - still wouldn't play ball. Boo!
  4. other apps? found none
  5. Google's 'setup nearby device' option. the 2 devices just simply won't see each other
  • NFC nope, makes a nice sound but nothing happens after pressing the Beam option
  • Bluetooth, switch on, phones see each other in Bluetooth, but not in this service/option/app
  • WIFI - both are connected to the same SSID/LAN... nothing happens
  • Quiet simply the 2 devices seem unable to talk to each other at all in any meaningful way at all!
What a monumentally frustrating and fruitless waste of 4+ hours of my life.

After giving up, having a coffee, some deep breathing... I decided to factory reset the 6P.

second time around (maybe since I'd performed an OS upgrade) I got the option to transfer from another device...

this time the 2 devices found each is seconds, entered my Google password when prompted and the restoration to the new device has begun! Yay!?

So far it looks like, wallpaper, apps, app setup are all restoring rather nicely...

Friday, December 05, 2008

My leatherman finally broke

My trusty, awesome Leatherman finally broke today.

10 Years!! 10 years are great, perfect service but alas she's gotten old and brittle. The small screwdriver head fracture and the tip broke off :(.

I won't be replacing her any time soon, damned things are expensive and at £70 she's done great service and all the other bits work. I guess I do use her almost on a daily basis, even at work. In fact she broke while doing something for work, I guess I can try and get my boss/work to pay for replacement... worth a try.

Tuesday, April 22, 2008

My Wii Remote Demo

Here is my youtube Video of me playing with my Wii Whiteboard.

That's my homemade Wii Pen.

The Laptop is an HP nc8430 Running Ubuntu 8.04 (Hardy Heron) Release Candidate and Wii Whiteboard 0.3.3. Most of the Compiz Fusion Eye candy is enabled.

Laptop screen resolution is 1680*1050.

The initial picture in the background is some of my doodling and some drawings from the 4 year old son.
He asks me every day now to draw on the computa!

Monday, April 21, 2008

Wii Remote Whiteboard pen

I was totally amazed when I saw Johhny Lee's demonstration of the things he's been able to do by hacking the wii remote. I first saw it at

He also has some video's demoing his stuff on youtube. His project site can be found here.

Truly amazing stuff, but most importantly accessible at very low cost to everyone who wants to give it a whirl. So that's what I've decided to do. Luckily there are a ton of people out there who have already tried this and I found a number of useful youtube videos of people showing how they built their devices.

The whiteboard pen is simple enough and has the best practical use with the wii Whiteboard.

My first test was to get the wii remote connected to my laptop via bluetooth. I managed to do this simply enough by enabling bluetooth on my laptop and booting into my Ubuntu Hardy Heron RC (8.04) installation. I then downloaded and installed the wii whiteboard software from here.

I got it connected by simply running the wii whiteboard software, which detect the wii remote after 1&2 button press on the remote to get them synchronised. Then a crack at the calibration. I had to use the wii sensor bar as my infra-red pen. It took a bit of trial and error but it definitely worked. A proof of concept if you will. So I was ready to spend some time and money on this little project.

I started digging around and found I could source all of the required components from a local Maplins in the UK.

However after a bit of scrummaging around I managed to find an old remote which I took the infra-red LED out of.
I found a suitable pen case in a highlighter pen (thanks kids).

The only thing I really needed was a suitable push-to-make switch. I could have easily gotten one out of an old mouse but had unfortunately thrown my old mouse away a few weeks ago. So after a quick trip to Maplins I had my switch. I also purchased single battery cases for a AAA & AA battery. The AAA housing fits perfectly in the highlighter pen housing. Total Cost £1.72.

The most expensive bit of this whole project so far has been the Soldering Iron and Solder - grand total £14.

So a little over 90 mins later I had myself a fully functional infra-red LED pen that looks something like this...

The most difficult and time consuming bit was the soldering and putting it all together. Making sure the was enough space and wiring to allow all the bits to connect together and then all cram together inside the pen casing. So after cutting 2 holes to accommodate the switch (a large whole to allow the whole device to slip inside the case and a smaller for the button to protrude through).

I then used my mini tripod for the digital camera to mount the wii remote in a favourable steady position pointing at the laptop screen. Again no extra cost, I had some spare Velcro cable management strips left over from the my new PC case, which I used to secure the remote onto the handle of the tripod.

I've made a video of my and my 4 year old son playing with it, I just need to do a bit of editing before uploading. Watch this space.

I now need to source a Ubuntu Linux compatible USB 2.0 bluetooth dongle for my desktop PC, so I can get this working on the 22" Samsung - Yeah baby!

Oh and finally, a BIG thank you to Johhny Lee!