1st Dash button rule not working

  • Platform information:
    • Hardware: rPi 3
    • OS: openHABianPi 4.9.80-v7
    • openHAB version:2.3.0-1 (Release Build)
  • Issue of the topic: dash button rule doesn’t work
    dashbut1.rules: copied exactly from the example page
    rule “dash_button_pressed”
    when
    Channel “amazondashbutton:dashbutton:68-37-e9-xx-yy-zz:press” triggered
    then
    logInfo(“amazondashbutton”, “My Dash Button has been pressed”)
    end

dashbut1.things
Thing amazondashbutton:dashbutton:68-37-e9-xx-yy-zz “brabantia” @ “Dragons Lair” [
macAddress=“68:37:e9:xx:yy:zz”, pcapNetworkInterfaceName=“eth0”, packetInterval=5002 ]

The sitemap doesn’t have any reference to this rule, so it’s not included. (Could be why it’s not working?)

I have read & followed all the setup pages, and copied the rule from the sample in the Dash Button Binding page.
The dash button Thing definitely works (the 5002ms is my check method of seeing it worked in the paper UI), and we know this because the openhab log has the (textbook) triggered entry:
2018-11-13 21:54:28.428 [vent.ChannelTriggeredEvent] - amazondashbutton:dashbutton:68-37-e9-xx-yy-zz:press triggered

But no rule happens. The rule shows a logInfo command, exactly as the sample code, but it produces no log entry as it should. I’ve also tried an MQTT command:
{mqtt=">[mqtth2:Dragon/Basem/Lights1/cmnd/power1:command:TOGGLE:toggle]" }
but the rule doesn’t fire, so it’s not much of a test really (!).
What I’d like to do it add it to the sitemap so that the “switch” item:
Switch item=Pwr_B_1 icon=“light” label=“Basement Pwr 1”
gets toggled - so it shows in the UI as well as sending the (working) MQTT command to the switch.

Can anyone please nudge me in the right direction please? I have carefully checked the syntax for missing characters, but can’t see my mistake.

Many thanks in advance, much appreciated.
Lee
ps - the xx_yy_zz are replacements for the actual mac address :wink:

First, please use code fences when post rules, items, things, sitemap, etc…

The problem with what you have above is the " " are incorrect.

Take a look at using VSCode w/ OH extension to edit your files. This will help identify syntax issues like the " " in your files.

Use this in your sitemap to test.

Frame label="testing"
{
Switch item=Pwr_B_1 icon="light" label="Basement Pwr 1"
}

Post back if this works and we can move to solving the rule issue.

EDIT: After checking the other things and items in VSCode the " " inside those files needed to be fixed as well. Here’s the correct version you can copy to the appropriate file.

Thing:

Thing amazondashbutton:dashbutton:68-37-e9-xx-yy-zz "brabantia" @ "Dragons Lair" [
macAddress="68:37:e9:xx:yy:zz", pcapNetworkInterfaceName="eth0", packetInterval=5002 ]

Item:

Switch Pwr_B_1 "Your Pwr"
{ mqtt=">[mqtth2:Dragon/Basem/Lights1/cmnd/power1:command:TOGGLE:toggle]" }

Rule:

rule "dash_button_pressed"
when
Channel "amazondashbutton:dashbutton:68-37-e9-xx-yy-zz:press" triggered
then
logInfo("amazondashbutton", "My Dash Button has been pressed")
end

If your still having issues after making the changes above please post the output of the logs.

Thanks

@H102 You still had “funny” quotes in the thing definition

Dang, I should have looked it over again.:roll_eyes:

Nice catch @vzorglub

Edit: After checking it in VSCode the " " are correct. Why are they still funny looking??