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

Nora – Google Assistant in NodeRED

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

DIY Smart Washing Machine – for about 15 bucks!

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

Sonoff Zigbee Bridge – review

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

Smart Home

Remotes aren’t done with us yet: SwitchBot Remote

0
If you hate having 20 remotes hidden in your sofa, or your parents despise talking to Alexa to turn the lights on - SwitchBot Universal Remote is here to deal with all this!

We’ve seen this before: SwitchBot K10+ PRO

0
This is an odd one. Building on the success of SwitchBot K10+ they released SwitchBot K10+ PRO - but is the experience actually better?

Is this the smart panel we have waited for?

0
ITEAD has released a new smart panel: Sonoff NSPanel Pro 120 - have they learned the lesson from the terrible launch of the original Pro? Let's see what's new.

Aqara FP1E detects motionless humans

0
This isn't exactly a new device, it's an interaction of the original Aqara presence sensor. Aqara FP1E brings Matter, ZigBee and new triggers to your smart home

SwitchBot S10: cleaning re-imagined!

0
SwitchBot S10 promises unattended vacuuming and mopping so you can focus on things you love and care for. Does it deliver?