Amazon Dash Button Binding rule

I have a strange behaviour with my DashButton.

Dashbutton is installed properly. When pressed I get the logInfo and I can switch an item.

The error I got is when the item I want to trigger is a mqtt item.
Then the mqtt broker restarts.

If I trigger the mqtt item from a different switch (Xiaomi cube) with the same command everything is ok.

Item:
Switch GarageGate1 “GarageGate1” (gSonoff) {mqtt=">[broker:cmnd/sonoff-sv1/POWER:command:*:default],
<[broker:cmnd/sonoff-sv1/POWER:state:default]" }

Error:
==> /var/log/openhab2/events.log <==

2019-02-14 16:18:02.030 [ome.event.ItemCommandEvent] - Item ‘Sonoff1’ received command ON

==> /var/log/openhab2/openhab.log <==

2019-02-14 16:18:02.257 [WARN ] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to ‘broker’ was lost: Verbindung wurde getrennt : ReasonCode 32109 : Cause : Connection reset

2019-02-14 16:18:02.259 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker ‘broker’

Could you please post also your rule here?

rule “My Dash Button pressed”
when
Channel “amazondashbutton:dashbutton:38-f7-3d-8a-58-9a:press” triggered
then
logInfo(“dash”,“log”)
Sonoff1.sendCommand(ON)
end

If I put the sendCommand in a rule for a other device(Xiaomi Cube) it is working

Looks like the issue is with the trigger used so maybe try giving the channel above an item name and use that as the trigger.

@zaratul

You can also try to use a “Profile”, if your binding is from mid January 2019 or newer.

Switch GarageGate1 "GarageGate1" (gSonoff) {mqtt=">[broker:cmnd/sonoff-sv1/POWER:command:*:default],<[broker:cmnd/sonoff-sv1/POWER:state:default]", channel="amazondashbutton:dashbutton:50-f5-da-xx-xx-xx:press" [profile="rawbutton-toggle-switch"] }

@zaratul

And in your rule you used the wrong quotation marks “” !!!

rule “My Dash Button pressed”
     when
     Channel “amazondashbutton:dashbutton:38-f7-3d-8a-58-9a:press” triggered
     then
     logInfo(“dash”,“log”)
     Sonoff1.sendCommand(ON)
  end

.
.
Here are the correct quotation marks:

rule "My Dash Button pressed"
when
Channel "amazondashbutton:dashbutton:38-f7-3d-8a-58-9a:press" triggered
    then
       logInfo("dash","log")
       Sonoff1.sendCommand(ON)
end

The quotation marks where the right one in the code.
The trigger is reached correctly. I added loging before and after to visualize the problem.

New rule

rule “My Dash Button pressed”
when
Channel “amazondashbutton:dashbutton:38-f7-3d-8a-58-9a:press” triggered
then
logInfo(“dash”,“before”)
Sonoff1.sendCommand(ON)
logInfo(“dash”,“after”)
end

working rule outside dashbutton:

rule “Garagentor”
when
Item GarageGate1 received command ON
then
createTimer(now.plusSeconds(1)) [|
sendCommand(GarageGate1, OFF)
]
end

LOG
2019-02-14 21:04:02.999 [vent.ChannelTriggeredEvent] - amazondashbutton:dashbutton:38-f7-3d-8a-58-9a:press triggered

==> /var/log/openhab2/openhab.log <==

2019-02-14 21:04:03.192 [INFO ] [.eclipse.smarthome.model.script.dash] - before

==> /var/log/openhab2/events.log <==

2019-02-14 21:04:03.198 [ome.event.ItemCommandEvent] - Item ‘Sonoff1’ received command ON

==> /var/log/openhab2/openhab.log <==

2019-02-14 21:04:03.200 [INFO ] [.eclipse.smarthome.model.script.dash] - after

2019-02-14 21:04:03.427 [WARN ] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to ‘broker’ was lost: Verbindung wurde getrennt : ReasonCode 32109 : Cause : Connection reset

2019-02-14 21:04:03.429 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker ‘broker’

2019-02-14 21:04:13.431 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘broker’

Did you also try the “profie”?

Yes I also tried the profile.
But I found out that if I delay the mqtt send by 5s than it works. 5s is the intervall set for the dashbutton to ignore multiple button presses. Maybe it somehow prevents mqtt trafic as well

Your MQTT setting is incorrect. You are creating an infinite command loop:
Change to:

Switch GarageGate1 “GarageGate1” (gSonoff) {mqtt=">[broker:cmnd/sonoff-sv1/POWER:command:*:default],
<[broker:stat/sonoff-sv1/POWER:state:default]" }

Change cmnd to stat in the inbound parameters

I didn’t check the MQTT commands because I do not use MQTT myself and therefore have no knowledge about it. Sorry!