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 would get the bitter of me and I'd 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 clear 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 should access to webache log file that was 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 Windows 10 problem and re-appear 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 fir 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...

Saturday, January 16, 2016

Microsoft's new rough-shod pushing of their 'services' whether you want it or like it

First we have IE 11 being pushed to corporate customers whether they are ready for it or not.

Now we have Windows 10 doing the same.

For no reason at all after the latest update my home Windows 10 install has forgotten the Google Chrome is my default browser OF CHOICE.

What a great way to both annoy your home user base and your corporate customers all in the same week.

Sunday, January 26, 2014

Kodak Support: How it should be done

A totally positive support experience from Kodak, on a Sunday! All I can say is bravo and I am very impressed in these dark time of poor customer service this sort of experience is not only too infrequent but compels me to tell you why.

My cheap Kodak Hero 5.1 required a Black Ink replacement. After install the new one this afternoon the printer kept coming back with an error stating error 5313 : "Printhead loose, missing or not installed correctly".

After removing and replacing he relevant bits a few time and power it it off and on again it was time to consult Google.

The first result took my to the relevant Kodak Support Page.

At the Bottom it states... If the error Continues - Contact Us.

This gave me the option to do an online support session with someone. I wasn't too hopeful at this point, 17:00 on a Sunday evening. But after a brief wait, under a minute, I was talking to a support rep. Turns out I was connected to US/Canada Support but they quick transferred me to a UK rep.

Purchase date/time was asked for but this not to hand, but after providing a Serial number for the device we were on our way. We did the obvious and ran through the procedure of removing/replacing and then power the printer off/on again.

I have to admit, at this point I was prepared for bad news, then this was the response I got.

It's determined that a printhead replacement will fix the issue. Now the normal printhead costs £16.99. However as you are a valuable customer to Kodak, as a goodwill gesture we will provide you with the print head absolutely free of charge. 
 Amazing! No hoops to jump through at all. Right there I provided my delivery details and within minutes I had email confirmation that the replacement part would be with me in 3-7 days.

Well done Kodak.

Sunday, October 20, 2013

Garry's Mod,Steam, Nvidia and Windows 8.1 game launches to Blank Screen

So after upgrading from Windows 8 to Windows 8.1 a few days ago there were some teething problems.

As the Post heading suggests Garry's Mod and other Half-Life 2 engined games were launching to blank screens.

First thing I did was check the integrity of the local game content. This didn't work.

I cleared the game config files to make sure there were no rogue gfx display settings. This didn't work.

Then I re-installed the Nvidia drivers and it worked!