Please tell me your Amazon Dash Button MAC Vendor prefix

As long as I have to use openHAB with user root: no :smiling_imp:

The dash button shows up as “unknown device”

I’ve created a rule:

rule "Dash button pressed"
    when
        Channel "amazondashbutton:dashbutton:AC-63-BE-62-BE-F5:press" triggered  
    then
        logInfo("FILE","The dash button has been pressed")
end

but no loginfo is showing up when I press the button …

Where? In the inbox?

Hmm, are you sure that this is the correct id? I guess AC-63-BE-62-BE-F5 has to be lowercase.

First in the inbox, after adding as thing under things.
Now with another openhab restart under root it seems okay:

Tried that, works now:
2016-11-02 21:05:01.413 [INFO ] [.eclipse.smarthome.model.script.FILE] - The dash button has been pressed

Now we need to solve the “run under root” problem …

Edit: btw, what is the correct syntax to define the thing with text files? I don’t like the mapdb database …

I uploaded another test application: https://ufile.io/d3612
Try this as a non root user and paste the output.

Because of the feedback in this thread I decided to implement the capturing in a more fault-tolerant way.

Pull request: https://github.com/openhab/openhab2-addons/pull/1379

root@raspberrypi3:/home/pi# java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar
8 Devices found:
eth0 (192.168.2.237, fd00:0:0:0:ec03:f2b7:c580:32e2, fe80:0:0:0:cc13:7303:fe0b:5efd) Capturing: WORKS!

any (Pseudo-device that captures on all interfaces) Capturing: WORKS!

lo (127.0.0.1, 0:0:0:0:0:0:0:1) Capturing: WORKS!

wlan0 (fe80:0:0:0:991a:d12c:ffca:b278) Capturing: WORKS!

bluetooth0 (Bluetooth adapter number 0) Capturing: WORKS!

nflog (Linux netfilter log (NFLOG) interface) Capturing: WORKS!

nfqueue (Linux netfilter queue (NFQUEUE) interface) Capturing: WORKS!

usbmon1 (USB bus number 1) Capturing: DENIED! Message: usbmon1: Can't open USB bus file /sys/kernel/debug/usbmon/1t: Datei oder Verzeichnis nicht gefunden

as non root user

Upps … woke up at 02:30 in the morning, too tired to concentrate :grin:

pi@raspberrypi3:~ $ java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar
8 Devices found:
eth0 (192.168.2.237, fd00:0:0:0:ec03:f2b7:c580:32e2, fe80:0:0:0:cc13:7303:fe0b:5efd) Capturing: DENIED! Message: eth0: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)

any (Pseudo-device that captures on all interfaces) Capturing: DENIED! Message: any: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)

lo (127.0.0.1, 0:0:0:0:0:0:0:1) Capturing: DENIED! Message: lo: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)

wlan0 (fe80:0:0:0:991a:d12c:ffca:b278) Capturing: DENIED! Message: wlan0: You don't have permission to capture on that device (socket: Die Operation ist nicht erlaubt)

bluetooth0 (Bluetooth adapter number 0) Capturing: WORKS!

nflog (Linux netfilter log (NFLOG) interface) Capturing: DENIED! Message: nflog: NFULNL_CFG_CMD_PF_UNBIND: Die Operation ist nicht erlaubt

nfqueue (Linux netfilter queue (NFQUEUE) interface) Capturing: DENIED! Message: nfqueue: NFQNL_CFG_CMD_PF_UNBIND: Die Operation ist nicht erlaubt

usbmon1 (USB bus number 1) Capturing: DENIED! Message: usbmon1: Can't open USB bus file /sys/kernel/debug/usb/usbmon/1t: Keine Berechtigung

Nevermind. Are you sure that you run the application with the java binary you granted the cap capabilities to?

Can you try this please:

/usr/lib/jvm/java-8-oracle/bin/java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar

I have no idea because it is the first time I heard about setcap …

What I did yesterday:
sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/java-8-oracle/bin/java

pi@raspberrypi3:~ $ /usr/lib/jvm/java-8-oracle/bin/java -jar d3612-pcap4j-sample-0.0.1-snapshot-jar-with-dependencies.jar

8 Devices found:
eth0 (192.168.2.237, fd00:0:0:0:ec03:f2b7:c580:32e2, fe80:0:0:0:cc13:7303:fe0b:5efd) Capturing: WORKS!

any (Pseudo-device that captures on all interfaces) Capturing: WORKS!

lo (127.0.0.1, 0:0:0:0:0:0:0:1) Capturing: WORKS!

wlan0 (fe80:0:0:0:991a:d12c:ffca:b278) Capturing: WORKS!

bluetooth0 (Bluetooth adapter number 0) Capturing: WORKS!

nflog (Linux netfilter log (NFLOG) interface) Capturing: WORKS!

nfqueue (Linux netfilter queue (NFQUEUE) interface) Capturing: WORKS!

usbmon1 (USB bus number 1) Capturing: DENIED! Message: usbmon1: Can't open USB bus file /sys/kernel/debug/usb/usbmon/1t: Keine Berechtigung

Ok, obviously the Java binary in your path is not /usr/lib/jvm/java-8-oracle/bin/java.

So you granted the capabilities to the wrong Java binary.

No idea about that. Everything worked right out of the box before, so I never had to even think about this.
What should I do now?

Which one is it then?

Edit: the VERY first step I did was:
sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/java-8-oracle-arm32-vfp-hflt/bin/java

2nd Edit:

pi@raspberrypi3:~ $ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)

This is the command for my RPi3:

setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java

Easier way to resolve the path of your java:

sudo setcap cap_net_raw,cap_net_admin=eip `realpath /usr/bin/java`

I realise that the suggested command in the docs may have a conflict with the Network binding, since setcap may overwrite previous settings (i.e. cap_net_bind service=+ep) @oliver would you agree that for these people the command should be:

sudo setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' `realpath /usr/bin/java`

I have to admit that I just don’t know if this is the correct command, but I gues you are right. I updated the README: https://github.com/openhab/openhab2-addons/pull/1388

Thx, that worked for me, dash button is up and running.

1 Like

ac-63-be - Germany - Nov. 2017

I have two with b4:7c:9c in Germany