Amazon Dash Button as openHAB Trigger

Thanks very much,I will test that in the next days.

So, couldn’t wait so I tried direct, no success. I get an error no section logging but I have this section.

The section must match exactly, including case.

[Logging]
File = /var/log/sensorReporter.log
MaxSize = 67108864
NumFiles = 10
Syslog = YES

The above is copied from one of my working logging sections.

I don’t know how finicky Python’s config parsing library is so make sure you do not have any leading spaces or tabs.

Maybe i have an old version? In default.ini it is written like this

[Logging]
File: /var/log/mqttReporter.log
MaxSize: 67108864
NumFiles: 10

Oops! I forgot to check that update in. It is checked in now. But the error should have been complaining about a missing Syslog in the Logging section, not a missing Logging section over all.

I used Networkhealth, that works very well and it’s easy to configure.
I made a youtube video to explain it in detail:

There is no workaround, hacks or skripts. Just a binding and a little change in the openhab.cfg, that’s it! :grin:

And here the german version:

1 Like

Thanks for that! Did you set the Dash button to a fixed IP address in your router?

Is there a way to archieve this, without increasing the nh-check interval?
I have a lot of nh-items, I do not want to enlarge the traffic for this binding.
My Dash Button setup:
I set a static IP on my Windows DHCP Server (could be done on a router, of course) and disabled Internet connectivity at my Fritz!Box (otherwise the amazon app notified me -> dash button not configured)

My FritzBox sets up automaticly fixed IP’s!

You have to increasing the nh-check interval!

BUT GOOD NEWS, you can deactivate amazon app notifications for the Dash Button.

In OpenHAB2 i can set the interval manually :slight_smile:

Hi everyone,
I’m new to OpenHab, and I’m trying to figure out if it will suit my needs. Support for Amazon Dash buttons is fairly integral to my plans.

I currently run scripts which listen for the Dash buttons to log onto the network and execute commands (turn Hue lights on/off), and I’m looking for something a little more user friendly and easier to make changes to. I’m hoping OpenHab can be that.

I have two questions:

  1. Is it easy to set up a dash button and assign it a function in OpenHab?
  2. Is it possible to implement something similar to this Homebridge plugin, which uses wifi frames instead of ARP? https://github.com/jourdant/homebridge-amazondash-ng

Thanks for any insight/help you can provide.


Francis

Looking at one-year-old original post from @rlkoshak I see, that Apple made a good progress since then - in iOS10 you just swipe lock screen up - and here you are with all your Homekit buttons. Or just say - “Siri, open the garage door”. So the number of steps was greatly reduced since then. And you still need only your iPhone.
Rich, did you try Apple/Siri/Homekit solution for your garage door, or it doesn’t work, or you still think, that Dash is better?

I don’t personally use Apple products so I have no idea. I do something similar (have for years) on my Android using Tasker. Even a Siri solution would not meet the WAF (she does use Apple products) so I’ve not pursued any Homekit integration. And I try to avoid any solution that is locked into any one ecosystem as much as possible (i.e. I won’t bother implementing a primary control that works on iPhone but doesn’t work on Android and vise versa or only works on Windows but won’t on Linux or OSX).

For awhile I had some Zwave Minimotes, one in each car, which worked great as garage openers. The Dash buttons never really worked well from the driveway even when I could get them to work and the latency between button press and door opening was too long even when it worked. In my opinion, Dash buttons are great for controlling things where the latency isn’t noticeable such as data logging, HVAC, etc. but not a good choice for controlling things where latency is noticeable like turning on lights or opening the garage doors.

Eventually I ended up just replacing the garage door opener with a newer, safer, and quieter one (one that has the sensors to stop its closing if there is something in the way) with remotes that actually work. My wife just uses the button that came with the opener and I still use my Android/Tasker setup which I know violates my rule from above but I think of this as a secondary control, not the primary control.

I developed an Amazon Dash button binding for openHAB 2: http://docs.openhab.org/addons/bindings/amazondashbutton/readme.html

2 Likes

Thankyou for your binding, I am a beginner on openHAB2 (2.0.0 online SNAPSHOT build560 ubuntu14.04. I have the dash button reporting to the openhab log, but cannot get the dash button to trigger a rule.

Please could your wiki code include sample Item and rule definitions to perform a simple task?

I am trying to get the dash button to run a php Script. If I press the dash button, or press a virtual button on the GUI it should run a script.
I have the button added as a Thing:
console shows:
amazondashbutton:dashbutton:ac-63-be-xx-xx-xx (Type=Thing, Status=ONLINE, Label=Dash Button 1, Bridge=null)
The log shows the following upon pressing the Dash Button
[marthome.event.ChannelTriggeredEvent] - amazondashbutton:dashbutton:ac-63-be-xx-xx-xx:press triggered

I have tried:

  1. create a Switch Item, and link it to the channel
    Switch RunCode1 "Run Code Dash Button" { channel = "amazondashbutton:dashbutton:ac-63-be-xx-xx-xx:press" }
    then create a rule:
    rule "RunCode 1 button pressed"
    when
    Item RunCode1 received command
    then
    executeCommandLine (“php /opt/openhab2/scripts/myscript.php”)
    end
    then a sitemap switch, just so I can press it on the GUI to trigger the same
    Switch item=RunCode1 label="Run Code" mappings=[ON="On"]

I think my problem is that the button triggers an event in a channel but I can’t work out how to interact with that via rules,
Thankyou for any advice for a beginner.

I recommend looking at the Items and Rules documentation.
http://docs.openhab.org/features/items.html
http://docs.openhab.org/features/automation/ruledsl.html

You do not say what happens when you press the RunCode1 element on the Sitemap. Does it trigger the rule or not? If not this isn’t a Dash binding problem but a fundamental problem with the Item’s configuration.

Can you trigger the rule if you define a separate Item to put on your sitemap from the one that is supposed to respond to the Dash button?

Do you see RunCode1 being updated in events.log when you press either the Dash or the sitemap element?

Try giving the full path the php in your command line. OH is running as a separate and non-privileged user and it is safest to assume its path is severely limited. It is unlikely that php is in its path so it can’t find it to run it.

Thankyou for a prompt reply, sorry for not being clear.

Pressing RunCode1 element (button) on the sitemap works fine - the rule is triggered, executeCommandLine is run and the script runs.
I get this in the logfile for GUI button press: 16:14:01.290 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘RunCode1’ received command ON
16:14:01.312 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine ‘php /opt/openhab2/scripts/myscripts.php’

If I press the Dash Button, I get this in the log:
16:10:54.022 [INFO ] [marthome.event.ChannelTriggeredEvent] - amazondashbutton:dashbutton:ac-63-be-xx-xx-xx:press triggered
…and nothing else.

It is probably my lack of understanding in how to process .event.ChannelTriggeredEvent (as triggered by the Dash Button) as opposed to .event.ItemCommandEvent (as triggered by the GUI button).

Perhaps I have not set up the Item correctly - the Dash Button emits “:press” rather than “Command ON”, so I can see my rule failing. Do I need a way of mapping the Dash button “Press:” to an “ON/OFF” command suitable for a Switch?

I will re-read those links on rules and Items you have sent.

Thankyou for your patience.

Properly configured there is no difference as far as the Rules are concerned.

You say “the log file”, are you referring to the event.log?

If you do not see an entry in the event.log when you press the Dash button it means there is something wrong between the binding and your Item. This helps narrow down where to look.

You have proven that the Rule itself is fine because it executes when you press the button on the sitemap.

@oliver, what types of Items(s) are valid for the press channel? Is Switch supported or should it be Contact or something else? If there are restrictions on the type of Item the channel supports it should be in the readme.

The “log file” I refer to above is the Openhab Karaf output from “log:tail” when I press the Dash button/Sitemap button

The /opt/openhab2/userdata/logs/events.log shows the following for a Dash button press
2016-10-31 16:52:44.118 [ChannelTriggeredEvent ] - amazondashbutton:dashbutton:ac-63-be-xx-xx-xx:press triggered

The Sitemap Switch button when pressed shows the following in the events.log
2016-10-31 16:54:36.501 [ItemCommandEvent ] - Item ‘RunCode1’ received command ON
2016-10-31 16:54:36.504 [ItemStateChangedEvent ] - RunCode1 changed from NULL to ON

I guess my condensed question would therefore be how I trigger a rule for the ChannelTriggeredEvent produced by the Dash button; whether my attempt to link it to a Sitemap GUI button is just a red herring. My goal is I hope pretty straightforward - press the Dash Button, execute Code.

You don’t. Only Time or Item events can trigger a Rule. That is the whole point of Items, to provide a common layer of abstraction between the dozens of different technologies and the rest of your HA system.

The problem is the channel event is not sending the command to the Switch. The problem is either in the binding config, the channel string, or in how the Item is bound to the channel.