Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pcap4J integrated? #41

Closed
andy-ich opened this issue Jan 4, 2017 · 8 comments · Fixed by #70
Closed

Pcap4J integrated? #41

andy-ich opened this issue Jan 4, 2017 · 8 comments · Fixed by #70

Comments

@andy-ich
Copy link

andy-ich commented Jan 4, 2017

Hi, Amazon Dash Button Binding doesn't work.
Has Pcap4J been integrated?
http://docs.openhab.org/addons/bindings/amazondashbutton/readme.html

I´m using openhab/openhab:amd64-online on:
Synology DSN 6.0.2-8451 Update 7
Docker App V. 1.11.2-0268

Otherwise it runs well up to the following Bug:
#12

Thanks for your great work!

@nokyyz
Copy link

nokyyz commented Jan 13, 2017

+1 !

@cniweb
Copy link
Member

cniweb commented Jan 16, 2017

Can you try it? The PR #43 close the Issue #12

@nokyyz
Copy link

nokyyz commented Jan 16, 2017

For Amazon Dash Button, dersimon suggests in his comment (on https://hub.docker.com/r/openhab/openhab/) this update:

To get pcap working, create Dockerfile with these contents:

FROM openhab/openhab:amd64-online
RUN apt-get -y update && apt-get install -y libpcap-dev
CMD setcap cap_net_raw,cap_net_admin=eip `realpath /usr/bin/java`

ENTRYPOINT ["/entrypoint.sh"]
CMD ["server"]

However, starting the Container with --net=host currently won't work with Docker for Mac according to this issue.

@cniweb
Copy link
Member

cniweb commented Jan 17, 2017

openhab/openhab:amd64-online is not actual!
openhab/openhab:amd64 is actual!

@legacycode
Copy link
Contributor

@nokyyz: I have tried hours to get libpcap working in the docker container without success. If i add following lines to the dockerfile they do not work as expected. If i run the command in the docker container they work, but when i restart the container it does not start anymore and the changes seems to be gone. I have tried privileged mode as well. I have read a lot of problems with aufs and x_attr support, but i have no solution yet. If i run the container as root it works.

setcap cap_net_raw,cap_net_admin=eip /usr/lib/java-8/bin/java
setcap cap_net_raw,cap_net_admin=eip /usr/lib/java-8/jre/bin/java
patchelf --set-rpath /usr/lib/java-8/lib/amd64/jli /usr/lib/jvm/java-8-oracle/bin/java
patchelf --set-rpath /usr/lib/java-8/jre/lib/amd64/jli /usr/lib/jvm/java-8-oracle/jre/bin/java

Pleas help me to find a solution :-) I need this feature as well.

@legacycode
Copy link
Contributor

legacycode commented Jan 31, 2017

@andy-ich: With my last PR #69 i got the amazondashbutton plugin working running the image as root with the following command:

docker run -u root -it --rm --cap-add NET_ADMIN --cap-add NET_RAW --net=host openhab

Feel free to modify the run command after this PR is merged and let me know if it works as expected.

@nokyyz
Copy link

nokyyz commented Feb 6, 2017

@legacycode : I have upgraded today my OH2 docker image to check your solution.
During the discover, my Amazon Dash Button is well found. But, I don't receive any events when I press the button.
Here my conf:

openhab2:
  container_name: openhab2
  image: 'openhab/openhab:2.0.0-amd64'
  restart: always
  ports:
     - "8080:8080"
     - "8443:8443"
     - "5555:5555"
  net: "host"
  cap_add:
    - NET_ADMIN
    - NET_RAW
  volumes:
    - '/etc/localtime:/etc/localtime:ro'
    - '/etc/TZ:/etc/timezone:ro'
    - '/volume1/docker/openhab2/userdata:/openhab/userdata'
    - '/volume1/docker/openhab2/conf:/openhab/conf'
    - '/volume1/docker/openhab2/addons:/openhab/addons'
  devices:
    - "/dev/ttyACM0:/dev/ttyACM0"
  environment:
     - "EXTRA_JAVA_OPTS=-Duser.timezone=Europe/Paris -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0"
  user: root

rule:

rule "Dash button pressed"
when
    Channel "amazondashbutton:dashbutton:xx-xx-xx-xx-xx-xx:press" triggered
then
    sendTelegram("xx", "Hello world !")
end

Is it necessary to execute setcap command after the Docker run command ?
Did you succeed to trigger a rule on press event ?

@ChromoX
Copy link

ChromoX commented Feb 27, 2017

I've tried everything in this thread and can't even get the buttons to show up in the Inbox after searching. I've used the docker-compose.yml file and run as root. I get nothing. I'm trying to run the armhf version on an Odroid-XU3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants