hypfer / cybele Goto Github PK
View Code? Open in Web Editor NEWBLE to MQTT Gateway for Smarthome and IoT Devices
License: Apache License 2.0
BLE to MQTT Gateway for Smarthome and IoT Devices
License: Apache License 2.0
Hi,
Any change to get it working with
NAME: Mi Smart Kettle Pro
MODEL: yunmi.kettle.v12
Hi, from what I can see, there's no support for yunmi.kettle.v12, otherwise known as Xiaomi Smart Kettle Pro.
What information can I provide to help with that?
Also, should note that when I wanted to try it anyway, I've encountered that the token format doesn't match what the format describe in documentation:
---------
NAME: Smart Kettle
ID: blt.6.1722869vcsk00
BLE KEY: be82a2c4dcd037e1f196d6810c0d5c62
TOKEN: 97ca1089cf87e9163f11dbdd
MODEL: yunmi.kettle.v12
---------
(this is a BLE device so I don't really care if the token is public).
Can anyone provide full example on a working config.json?
How does the device config fit into this:
{
"mqtt": {
"url": "mqtt://user:[email protected]"
},
"dongles": [
{
"hciDevice": "hci0",
"mode": "le",
"troubleshooting": {},
"services": [],
"devices": [
]
}
]
}
Hey,
thanks for your great work! It's working like charm.
But wouldn't it be great to use the Xiaomi-App and Cybele at the same time? Therefore you need to extract the Token from the App and use it in Cybele. Also in the protocol documentation is this mentioned: https://github.com/aprosvetova/xiaomi-kettle#authentication
An option for specifying the token in the config would be great!
Thanks in advance!
Currently, if you configure polling of multiple devices with the same interval, they all happen at the same time.
BLE doesn't really like that so it tends to break.
There should be something along the lines of a polling queue on each dongle which processes one job after another.
After starting Cybele and it connecting to the MQTT server, no data is being received. I have 4 of the Xiaomi Mijia LYWSD03MMC Bluetooth 4.2 Temperature Humidity sensor sensors. I most likely have something configured wrong, but I can't see what it might be. Any ideas?
jcw@xyzzy:~/Cybele $ sudo node app.js
Connected to MQTT Broker
Startup complete
[nothing ever happens]
I'm seeing beacons from them using bluetoothctl
.
[CHG] Device A4:C1:38:10:10:5D RSSI: -59
[CHG] Device A4:C1:38:10:10:5D ServiceData Key: 0000181a-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C1:38:10:10:5D ServiceData Value:
a4 c1 38 10 10 5d 00 e2 20 55 0b 98 83 ..8..].. U...
[bluetooth]# info A4:C1:38:E0:CB:5E
Device A4:C1:38:E0:CB:5E (public)
Name: ATC_E0CB5E
Alias: ATC_E0CB5E
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
ServiceData Key: 0000181a-0000-1000-8000-00805f9b34fb
ServiceData Value:
a4 c1 38 e0 cb 5e 00 ff 1c 57 0b af 37 ..8..^...W..7
RSSI: -38
[CHG] Device A4:C1:38:E0:CB:5E RSSI: -38
[CHG] Device A4:C1:38:E0:CB:5E ServiceData Key: 0000181a-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C1:38:E0:CB:5E ServiceData Value:
a4 c1 38 e0 cb 5e 00 ff 1c 57 0b b0 38 ..8..^...W..8
[CHG] Device A4:C1:38:E1:72:4D RSSI: -57
[CHG] Device A4:C1:38:E1:72:4D ServiceData Key: 0000181a-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C1:38:E1:72:4D ServiceData Value:
a4 c1 38 e1 72 4d 00 e3 20 54 0b 92 84 ..8.rM.. T...
[CHG] Device A4:C1:38:60:37:23 RSSI: -62
[CHG] Device A4:C1:38:60:37:23 ServiceData Key: 0000181a-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C1:38:60:37:23 ServiceData Value:
a4 c1 38 60 37 23 00 e6 1f 57 0b a9 8a ..8`7#...W...
I see that the service data key matches that in lib/devices/MiLYWSD03MMCDevice.js
This is on a Raspberry Pi 3 running Buster, with Node v12.21.0.
config.json
looks like this:
{
"mqtt": {
"url": "mqtt://mqtt.xyzzy.com"
},
"dongles": [
{
"hciDevice": "hci0",
"mode": "le",
"services": [],
"devices": [
{
"type": "MiLYWSD03MMCDevice",
"friendlyName": "Temperature sensor #1",
"mac": "A4:C1:38:E1:72:4D"
},{
"type": "MiLYWSD03MMCDevice",
"friendlyName": "Temperature sensor #2",
"mac": "A4:C1:38:10:10:5D"
},{
"type": "MiLYWSD03MMCDevice",
"friendlyName": "Temperature sensor #3",
"mac": "A4:C1:38:60:37:23"
},{
"type": "MiLYWSD03MMCDevice",
"friendlyName": "Temperature sensor #4",
"mac": "A4:C1:38:E0:CB:5E"
}
]
}
]
}
The state topic is configured as:
"state_topic":"cybele/MiLYWSD03MMC/<mac>/state"
but the code actually publishes to
cybele/MijiaLYWSD03MMC/<mac>/state
Hi,
I do not have a lot of knowledge on IoT, so apologise in advance if my question is stupid, but I could not find in the docs anything about it.
In the config "mqtt://user:[email protected]"
What does this exactly means? Where do I define the user or pass and what is the broker id? should be my host? I'm using a raspberry pi, should I put the IP of the raspberry? or localhost would be fine?
Thanks
hey
you can help me to conver to docker compose ?
Hey Hypfer,
First of all, I love what you did with Valetudo, thank you!
Second, I was wondering is there any chance to expand this project for Xiaomi's Toothbrush T500, aka soocas.toothbrush.m1s?
I want to have it cloud free, but not sure where to start.
http://miot-spec.org/miot-spec-v2/spec/device?type=urn:miot-spec-v2:device:toothbrush:0000A07E
returns:
{"type":"urn:miot-spec-v2:device:toothbrush:0000A07E","description":"Toothbrush","required-services":["urn:miot-spec-v2:service:device-information:00007801"],"optional-services":["urn:miot-spec-v2:service:toothbrush:0000786D","urn:miot-spec-v2:service:brush-head:0000786C","urn:miot-spec-v2:service:battery:00007805"]}
http://miot-spec.org/miot-spec-v2/spec/service?type=urn:miot-spec-v2:service:toothbrush:0000786D
{"type":"urn:miot-spec-v2:service:toothbrush:0000786D","description":"Toothbrush","required-properties":["urn:miot-spec-v2:property:mode:00000008"],"optional-properties":["urn:miot-spec-v2:property:on:00000006","urn:miot-spec-v2:property:status:00000007","urn:miot-spec-v2:property:fault:00000009","urn:miot-spec-v2:property:target-time:00000078"]}
{"type":"urn:miot-spec-v2:service:device-information:00007801","description":"Device Information","required-properties":["urn:miot-spec-v2:property:manufacturer:00000001","urn:miot-spec-v2:property:model:00000002","urn:miot-spec-v2:property:serial-number:00000003","urn:miot-spec-v2:property:firmware-revision:00000005"],"optional-properties":["urn:miot-spec-v2:property:serial-no:000000FF"]}
It mainly have a few functions only: ie:
Config is lost every time the device charges..which sucks, I reported it to Xiaomi but they gave 0 shits :)
Let me know if there's a chance, and if yes, what could I start with.
Thank you,
Mark
I've cloned the repo, done npm install
, added dbus config, configured cybele as follows, using token obtained via https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor:
% cat config.json
{
"mqtt": {
"url": "mqtt://localhost"
},
"dongles": [
{
"hciDevice": "hci0",
"mode": "le",
"services": [],
"devices": [
{
"type": "MiKettleDevice",
"friendlyName": "Mi Kettle",
"mac": "kettle mac",
"productId": 1116,
"token": [255,255 ... - token ]
}
]
}
]
}
And I'm getting the following errors:
% node app.js
Connected to MQTT Broker
Startup complete
Mi Kettle {
message: 'Failed to connect to Mi Kettle',
error: 'Software caused connection abort'
} while connecting
Disconnected from Mi Kettle
Mi Kettle {
message: 'Failed to connect to Mi Kettle',
error: 'Software caused connection abort'
} while connecting
Disconnected from Mi Kettle
Mi Kettle {
message: 'Failed to connect to Mi Kettle',
error: 'Software caused connection abort'
} while connecting
Disconnected from Mi Kettle
from bluetoothd
:
bluetoothd[416]: src/device.c:load_gatt_db() No cache for kettle:mac
bluetoothd[416]: src/device.c:load_gatt_db() No cache for kettle:mac
btmgmt
says:
hci0 kettle:mac type LE Public connected eir_len 21
hci0 kettle:mac type LE Public disconnected with reason 0
Any ideas what's wrong?
Tried to install on a Debian 11 miniPC and on Pi4
Both give the same error:
Sep 16 16:53:11 Wohnzimmer systemd[1]: Cybele.service: Failed with result 'exit-code'.
Sep 16 16:53:11 Wohnzimmer systemd[1]: Cybele.service: Main process exited, code=exited, status=1/FAILURE
Sep 16 16:53:11 Wohnzimmer node[13973]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Module._compile (internal/modules/cjs/loader.js:999:30)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Object.<anonymous> (/home/pi/Cybele/lib/DongleFactory.js:4:16)
Sep 16 16:53:11 Wohnzimmer node[13973]: at require (internal/modules/cjs/helpers.js:74:18)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Module.require (internal/modules/cjs/loader.js:887:19)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Module.load (internal/modules/cjs/loader.js:863:32)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Sep 16 16:53:11 Wohnzimmer node[13973]: at Module._compile (internal/modules/cjs/loader.js:963:27)
Sep 16 16:53:11 Wohnzimmer node[13973]: at wrapSafe (internal/modules/cjs/loader.js:915:16)
Sep 16 16:53:11 Wohnzimmer node[13973]: SyntaxError: Unexpected token '.'
Sep 16 16:53:11 Wohnzimmer node[13973]: ^
Sep 16 16:53:11 Wohnzimmer node[13973]: if (msg?.path?.indexOf(this.pathRoot) === 0) {
Sep 16 16:53:11 Wohnzimmer node[13973]: /home/pi/Cybele/lib/Dongle.js:160
I read the documentation, but I'm not sure I understand everything fully.
The uhubctl README says that it supports Pi 4 but it is buggy, so if you connect the Bluetooth Adapter directly to the main hub (eg.: one of the provided USB ports), it will power down all ports.
So my main questions are:
Hello.
Is there any way to add Xiaomi Mijia LYWSD03MMC Bluetooth 4.2 Temperature Humidity sensor (LYWSD03MMC) ?
I have found Python script which can get readings from it, but it is not working simultaneously with Cybele.
Thanks.
I installed cybele to a rpi 3b+ with inbuilt bt and added an eq3 thermostat to it.
On start i get this:
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.19" (uid=1000 pid=1637 comm="node cybele/app.js ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=575 comm="/usr/lib/bluetooth/bluetoothd ")'
]
}
}
I can not find anything about this error in web search. Can someone help me with this?
Using https://github.com/Heckie75/eQ-3-radiator-thermostat/blob/master/eq3.exp i can see information about my thermostat state, so i think the bluetooth connection is working.
Is there a chance for adding the Mi Temperature & Humidity Sensor? It seems like it should be fairly similar to the Mi Flora configuration but I am lacking the skill to change it so it would work with this device. I have 2 of these so if you need any data I hope I would be able to extract / provide it if needed.
Amazing work, thanks!
Hi everyone,
I follow the readme to install the package.
I've cloned the repo, done npm install, configured cybele as follows
{
"mqtt": {
"url": "MQTT"
},
"dongles": [
{
"hciDevice": "hci0",
"mode": "le",
"services": [],
"devices": [{
"type": "MiKettleDevice",
"friendlyName": "Mi Kettle",
"mac": "MAC",
"productId":1116
}
]
}
]
}
Connected to MQTT Broker
Startup complete
/home/pi/Cybele/lib/devices/MiKettle/MiKettleDevice.js:166
this.characteristicsByUUID[MiKettleDevice.CHARACTERISTICS.auth].StartNotify([], err => {
^
TypeError: Cannot read property 'StartNotify' of undefined
at /home/pi/Cybele/lib/devices/MiKettle/MiKettleDevice.js:166:73
at Object.item.task (/home/pi/Cybele/node_modules/semaphore/lib/semaphore.js:40:29)
at Object.take (/home/pi/Cybele/node_modules/semaphore/lib/semaphore.js:51:9)
at MiKettleDevice.doAuthStageTwo (/home/pi/Cybele/lib/devices/MiKettle/MiKettleDevice.js:165:20)
at Object.<anonymous> (/home/pi/Cybele/lib/devices/MiKettle/MiKettleDevice.js:156:22)
at EventEmitter.<anonymous> (/home/pi/Cybele/node_modules/dbus-native/lib/bus.js:138:19)
at EventEmitter.emit (events.js:388:22)
at /home/pi/Cybele/node_modules/dbus-native/index.js:106:14
at Socket.<anonymous> (/home/pi/Cybele/node_modules/dbus-native/lib/message.js:55:9)
at Socket.emit (events.js:376:20)
Any ideas what's wrong?
Hi, is it possible to make Cybele to be run as the addon for Home Assistant?
Hi, does the Glance Clock integration work? If so then I'm happy to muddle through working out how to use it and writing up a Readme
That code is just terrible
https://github.com/Hypfer/Cybele/blob/master/lib/Dongle.js#L215
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.