Read the statement by Michael Teeuw here.
MMM-OralB / Bluetooth equipped toothbrush integration
-
Thanks I really appreciate that! Yeah sure I am willing to refactor it a bit, if needed, and make it a configurable option.
Again sorry for deleting the repo, I pushed wit the wrong git user (work one). I saw that you starred/forked it.Can you show me the changes or make a PR?
The GATT is a bit bugged I am not sure why but the services are not resolving. I am trying to fix that and I think that after that the battery status should be that hard anymore.
-
This post is deleted! -
I can’t PR to your new repo, so here’s the code from MMM-BluetoothDevices.js:
/*jshint esversion: 6 */ //'use strict'; Module.register('MMM-BluetoothDevices', { // Default module config. defaults: { name: 'raspberrypi', mode: 'le', hci: 'hci0', interfaceName: 'org.bluez.Adapter1', services: [ { type: 'CurrentTimeService' }, ], devices: [], layout: { title: { position: 'bottom', key: 'name', }, data: { position: 'bottom', fields: [ { key: 'mode', text: 'mode' }, ], }, }, hideAfter: 10 * 60, }, getStyles() { return ['MMM-BluetoothDevices.css']; }, // Override dom generator. getDom() { const wrapper = document.createElement('div'); wrapper.classList.add('toothbrushes'); if (this.loading) { wrapper.innerHTML = 'Loading...'; wrapper.className = 'light small'; return wrapper; } const table = document.createElement('table'); const row = document.createElement('tr'); for (const deviceKey in this.devices) { const deviceType = this.devices[deviceKey].device.type; if (deviceType === 'OralBToothbrush') { row.appendChild(this.renderToothbrush(deviceKey)); } else { throw new Error(`Unknown device type: ${deviceType}`); } } table.appendChild(row); wrapper.appendChild(table); return wrapper; }, renderToothbrush(deviceKey) { const device = this.devices[deviceKey]; const deviceTd = document.createElement('td'); deviceTd.classList.add('toothbrush'); deviceTd.style.textAlign = "center"; const deviceCircle = document.createElement('div'); deviceCircle.classList.add('toothbrush-circle-container'); deviceCircle.classList.add(`toothbrush-circle-${device.data.state}`); const deviceCircleText = document.createElement('div'); deviceCircleText.classList.add('toothbrush-circle-text'); const deviceCircleSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deviceCircleSvg.classList.add('toothbrush-circle-ring'); const deviceCircleSvgCircle = document.createElementNS('http://www.w3.org/2000/svg', 'circle'); deviceCircleSvgCircle.classList.add('toothbrush-circle'); deviceCircleSvgCircle.setAttribute('stroke-width', 15); deviceCircleSvgCircle.setAttribute('fill', 'transparent'); deviceCircleSvgCircle.setAttribute('r', 52); deviceCircleSvgCircle.setAttribute('cx', 60); deviceCircleSvgCircle.setAttribute('cy', 60); deviceCircleSvg.append(deviceCircleSvgCircle); deviceCircle.append(deviceCircleSvg); deviceCircle.append(deviceCircleText); //const time = device.data.time > 120 ? 120 : device.data.time; const time = device.data.time; // initial start this.updateCircle(deviceCircleSvgCircle, deviceCircleText, time); if (device.data.state === 'running') { deviceTd.style.display = 'block'; deviceCircleText.classList.add('bright'); deviceCircleSvgCircle.setAttribute('stroke', '#0080fe'); this.counters[deviceKey] = { time, interval: setInterval(() => { this.counters[deviceKey].time += 1; this.updateCircle( deviceCircleSvgCircle, deviceCircleText, this.counters[deviceKey].time ); }, 1000), }; } else { deviceCircleText.classList.remove("bright"); deviceCircleSvgCircle.setAttribute('stroke', '#aaa'); setInterval(() => { deviceTd.style.display = "none"; }, this.config.hideAfter * 1000); } const deviceLabel = document.createElement('div'); deviceLabel.classList.add('title'); deviceLabel.classList.add('small'); deviceLabel.innerText = device.device[this.config.layout.title.key]; const dataContainer = document.createElement('div'); dataContainer.classList.add('small'); dataContainer.classList.add('light'); for (const key in this.config.layout.data.fields) { const data = this.config.layout.data.fields[key]; const field = document.createElement('div'); field.innerText = `${data.key}: ${device.data[data.key]}`; dataContainer.appendChild(field); } if (this.config.layout.title.position === 'top') { deviceTd.appendChild(deviceLabel); } if (this.config.layout.data.position === 'top') { deviceTd.appendChild(dataContainer); } deviceTd.appendChild(deviceCircle); if (this.config.layout.title.position === 'bottom') { deviceTd.appendChild(deviceLabel); } if (this.config.layout.data.position === 'bottom') { deviceTd.appendChild(dataContainer); } return deviceTd; }, updateCircle(deviceCircleSvgCircle, deviceCircleText, time) { var secs = time % 60; deviceCircleText.innerText = Math.floor(time / 60) + ":" + (secs < 10 ? "0" + secs : secs); const radius = parseInt(deviceCircleSvgCircle.getAttribute('r')); const circumference = radius * 2 * Math.PI; if (time > 120) { time = 120; } const percent = (100 / 120) * time; const offset = circumference - percent / 100 * circumference; deviceCircleSvgCircle.style.strokeDasharray = `${circumference} ${circumference}`; deviceCircleSvgCircle.style.strokeDashoffset = offset; }, start() { Log.info(`Starting module: ${this.name}`); this.devices = {}; this.counters = {}; this.loading = true; this.sendSocketNotification('FETCH_TOOTHBRUSHES', this.config); }, socketNotificationReceived(notification, payload) { if (notification === 'FETCH_TOOTHBRUSHES_RESULTS') { Log.info('MMM-Toothbrush: Got toothbrush results'); this.devices = payload; for (const counterKey in this.counters) { const counter = this.counters[counterKey]; clearInterval(counter.interval); } if (this.loading) { this.loading = false; this.updateDom(1000); } else { this.updateDom(0); } } }, });it’s also in the develop branch of my module
-
@lavolp3 Thanks, I will have a look at that this weekend.
Also managed to connect to the services and characteristics. But how did you know the one you needed?
Because you only connecting to the 3th key in the services array and a hardcoded uuid for the characteristics. I am curious how you find the one you needed.
-
@timodejong95 I used this gitlab snippet. Don’t remember how I got there. I guess from the homeassistant forum which is also working on that.
For more follow-up see my post in this threadWhen I use bluetoothctl on my RasPi I am getting lots of output form the brush recently. I’m not sure why exactly, maybe because my Pi is coupled with the brush.
Primary Service /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050 a0f0ff20-5047-4d53-8208-4f72616c2d42 Vendor specific Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0070 a0f0ff2b-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0070/desc0072 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char006d a0f0ff2a-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char006d/desc006f 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char006a a0f0ff29-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char006a/desc006c 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0067 a0f0ff28-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0067/desc0069 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0064 a0f0ff27-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0064/desc0066 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0061 a0f0ff26-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0061/desc0063 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char005e a0f0ff25-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char005e/desc0060 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char005b a0f0ff24-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char005b/desc005d 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0058 a0f0ff23-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0058/desc005a 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0055 a0f0ff22-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0055/desc0057 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0051 a0f0ff21-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0051/desc0054 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0050/char0051/desc0053 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Primary Service /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e a0f0ff00-5047-4d53-8208-4f72616c2d42 Vendor specific Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char004c a0f0ff0d-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char004c/desc004f 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char004c/desc004e 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0048 a0f0ff0c-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0048/desc004b 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0048/desc004a 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0044 a0f0ff0b-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0044/desc0047 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0044/desc0046 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0040 a0f0ff0a-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0040/desc0043 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0040/desc0042 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char003c a0f0ff09-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char003c/desc003f 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char003c/desc003e 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0038 a0f0ff08-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0038/desc003b 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0038/desc003a 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0034 a0f0ff07-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0034/desc0037 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0034/desc0036 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0030 a0f0ff06-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0030/desc0033 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0030/desc0032 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char002c a0f0ff05-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char002c/desc002f 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char002c/desc002e 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0028 a0f0ff04-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0028/desc002b 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0028/desc002a 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0025 a0f0ff03-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0025/desc0027 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0022 a0f0ff02-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char0022/desc0024 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char001f a0f0ff01-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char001f/desc0021 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Primary Service /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010 a0f0fff0-5047-4d53-8208-4f72616c2d42 Vendor specific Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char001b a0f0fff4-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char001b/desc001d 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0018 a0f0fff3-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0018/desc001a 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0015 a0f0fff2-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0015/desc0017 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0011 a0f0fff1-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0011/desc0014 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service0010/char0011/desc0013 00002902-0000-1000-8000-00805f9b34fb Client Characteristic Configuration Primary Service /org/bluez/hci0/dev_58_7A_62_3F_63_80/service000c 00001801-0000-1000-8000-00805f9b34fb Generic Attribute Profile Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service000c/char000d 00002a05-0000-1000-8000-00805f9b34fb Service Changed Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service000c/char000d/desc000f 00002902-0000-1000-8000-00805f9b34fb Client Characteristic ConfigurationDo we have to look into one of these characteristics/desricptors for the value?
-
@lavolp3 Well according to the gitlab code we’re looking for this:
Characteristic /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char002c a0f0ff05-5047-4d53-8208-4f72616c2d42 Vendor specific Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char002c/desc002f 00002901-0000-1000-8000-00805f9b34fb Characteristic User Description Descriptor /org/bluez/hci0/dev_58_7A_62_3F_63_80/service001e/char002c/desc002e 00002902-0000-1000-8000-00805f9b34fb Client Characteristic ConfigurationThe characteristic is the one the referenced noble code is filtering for.
Now GO Timo!
Make brushing great again! -
Haha thanks man.
I have made some big changes, improved connecting devices, GATT service, characteristics and some more. I have also managed to get the battery value, but I have an issue: after around 15-30 seconds after connection successfully to the device the connection drops:
{"ServicesResolved":false,"Connected":false}I haven’t figured out why this happens, all the normal data is still received. Only the battery status not, it needs to be connected. I haven’t push anything to the repo yet. First I want to look if I can get it working (fully).
Are you experiencing the same with noble or can you get the battery status after 30 seconds or 1 minute plus?
I keep you updated.
-
I have been debugging it and it seems that the devices is ‘just’ being disconnected:
HCI Event: Disconn Complete (0x05) plen 4 status 0x00 handle 64 reason 0x13 Reason: Remote User Terminated ConnectionI do not know why :/
-
@lavolp3 Oke I have pushed some changes, see: https://github.com/timodejong95/MMM-BluetoothDevices. Don’t forget
npm install.I updated the configuration see docs. You need to add a track key to the device config with the value ‘battery’:
example:
devices: [ { type: 'OralBToothbrush', name: 'oralb', mac: 'xxx', tracks: ['battery'], format: 'formatted' }, ],It’s still a bit buggy let me know what your experience is!
-
@timodejong95 No luck yet.
No Battery status to be seen and this error in the logs0|mm | [2020-04-20 01:21:08.432] [ERROR] 01:21:08 <error> (node:23220) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON 0|mm | --> starting at object with constructor 'DBusObject' 0|mm | | property 'proxy' -> object with constructor 'Object' 0|mm | | property 'org.freedesktop.DBus.Introspectable' -> object with constructor 'DBusInterface' 0|mm | --- property '$parent' closes the circle 0|mm | at JSON.stringify (<anonymous>) 0|mm | at /home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/index.js:24:25 0|mm | at processTicksAndRejections (internal/process/task_queues.js:89:5) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) 0|mm | [2020-04-20 01:21:08.435] [ERROR] 01:21:08 <error> (node:23220) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON 0|mm | --> starting at object with constructor 'DBusObject' 0|mm | | property 'proxy' -> object with constructor 'Object' 0|mm | | property 'org.freedesktop.DBus.Introspectable' -> object with constructor 'DBusInterface' 0|mm | --- property '$parent' closes the circle 0|mm | at JSON.stringify (<anonymous>) 0|mm | at /home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/index.js:24:25 0|mm | at processTicksAndRejections (internal/process/task_queues.js:89:5) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) -
@lavolp3 Damm ashame, could you post the logs above the error? If correct there should be 2 more error logs, and just to be sure it still works when you remove the battery track, right?
-
@timodejong95
I have removed the module, installed again and added the extra piece of configuration. The updated UI is working fine, but there is no battery indicator. Is this the log you are looking for?[2020-04-22 19:40:43.278] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:40:43.389] [LOG] MMM-BluetoothDevices trying to connect to: OralB 1/2
[2020-04-22 19:40:53.451] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:40:53.673] [LOG] MMM-BluetoothDevices trying to connect to: OralB 2/2
[2020-04-22 19:40:59.444] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:41:10.482] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:41:13.767] [ERROR] MMM-BluetoothDevices unhandled exception:
[2020-04-22 19:41:13.771] [ERROR] MMM-BluetoothDevices Error: Error: waitForServicesResolved: timeout exceeded
[2020-04-22 19:41:13.774] [ERROR] MMM-BluetoothDevices {“troubleshooting”:“devices#resolve-services”,“extra”:{}}
[2020-04-22 19:41:21.451] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:41:32.477] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:41:43.546] [LOG] MMM-BluetoothDevices received device update for OralB
[2020-04-22 19:41:54.482] [LOG] MMM-BluetoothDevices received device update for OralB -
@timodejong95 there are no logs above that.
I get this error before I started the brush[2020-04-23 00:19:17.258] [ERROR] 00:19:17 <error> MMM-BluetoothDevices unhandled exception: (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:47 Logger.error) [2020-04-23 00:19:17.263] [ERROR] 00:19:17 <error> MMM-BluetoothDevices Error: Error: Couldn't connect to BABSIS OralB after 2 tries. (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:47 Logger.error) [2020-04-23 00:19:17.277] [ERROR] 00:19:17 <error> (node:2929) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON --> starting at object with constructor 'DBusObject' | property 'proxy' -> object with constructor 'Object' | property 'org.freedesktop.DBus.Introspectable' -> object with constructor 'DBusInterface' --- property '$parent' closes the circle at JSON.stringify (<anonymous>) at /home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/index.js:24:25 at processTicksAndRejections (internal/process/task_queues.js:89:5) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:19:17.284] [ERROR] 00:19:17 <error> (node:2929) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON --> starting at object with constructor 'DBusObject' | property 'proxy' -> object with constructor 'Object' | property 'org.freedesktop.DBus.Introspectable' -> object with constructor 'DBusInterface' --- property '$parent' closes the circle at JSON.stringify (<anonymous>) at /home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/index.js:24:25 at processTicksAndRejections (internal/process/task_queues.js:89:5) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:19:17.289] [ERROR] 00:19:17 <error> (node:2929) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:19:17.293] [ERROR] 00:19:17 <error> (node:2929) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:19:17.296] [ERROR] 00:19:17 <error> (node:2929) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:19:17.299] [ERROR] 00:19:17 <error> (node:2929) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:23:44.731] [LOG] 00:23:44 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:23:47.096] [LOG] 00:23:47 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:23:57.944] [LOG] 00:23:57 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:24:08.935] [LOG] 00:24:08 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:24:19.917] [LOG] 00:24:19 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:24:30.925] [LOG] 00:24:30 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:24:41.961] [LOG] 00:24:41 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:24:52.927] [LOG] 00:24:52 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:25:03.965] [LOG] 00:25:03 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:25:14.860] [LOG] 00:25:14 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:25:25.926] [LOG] 00:25:25 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:25:36.875] [LOG] 00:25:36 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:25:47.877] [LOG] 00:25:47 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:25:58.907] [LOG] 00:25:58 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log)This error vanishes when I deactivate the JSON.stringify function.
I have the feeling that everything is working, but the battery is not showing up at all.Also, when closing the mirror (ctrl+c when I started it with
npm start dev) I get these errors:[2020-04-23 00:38:03.482] [ERROR] 00:38:03 <error> (node:4615) UnhandledPromiseRejectionWarning: TypeError: device.destroy is not a function at Dongle.disconnectDevices (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Dongle.js:223:28) at Dongle.destroy (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Dongle.js:58:17) at Class.stop (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_helper.js:46:23) at App.stop (/home/pi/MagicMirror/js/app.js:252:16) at App.<anonymous> (/home/pi/MagicMirror/js/electron.js:108:7) at App.emit (events.js:200:13) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:38:03.486] [ERROR] 00:38:03 <error> (node:4615) UnhandledPromiseRejectionWarning: TypeError: device.destroy is not a function at Dongle.disconnectDevices (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Dongle.js:223:28) at Dongle.destroy (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Dongle.js:58:17) at Class.stop (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_helper.js:46:23) at App.stop (/home/pi/MagicMirror/js/app.js:252:16) at App.<anonymous> (/home/pi/MagicMirror/js/electron.js:108:7) at App.emit (events.js:200:13) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:38:03.489] [ERROR] 00:38:03 <error> (node:4615) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:38:03.495] [ERROR] 00:38:03 <error> (node:4615) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4) (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:38:03.503] [ERROR] 00:38:03 <error> (node:4615) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) [2020-04-23 00:38:03.509] [ERROR] 00:38:03 <error> (node:4615) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (/home/pi/MagicMirror/internal/process/warning.js:27 writeOut) -
-
and more debugging messages, sorry for the spamming:
[2020-04-23 00:51:53.902] [LOG] 00:51:53 <log> MMM-BluetoothDevices starting hub (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_helper.js:23 Class.startHub) [2020-04-23 00:51:58.845] [LOG] 00:51:58 <log> MMM-BluetoothDevices unhandled adapter msg: {"serial":1536,"path":"/org/bluez/hci0","interface":"org.freedesktop.DBus.Properties","member":"PropertiesChanged","signature":"sa{sv}as","sender":":1.8","type":4,"flags":1,"body":["org.bluez.Adapter1",[["UUIDs",[[{"type":"a","child":[{"type":"s","child":[]}]}],[["00001112-0000-1000-8000-00805f9b34fb","00001801-0000-1000-8000-00805f9b34fb","0000110e-0000-1000-8000-00805f9b34fb","00001800-0000-1000-8000-00805f9b34fb","00001200-0000-1000-8000-00805f9b34fb","0000110c-0000-1000-8000-00805f9b34fb","0000110a-0000-1000-8000-00805f9b34fb","0000111f-0000-1000-8000-00805f9b34fb","00001805-0000-1000-8000-00805f9b34fb"]]]]],[]]} (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:32 Logger.debug) [2020-04-23 00:52:01.474] [LOG] 00:52:01 <log> MMM-BluetoothDevices unhandled adapter msg: {"serial":1542,"path":"/org/bluez/hci0","interface":"org.freedesktop.DBus.Properties","member":"PropertiesChanged","signature":"sa{sv}as","sender":":1.8","type":4,"flags":1,"body":["org.bluez.Adapter1",[["Discovering",[[{"type":"b","child":[]}],[true]]]],[]]} (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:32 Logger.debug) [2020-04-23 00:52:01.993] [LOG] 00:52:01 <log> MMM-BluetoothDevices trying to connect to: DIRKS OralB 1/2 (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:52:13.667] [LOG] 00:52:13 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:52:13.834] [LOG] 00:52:13 <log> MMM-BluetoothDevices awaiting services for device: DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:32 Logger.debug) [2020-04-23 00:52:17.445] [LOG] 00:52:17 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:52:23.028] [LOG] 00:52:23 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:52:33.871] [ERROR] 00:52:33 <error> MMM-BluetoothDevices unhandled exception: (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:47 Logger.error) [2020-04-23 00:52:33.875] [ERROR] 00:52:33 <error> MMM-BluetoothDevices Error: Error: waitForServicesResolved: timeout exceeded (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:47 Logger.error) [2020-04-23 00:52:33.905] [LOG] 00:52:33 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:52:44.875] [LOG] 00:52:44 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:52:55.859] [LOG] 00:52:55 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:53:06.911] [LOG] 00:53:06 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:53:17.884] [LOG] 00:53:17 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) [2020-04-23 00:53:28.849] [LOG] 00:53:28 <log> MMM-BluetoothDevices received device update for DIRKS OralB (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:17 Logger.log) -
@lavolp3 No worries, check I will have a look at this when I find some time, probably this weekend. Seems that the devices couldn’t connect at the first try but failed in de second which is triggered instantly.
@djerik Thanks for sharing
I will try and fix the issues you send to be, thanks for sharing and excuses for the bugs! I might write some tests because the manual tests are stacking up and code coverage is always good.
-
@timodejong95 said in MMM-OralB / Bluetooth equipped toothbrush integration:
@lavolp3 No worries, check I will have a look at this when I find some time, probably this weekend. Seems that the devices couldn’t connect at the first try but failed in de second which is triggered instantly.
I don’t have a problem with that. Devices are connecting well as soon as I activate them. Everything works really well except no battery status shown.
Apparently the waitForService process ends unresolved, hence is not able to get the information from the battery service[2020-04-23 00:52:33.875] [ERROR] 00:52:33 MMM-BluetoothDevices Error: Error: waitForServicesResolved: timeout exceeded (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Logger.js:47 Logger.error) -
@lavolp3 Check I get you. Just to be sure, you did do
npm installI changed a package? If not then I will comeback to it when I have tested it myself. -
@timodejong95 said in MMM-OralB / Bluetooth equipped toothbrush integration:
@lavolp3 Check I get you. Just to be sure, you did do
npm installI changed a package? If not then I will comeback to it when I have tested it myself.Yes I did.
Did it now again (but no new installations) and trying again tonight -
@lavolp3 Oké check, well no need to try again tonight because your up-to-date then. I will let you know when I have looked at it. For now you can prevent the errors by removing the battery in the tracks array.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login