Giter VIP home page Giter VIP logo

Comments (11)

hannseman avatar hannseman commented on May 30, 2024

How are you running the container? Docker can't access bluetooth on the host by default. I think you might need to pass --net=host and possibly --privileged. Anyway this is not an issue directly related to this plugin but how to run bluetooth related stuff through docker so I'll close this.

from homebridge-mi-hygrothermograph.

mrdc avatar mrdc commented on May 30, 2024

I run it like this:

docker run -d --restart=always --net=host \ --name=homebridge \ -v /storage/homebridge:/homebridge \ -e HOMEBRIDGE_CONFIG_UI=1 \ -e HOMEBRIDGE_CONFIG_UI_PORT=8581 \ oznu/homebridge:raspberry-pi

Adding --privileged, makes no difference: "noble warning: adapter state unauthorized, please run as root or with sudo"

from homebridge-mi-hygrothermograph.

hannseman avatar hannseman commented on May 30, 2024

You might need to add some capabilities to the container. I use CAP_NET_RAW when running homebridge in systemd to allow access to the bluetooth socket without sudo. You can try to add it with --cap-add=NET_RAW you might also want to try --cap-add=SYS_ADMIN --cap-add=NET_ADMIN.

You can probably find a lot more information by googling for "docker bluetooth" or something like that. Good luck!

from homebridge-mi-hygrothermograph.

mrdc avatar mrdc commented on May 30, 2024

I've tried to turn off BT on host (systemctl stop bluetooth) - it helped a little bit - now I see this in logs:

[4/16/2019, 8:49:04 PM] Loaded plugin: homebridge-mi-hygrothermograph
[4/16/2019, 8:49:05 PM] [homebridge-config-ui-x] Console v4.0.0-beta16 is listening on port 8581
[4/16/2019, 8:49:06 PM] Registering accessory 'homebridge-mi-hygrothermograph.Hygrotermograph'
[4/16/2019, 8:49:06 PM] ---
[4/16/2019, 8:49:06 PM] Loaded plugin: homebridge-config-ui-x
[4/16/2019, 8:49:06 PM] Registering platform 'homebridge-config-ui-x.config'
[4/16/2019, 8:49:06 PM] ---
[4/16/2019, 8:49:06 PM] Loading 0 platforms...
[4/16/2019, 8:49:06 PM] Loading 1 accessories...
[4/16/2019, 8:49:06 PM] [Temperature & Humidity] Initializing Hygrotermograph accessory...
[4/16/2019, 8:49:06 PM] [Temperature & Humidity] Stop scanning. (poweredOff)
[4/16/2019, 8:49:06 PM] Homebridge is running on port 51826.

from homebridge-mi-hygrothermograph.

hannseman avatar hannseman commented on May 30, 2024

Can you try running hciconfig hci0 up before starting homebridge?

Some discussion regarding bluetooth in docker can be found here moby/moby#16208

from homebridge-mi-hygrothermograph.

mrdc avatar mrdc commented on May 30, 2024

@hannseman
When bluetooth is enabled on host (LibreELEC@Raspberry Pi 3 B+) I receive:

[4/13/2019, 8:17:12 PM] [Temperature & Humidity] Stop scanning. (unauthorized)

When I disable bluetooth on host (systemctl stop bluetooth) I receive this:

[4/16/2019, 8:49:06 PM] [Temperature & Humidity] Stop scanning. (poweredOff)

In case I'll run hciconfig hci0 on host it will enable bluetooth and I will get again:

[4/13/2019, 8:17:12 PM] [Temperature & Humidity] Stop scanning. (unauthorized)

With external bluetooth dongle I receive the same error:

Stop scanning. (unauthorized)

Some discussion regarding bluetooth in docker can be found here moby/moby#16208

Unfortunately :( I've tried everything: like docker run -ti --net=host,docker run -ti --privileged --net=host etc.

from homebridge-mi-hygrothermograph.

ferdinand avatar ferdinand commented on May 30, 2024

@mrdc Did you install the noble dependencies via sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev and run sudo setcap cap_net_raw+eip $(eval readlink -f `which node`) as the suggested by the noble README which is referred to in the log? Of course, both must executed inside the Docker container.

from homebridge-mi-hygrothermograph.

mrdc avatar mrdc commented on May 30, 2024

@mrdc Did you install the noble dependencies via sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev and run sudo setcap cap_net_raw+eip $(eval readlink -f `which node`) as the suggested by the noble README which is referred to in the log? Of course, both must executed inside the Docker container.

Yes, I've fixed it with

sudo setcap cap_net_raw+eip $(eval readlink -f which node)

from homebridge-mi-hygrothermograph.

plantoschka avatar plantoschka commented on May 30, 2024

I have to run "sudo setcap cap_net_raw+eip $(eval readlink -f which node)" after every restart to make bluetooth work. Is there a way to do this automatically in the docker-compose?

from homebridge-mi-hygrothermograph.

vladtsit avatar vladtsit commented on May 30, 2024

@plantoschka have you found a way to automate it? To run it after restart?

from homebridge-mi-hygrothermograph.

plantoschka avatar plantoschka commented on May 30, 2024

@plantoschka have you found a way to automate it? To run it after restart?

Unfortunately not.

from homebridge-mi-hygrothermograph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.