Amazon Dash Button as openHAB Trigger

It’s an Eclipse Smarthome concept: smarthome/docs/documentation/development/bindings/thing-definition.md at master · eclipse-archived/smarthome · GitHub (see trigger channel section)

Unlike other channel which can be bound to an item, trigger channels do not have a state. There is just an event (button pressed). If you have a channel which is bound to a Switch you have an On/Off-State whch is just artifical as the button is not on or off at all.

Moreover, using a Switch would mean that it’s possible to change the state of the item, but for a simple button you just cannot set/change any state.

I (think) I’ve updated the docs.openhab.org readme for the Amazon Dash addon with the above example code, via a pull request. All new to me though so may be the wrong way of going about it.

Clearly it doesn’t but this is a concept that is completely new in OH. There is no documentation for it in the docs yet. And while I admit to not reading each and every posting on this forum, I believe this is the first mention of a Channel trigger for Rules anywhere on the OH side of the ESH/OH 2 divide.

In this case the documentation for Rules needs to be updated as there is no mention of “Channel” as a valid Rule trigger.

Is this the new concept we have heard about that is intended to replace the old capability of the 1.9 Astro binding where it generates an event on a Switch at sunrise/sunset, etc?

Is one able to persist when these channels are triggered without creating a new Item (not bound to the channel since it isn’t allow) and Rules to update that Item? I’m thinking of a use case where in a Rule where I may care if that Channel was triggered say five minutes ago. It feels like a lot of extra work for the users that didn’t have to be done previously.

People have been using Switches for simple buttons in OH 1.x since the beginning. But your comment implies that we will be able to put a Triggering channel on our Sitemaps. Is there a new Trigger element in work or do we still have to use a Switch to simulate a Trigger?

And if we are concerned about the user changing the state a Contact can be used which has an implied “read only”.

At a high level, I understand philosophically why a Trigger like this wouldn’t be assignable to an Item, but I can think of several use cases off the top of my head where this makes things that used to be simple and straightforward in OH 1.x impossible or challenging in OH 2.

This is probably a larger discussion but since this Binding is the first to use such triggers this is the first time its come up.

I think we should not use this thread for the discussion. This is the corresponding pull request: https://github.com/eclipse/smarthome/pull/1936

Thanks a lot! In general the openHAB / Eclipse Smarthome Documentation seems to lack this feature,

Well, given that it was only merged and approved a month ago and no one outside of the developers seems to have been informed that is not surprising. I believe yours is the first binding to implement this feature.

For a newbie like myself, having just got my head around linking Things to Items via channels, the description in http://docs.openhab.org/addons/bindings/amazondashbutton/readme.html is misleading:

In openHAB it can be used as a simple switch

You will forgive us therefore when we try and create a Switch Item and bind it with the Dash channel, as per the documentation http://docs.openhab.org/concepts/things.html where:

Channels are linked to items, where such links are the glue between the virtual and the physical layer

I hope you can appreciate the leap in faith needed to create an Item-less Thing for a beginner or even seasoned OpenHAB user.

I would offer to amend the readme for the Dashbutton further, as I feel it needs this crucial difference from a stereotypical Thing:Item relationship emphasising, but my understanding and experience is too limited to apply the correct terminology.

I think as a concept, channel triggers make sense and I can see it making for more flexibility in home automation, perhaps at the expense of pleasing the existing 1.x cohort.

You are right. The documentation is just wrong. In the first version of the binding a “normal” channel bound to a Switch item has been used.

While reviewing @Kai mentioned that the trigger channel would fit better. Unfortunately I did not update the docs accordingly. Will do so soon!

I updated the documentation: https://github.com/openhab/openhab2-addons/pull/1380

Thanks Oliver for the updated docs and for a great plugin.

@oliver
Thanks for this plugin, Oliver! It works really good. The only difficulty for me was to figure out how the trigger event is used in the rules. So I made the same mistake as Steve when the documentation was not yet updated. With the new example it’s much clearer now.

The only thing that remains a bit unclear to me is the ability that I can bind an item to this channel. Does this have any effect or it it ignored completely?
If it’s ignored, is it possible to prevent the linking ability so that users do not get confused by that?

Moreover since this plugin uses an undocumented OH feature (channel event), I assume that every user needs to read the binding documentation in order to get it work. What about placing a link to the binding documentation in the thing or binding description shown in the paperui? Actually, I wish this would be a default for all OH plugins. :wink:

Anyway, thanks a lot for your work on this plugin!

http://docs.openhab.org/addons/bindings/amazondashbutton/readme.html is updates now.

Hi. Did anyone experienced with Amazon IoT Button https://www.amazon.com/dp/B01C7WE5WM ?
It should have same hardware as Dash button, but from description it should talk MQTT, and all you need is to make it somehow publish topics on your MQTT broker instead of AWS. But basically for original use as remote controller it should be fine to use AWS - AWS is acting like fast MQTT broker, to which OpenHab could be connected as well.
Worth to try?

I looked at them when they first came out but they sold out too fast. It would be nice to have one that talks to MQTT directly (eliminates the lag with the Dash button right now).

At $20 I personally would only consider it if it had a relatively easy user replaceable battery. $20 is too much for something disposable. However, with the new Amazon Dash Binding it is possible to get something that works well for $5.

Hi Oliver,

thanks for your binding. Looks promising. However, I think I have problems getting it to work properly as I don’t get any things in the inbox when I press the dash button.
The situation looks quite well

  • OH2 running on raspbian, Raspberry Pi 2
  • amazondash binding installed and runs properly; I see the binding in the paper UI
  • libpcap-dev is installed in raspbian
  • setcap is set as you described: sudo setcap cap_net_raw,cap_net_admin=eip realpath /usr/bin/java
  • dash button is configured in the network
  • I see the arp requests on my PC with wireshark
  • I see the arp requests on the raspi with tcpdump
sudo tcpdump -i eth0 arp and ether host XX:XX:XX:XX:XX:XX -l
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
21:15:02.608080 ARP, Request who-has fritz.box tell dash-ariel.fritz.box, length 46
21:15:16.103170 ARP, Request who-has fritz.box tell dash-ariel.fritz.box, length 46
  • I don’t see any messages in the log from your binding though
  • no new things in the inbox
    Any hints what could be wrong? How can I make sure the binding can correctly use the libpcap?

Cheers,
Hauke

Hi,

do you use the latest version of the binding? I fixed a bug some days ago: https://github.com/openhab/openhab2-addons/issues/1449

Kind regards
Oliver

1 Like

Ah, ok, I now installed the latest Snapshot build 173. Now it works. Thanks!

Hey Oliver, got a problem with the dash binding, it’s trigger only sometimes and there has to be something about 15 minutes between the pressing to trigger.

Please check properties of your amazondashbutton:dashbutton:XXXX Thing and make sure that property called “Packet processing interval (in ms)” is set around 5000. Dash needs to wait some time until it stops flashing red.

Also, please check if there’s anything in openhab.log file.
If there’s an issue with the binding, you can submit an issue if there wasn’t already.
Thanks

in the openhab.log is nothing about the dash button.
in the event.log is 90% of the button press only this message:
2016-12-02 20:27:35.229 [ThingUpdatedEvent ] - Thing ‘amazondashbutton:dashbutton:ac-63-XX-XX-XX-XX’ has been updated.
2016-12-02 20:27:35.849 [ThingUpdatedEvent ] - Thing ‘amazondashbutton:dashbutton:ac-63-XX-XX-XX-XX’ has been updated.

and I can’t change the “Packet Processing interval” because in the PaperUI the thing screen is empty after the header Channels