Git Product home page Git Product logo

Comments (13)

MynahPL avatar MynahPL commented on September 4, 2024

I am trying to make it run on RPi4, but unsuccessfully so far... I guess I just do not understand everything as well.
My ASUS bluetooth USB dongle is connecting to other LE devices, but I cannot figure out how to make it work with this. I have tried connecting the dongle to RPi4 directly as well as to a USB hub (no difference in error messages below; works with other devices in both configurations).

While I try to run node app.js I get the below error:

Connected to MQTT Broker
{ dongleConfig:
{ hciDevice: 'hci0',
mode: 'le',
services: [],
devices: [ [Object] ] },
error:
{ message: 'Failed to fetch adapter Interface for hci0',
error:
[ 'Rejected send message, 2 matched rules; type="method_call", sender=":1.21" (uid=1000 pid=1991 comm="node app.js ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=366 comm="/usr/lib/bluetooth/bluetoothd ")' ] } }

Also, not sure that I edited the config the right way:

{
"mqtt": {
"url": "mqtt://broker.ip:1883"
},
"dongles": [
{
"hciDevice": "hci0",
"mode": "le",
"services": [],
"devices": [
{
"type": "MiKettleDevice",
"friendlyName": "Mi Kettle",
"mac": "my:ma:ca:dd:re:ss",
"productId": 275
}
]
}
]
}

from cybele.

radokristof avatar radokristof commented on September 4, 2024

Are you sure that hci0 is your Bluetooth device?

from cybele.

MynahPL avatar MynahPL commented on September 4, 2024

I believe so... It is even a Broadcom chip. Unless I am mistaken?

hciconfig
hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:xy:zx:yz ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:13891 acl:189 sco:0 events:685 errors:0
TX bytes:7648 acl:75 sco:0 commands:404 errors:0

hcitool dev
Devices:
hci0 5C:F3:70:xy:zx:yz

lsusb
Bus 001 Device 004: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth

from cybele.

Hypfer avatar Hypfer commented on September 4, 2024

Your user is most likly not in the bluetooth group.

I should probably add that to the documentation

from cybele.

Hypfer avatar Hypfer commented on September 4, 2024

Does this will work even if I use an external hub supported by uhubctl? No modification is needed in the code? How it will know where it is plugged in and which port should be powered down?

It doesn't. You need to specify the correct command manually
https://github.com/Hypfer/Cybele/blob/master/docs/index.md#troubleshooting

from cybele.

radokristof avatar radokristof commented on September 4, 2024

Ahh that makes sense! Sorry for not reading it through carefully...

from cybele.

radokristof avatar radokristof commented on September 4, 2024

Ok, just for testing, I got it running with a RPi 3B with the internal bluetooth.
The range is not so good and I don't know how about you, but I don't have an RPi in the Kitchen yet :)
Yes the Bluetooth will stuck after a few hours, but it seems that it can be restarted by uhubctl (and I couldn't even notice it in terms of Ethernet connectivity that the internet is lost - as it should be because that port will power-cycle Ethernet and Wi-Fi theoretically).

However it seems that after the power cycle is not enough, I also needed to do a sudo hciconfig hci0 up for the Bluetooth to work again. Can I concatanate these two commands with && in the recoveryCommand option @Hypfer ?

Looking at the child_process documentation, this might not work out-of-the-box as it is right now...
Could this be added to the code? It is also great if you want to call any other script, etc... when this happens.

from cybele.

Hypfer avatar Hypfer commented on September 4, 2024

Hm. Apparently AutoEnable=true is not set in your /etc/bluetooth/main.conf
I think that it is default true on new installations. Still something to note somewhere in the documentation.

If you for some reason need to run more than one command, I'd suggest wrapping those in a script and using that as the recoveryCommand since child_process.exec is not a shell.

from cybele.

radokristof avatar radokristof commented on September 4, 2024

Unfortunately AutoEnable is set to true.
I also experienced that if I do an lescan I can see the device (and it has a pretty good signal), but Cybele will not connect to it.
No logs, only 'Startup complete' and I can't see it trying to connect to the device or any other output...

Ps.: It seems like that the hciconfig down & up are still needed even if lescan works...

from cybele.

Hypfer avatar Hypfer commented on September 4, 2024

I think the power cycling isn't fully working then. iirc that's also what I saw when trying the 3b.

USB Bluetooth seems to be the only viable option, sadly :(

from cybele.

radokristof avatar radokristof commented on September 4, 2024

@Hypfer Yes I know I just wanted to try out, and my USB Bluetooth haven't arrived yet.
Also I hope that the range will be a little bit better... I can't place the RPi closer to the Kettle.
One quick question: you can't disable the beeping sound when the handshake happens right?
It is really annoying, if I could disable it, then this performance would be enough for me... It only loses connection sometimes for a few secs, but then it beeps again...

from cybele.

Hypfer avatar Hypfer commented on September 4, 2024

Unless you find a way to flash a custom firmware to the kettle sadly no

from cybele.

stek29 avatar stek29 commented on September 4, 2024

I'm using it on RPi 4B with builtin adapter on Ubuntu Server without any issues so far (it's been working for ~5 hours without any issues).
It took some time to get built-in bluetooth adapter working (adding modules to be loaded on boot, adding hciuart, disabling console).

I've been running it in docker with docker-compose.
Sharing my setup here since it might help others.

Dockerfile:

FROM node:12-alpine

WORKDIR /app
ARG VERSION=master
RUN set -ex; \
    apk add --no-cache --virtual .build-deps \
        wget \
        tar \
        git \
        python2 \
        alpine-sdk \
    ; \
    wget https://github.com/Hypfer/Cybele/archive/${VERSION}.tar.gz -O cybele.tar.gz; \
    tar --strip-components=1 -xf cybele.tar.gz; \
    rm cybele.tar.gz; \
    npm install; \
    apk del .build-deps; \
    cp config.default.json config.json

ENTRYPOINT ["/usr/local/bin/node", "app.js"]

/var/run/dbus/system_bus_socket should be mounted from host.

AppArmor can be configured with custom profile to allow DBus access to bluez only, I didn't think it was worth the time and effort and just have made Cybele container "privileged" (with security_opt: [apparmor=unconfined])

from cybele.

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.