HomeRaspberry PiMake a Amazon Dash security sensor

Make a Amazon Dash security sensor

Amazon Dash buttons are not only for ordering.

This is probably the last Amazon Dash hack I can come up with. The previous one – Wireless Doorbell was a great success and I’m still using it whenever I’m awaiting a delivery. If you have not seen that one yet, go and take a look. We are going to build on it.  With that in mind, I’d like to introduce the Amazon Dash security sensor.

Amazon Dash Security Sensor

Before we start, I’d like to point out that ‘security sensor’ should be taken with a pinch of salt, as most often than not, the DIY solutions don’t come close professional installation. You can read more about the biggest pitfalls of home-made security systems here.

The warning has been issued, I can jump straight to the meat of things. Turns out that you can replace the button with a simple reed switch. This eliminates the need for pressing the button to activate the Amazon Dash security sensor. A magnetic field will do this for you. The same behaviour is used in professional alarms. The reed switches are placed near the point of entrance to enable the door/window monitoring. A magnet or an electromagnetic field is used to activate the switch and close the circuit.

Reed switches come in 2 flavors:

  • NO – Normally Open: the switch remains open until magnetic field is applied
  • NC – Normally Closed: just the opposite

For this hack, we are using the NO reed switch. When a magnet comes close enough to the switch, out Amazon Dash security sensor with register this as a button press.

Limitations

Because this is a hack, it comes with a few limitations. If you can live with it, this hack could be for you:

  • no ‘low battery’ indicator
  • the switch can be activated once every 10 sec
  • the switch cannot stay in ‘on’ position for more than 4 sec
  • the specific position of the magnet

The Amazon Dash’s battery is pretty good. I still have my 1st generation buttons (from 2 years ago) and they work just fine. Just bear in mind, that you should test the battery once a while.

The cooldown for the button is about 10 sec. There is no way around it. I’m ok with it, as my alarm will only trigger once before it has to be reset.

Amazon Dash security sensor

If the button is held in ‘pressed down for about 6sec – Amazon Dash enters the pairing mode. All the examples shown by me are not affected by this. It’s just something for you to keep in mind. This also means that the button is activated by a sliding motion of the magnet. 

Lastly, the magnet should pass the reed sensor rather than stay in the vicinity of the reed switch, otherwise, the Amazon Dash security sensor will enter the pairing mode.

Amazon Dash Security Sensor – hardware mod

Despite having screws, buttons are not meant to be taken apart, but once disassembled, you will be able to glue them back together. There are no latches that can close the enclosure once opened.

I’m going to add the reed switch to both terminals of the button. This is labeled on the picture below. When the reed switch is activated the Amazon Dash will think that you have pressed the button.

Due to the size of the wire used in my case, I was unable to put the button part back together. While it doesn’t bother me that much, it may be a limiting factor for you. If you have a very thin, isolated wire, with good soldering skills you could assemble it all together and make the button usable as well.

I used a hot needle to pierce the enclosure and slot the reed pins inside. It connects to the button pins inside via cable. I had to use a hot screwdriver to make some extra space in the plastic enclosure for the wires. In theory, you could enclose the switch inside (it looks like there is enough space, but I found it much easier to align the sensor and the magnet when the sensor is visible).

Put back the newly created Amazon Dash security sensor. You can use glue, or piece of the isolating tape to keep the enclosure together.

Software

If this is your first hack, please see the Wireless Doorbell tutorial to set up the Amazon Dash buttons and connect Raspberry Pi to a mobile via AutoRemote.

The script has been simplified. It’s launched via AutoRemote and sends the notification back that the script is running. When the button activates, another notification is sent. A few seconds later the script terminates.

The notification will be sent only once.

Amazon Dash requires:
pip3 install scapy-python3
 
********************"""

from scapy.all import *
import urllib.request
from sys import exit

url_mobile = 'https://autoremotejoaomgcd.appspot.com/sendmessage?key=YOUR_KEY&message=alarm=:=BUTTON_NAME=:=warning'

def confirmation():
	mobile = 'https://autoremotejoaomgcd.appspot.com/sendmessage?key=YOUR_KEY&message=alarm=:=BUTTON_NAME=:=set'
	response = urllib.request.urlopen(mobile).read()
	
confirmation()

def arp_display(pkt):
	if pkt[ARP].op == 1:
		if pkt[ARP].hwsrc == 'Amazon Dash MAC': #Your button MAC
			response = urllib.request.urlopen(url_mobile).read()
			exit(5)
print (sniff(prn=arp_display, filter="arp", store=0, count=0))

The setup is very simple. There are two profiles, one to handle the alarm message and one to take care of the resetting the script.

TASKER PROFILE: Alarm
Profile: Alarm 
	Event: AutoRemote [ Configuration:alarm ]
Enter: Alarm! 
	A1: Flash [ Text:Alarm set Long:On ] If [ %arcomm2 ~ set ]
	A2: Vibrate [ Time:736 ] 
	A3: Notify [ Title:Alarm! Text:Garage door has been opened! 
            Icon:mw_alert_error_outline Number:0 Permanent:Off 
            Priority:1 Actions:(1) ] If [ %arcomm2 ~ warning ]

Alarm profile – responds to the ‘alarm’ AutoRemote message. If the AR message contains ‘set’ as %arcomm2 – a short confirmation is displayed. If the AR message says  %arcomm2 = ‘warning’ a notification is issued with an option to reset it.

The reset is handled by an AutoApps command ‘alarm=:=reset’ .

TASKER PROFILE: Alarm Reset
Profile: Alarm Reset 
	Event: AutoApps Command [ Configuration:Command Filter: alarm=:=reset ]
Enter: Reset Alarm 
	A1: Notify Cancel [ Title:Alarm! Warn Not Exist:Off ] 
	A2: AutoTools SSH [ Configuration:Server: YOUR IP
Port: 22
Username: pi
Password: *******
Command: sudo python3 /PathtoFile/DashSecurity.py
Command Variable: atsshresult Timeout (Seconds):60 ] 

The reset profile responds to AutoApp command ‘alarm=:=reset’. A notification is canceled when the message is received. I can use the linked task Alarm to create a shortcut as well. This way I can arm the alarm directly from the phone’s home screen.

You can use AutoTools SSH (or AutoRemote) to issue a resetting command to the Raspberry Pi. In both cases the command should be:

sudo python3 /path/to/file/script.py

It’s worth noting that the message issued by the SecuritySensor script has the following structure:

alarm=:=button_name=:=command

This way you can assign multiple buttons to your notifications.

Conclusion

I hope you enjoyed this little hack and you come up with some fantastic usage. I’m going to use mine for letterbox notifications and the garage door sensor. There is no way I will open and close this thing in less than 10 seconds 🙂

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

Tuya SDK for beginners: Intro to Tuya Cloud API

0
Working with Tuya Cloud API. A guide to Cloud automation for beginners, get started with REST!

NEST your old thermostat under $5

0
Nest-ing up your older thermostat under $5

Sonoff Zigbee Bridge – review

0
Sonoff line up will soon include Sonoff Zigbee Bridge and more Zigbee sensors - here is the first look

DIY Smart Washing Machine – for about 15 bucks!

0
Learn how to add washing machine notifications to your Google Home on the cheap

Nora – Google Assistant in NodeRED

0
Integrate Google Assistant with NodeRED thanks to Nora - NodeRED home automation

Smart Home

Multi-lights for your ceiling from Aqara

0
This is the biggest light I held in my hands so far. It's ZigBee and it comes from Aqara - meet Aqara Ceiling Light T1M

Almost the fastest PIR sensor you can buy

0
ITEAD introduced a new ZigBee sensor - Sonoff PIR (SNZB-03P) which is also the fastest PIR sensor in their line up. Is it good? Read more!

Smart Panel automation by Tuya

0
I'm checking out two smart panels by Tuya. Both run Linux systems, fit inside the wall switch cavity and offer a range of automation options

Adding Matter to Sonoff BasicR4

0
Sonoff goes back to basics with Sonoff BasciR4 - a new and improved basic smart relay - and I'm about to add Matter to it (and Tasmota)

Sonoff Presence Sensor (SNZB-06P) is not what you think

0
This mm wave radar sensor combines cool tech and ZigBee 3.0, but it's not what you think it is. Closer look at Sonoff Presence Sensor