Capture Amazon Dash button press

I’m using dasher: https://github.com/maddox/dasher
Since I am using docker containers, I run dasher in a container using this: https://github.com/clemenstyp/dasher-docker

Dasher calls the HA API.
E.g this is from the readme config:

 {
    "name": "Party Time",
    "address": "d8:02:dc:98:63:49",
    "url": "http://192.168.1.55:8123/api/services/scene/turn_on",
    "method": "POST",
    "headers": {"authorization": "your_password"},
    "json": true,
    "body": {"entity_id": "scene.party_time"}
  },

This is my dasher config:

{"buttons":[
  {
    "name": "Lounge Lights",
    "address": "mac address of button 1",
    "interface": "ens160",
    "url": "http://ubuntudocker:8123/api/services/light/toggle",
    "method": "POST",
    "headers": {"x-ha-access": "mypassword"},
    "json": true,
    "body": {"entity_id": "light.living_room"}
  },
  {
    "name": "Downstairs Lights",
    "address": "mac address of button 2",
    "interface": "ens160",
    "url": "http://ubuntudocker:8123/api/services/light/turn_off",
    "method": "POST",
    "headers": {"x-ha-access": "mypassword"},
    "json": true,
    "body": {"entity_id": "group.downstairs_switches"}
  },
  {
    "name": "Downstairs Switches",
    "address": "mac address of button 3",
    "interface": "ens160",
    "url": "http://ubuntudocker:8123/api/services/switch/turn_off",
    "method": "POST",
    "headers": {"x-ha-access": "mypassword"},
    "json": true,
    "body": {"entity_id": "group.downstairs_switches"}
  }
]}

Whilst I have left the dash buttons I configured in place, I am using xiaomi buttons elusively going forward due to:

  1. they respond immediately
  2. they are natively supported in HA (no need to configure API calls)
  3. they have multiple events (click, double click etc)
2 Likes

yeah, and they do not cost much more

I just use device_tracker / nmap to see when the mac address appears. Has been working great so far, just be sure your scan_interval is low enough (4 seconds should do it). I set consider_home to 30 seconds and added a wrapper template sensor to change the home/not_home to on/off.

2 Likes

It gets better - if you configure your router to block outbound traffic from the Dash (very easy to do on dd-wrt), you avoid pinging Amazon altogether AND your Dash stays on longer since it doesn’t get a responding confirmation. I’m at 100% reliability with a 8 second scan interval. Sure, I’ll probably now have to replace the AAA Dash battery after 2 years instead of 4, but that’s a small price to pay for a reliable smart button…I’m about to pickup 12 of these buttons for $20.

Here is a $3 smart doorbell:

Find your Dash in Device Tracker:

amazon_dash_1:
  mac: XX:XX:XX:XX:XX:XX
  name: "Amazon Dash 1"
  track: True
  vendor: Amazon Technologies Inc.
  consider_home: 00:00:10

Clean up the sensor formatting:

binary_sensor:
  - platform: template
    sensors:
      doorbell:
        friendly_name: "Doorbell"
        value_template: "{{ is_state('device_tracker.amazon_dash_1', 'home') }}"
        entity_id: device_tracker.amazon_dash_1

Automate a notification when pressed…

automation:
  - alias: Notify Doorbell Ring
    trigger:
      platform: state
      entity_id: binary_sensor.doorbell
      to: 'on'
    action:
      service: notify.all
      data:
        message: "Doorbell - someone at front door!"
        data:
          push:
            badge: 5
            category: "DOORLOCK" # This is configured with 2 options sent to IOS: unlock door or ignore
ios:
  push:
    categories:
      - name: DoorLock
        identifier: 'DOORLOCK'
        actions:
          - identifier: 'UNLOCK'
            title: 'Unlock Door'
            activationMode: 'background'
            authenticationRequired: yes #-require iphone password to unlock door
          - identifier: 'IGNORE'
            title: 'Ignore'
            activationMode: 'background'
            authenticationRequired: no

And if I press unlock when I get the notification…

- alias: Unlock Door from Doorbell Notification
  hide_entity: True
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: UNLOCK
  action:
    - service: lock.unlock
      entity_id: lock.front_door_lock

Now to find a cheap way to capture an image of the person at the door…

6 Likes

Hi, are you able to specify which Xiaomi button you use?

I’d really like to do this myself.

Thanks in advance.

Hi,

I’m using these:
http://www.gearbest.com/smart-light-bulb/pp_257679.html

You also need to have a Xiaomi gateway like this:
http://www.gearbest.com/living-appliances/pp_344667.html

There is a new version of the switch just released, too:
http://www.gearbest.com/access-control/pp_626695.html

However the gateway does not yet support it. I assume support will come in the near future since the switch is available to buy.

For (much) more info take a look at the xiaomi thread - Xiaomi Gateway Integration

Hi!
Just in case you are interested: I have recently created a repository with a Hass.io addon to detect Amazon Dash buttons via ARP in python3, it is called Dasshio.

It is just a python script with all de add-on config, but it integrates well with hass.io making its use very straightforward.

I am currently testing it though, so any contribution or help is highly apreciated. :smile:

2 Likes

Just wondering, does this still have that delay when pressing the button?
Like what BRUH demo’d in his video from last year?

The delay is the Achilles heel of the Dash buttons

2 Likes

I see, bought a few anyway since it was on sale for 99 cents

1 Like

Yes, delay is from 2 to 5 or 6 seconds. It depends on the number of devices connected to your router.
I will use dash buttons only to setup scenes, arm alarms, change status… But not for tasks requiring an immediate response.

Here you can see the first test using Dasshio with Home Assistant: https://www.youtube.com/watch?v=FehZQiWFkHk

I’ll try to make a setup video soon and open a new Topic in the forum :smiley:

3 Likes

Delay in your vid looked perfectly acceptable for most things.

Would like to try this but need to get my head around Hass.io first, might need to wait for an idiot’s guide.

This is very cool. When I tried to replicate - I am seeing the the dash continuously toggle between home and away:

11:33 PM    Doorbell turned on
11:33 PM    Amazon Dash 1 is at home
11:33 PM    Doorbell turned off
11:33 PM    Amazon Dash 1 is away
11:33 PM    Doorbell turned on
11:33 PM    Amazon Dash 1 is at home
11:33 PM    Doorbell turned off
11:33 PM    Amazon Dash 1 is away
11:32 PM    Doorbell turned on
11:32 PM    Amazon Dash 1 is at home
11:32 PM    Doorbell turned off
11:32 PM    Amazon Dash 1 is away
11:32 PM    Doorbell turned on
11:32 PM    Amazon Dash 1 is at home
11:32 PM    Doorbell turned off
11:32 PM    Amazon Dash 1 is away
11:32 PM    Doorbell turned on
11:32 PM    Amazon Dash 1 is at home
11:32 PM    Doorbell turned off
11:32 PM    Amazon Dash 1 is away
11:31 PM    Doorbell turned on
11:31 PM    Amazon Dash 1 is at home
11:31 PM    Doorbell turned off

My device_tracker setup:

- platform: nmap_tracker
  interval_seconds: 8
  hosts: 192.168.1.1/24

My dash in known_devices:

amazon_dash_1:
  mac: 88:71:E5:87:C1:CE
  name: "Amazon Dash 1"
  track: true
  vendor: Amazon Technologies Inc.
  consider_home: 00:00:10

Thanks for sharing this!

Tom

They’re effectively free as you get a discount equivalent to what you paid, on Prime days you’re actually in profit!

That is how it will work with DHCP given that HA considers it home only for 10 seconds, but your router typically has a longer lease. So, the router considers it home for much longer.

Hi @danimtb, now got hass.io working so trying Dashio. It installed fine but I’m a bit lost with the options. My best guess which doesn’t work is this…

{
  "buttons": [
    {
      "name": "Butty",
      "address": "XX:XX:XX:XX:XX:XX",
      "url": "http://XXX:XXX:X:XXX:8123/api/services/script/turn_on?api_password=XXXXXXXXXX“,
      "headers": "{'method': 'POST'}",
      "body": "{'entity_id': 'script.all_off'}"
    }
  ]
}

Can you point me in the right direction please?

Hi @Bobby_Nobble,

I’m sorry I didn’t add much information to readme.

I’ve just added an example: https://github.com/danimtb/dasshio/blob/master/README.md

btw, method used is always POST at the moment

Hope it helps

1 Like

That’s exactly what I needed, thank you.

Thanks for this. I struggled getting dasher to work. This is a super simple way to do this and works great for me.

1 Like

Hmm…still doesn’t work :frowning:

The button is definitely connecting to the router because I left the Amazon notifications on to be sure, nothing appears in the Dasshio or HA logs?

Only difference to your example is I’m using switch/turn_on instead of light/toggle.