• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-OralB / Bluetooth equipped toothbrush integration

Scheduled Pinned Locked Moved Development
68 Posts 13 Posters 23.5k Views 20 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    lavolp3 Module Developer @timodejong95
    last edited by Apr 16, 2020, 9:53 AM

    @timodejong95 Hi Timo,

    since I really want to have the battery status I am currently trying to use the front end code with noble as backend in node_helper. Your backend code and all the GATT bluez stuff is much too complicated for me.

    Also, I have done some tweaks on the frontend:

    • Hide timer after some time
    • convert time to m:ss
    • also count on beyond 2 minutes (circle is filled after 2 Minutes)
    • make timer bright and circle blue when the brush is running and dim it back again if it is not running.

    Like it very much. Very simple tweaks in the main.js. Let me know if you want to see any of it.

    Also, two brushes work perfectly! :ok_hand:

    Impressive work man!

    How to troubleshoot modules
    MMM-soccer v2, MMM-AVStock

    1 Reply Last reply Reply Quote 0
    • T Offline
      timodejong95
      last edited by Apr 16, 2020, 6:00 PM

      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.

      L 1 Reply Last reply Apr 16, 2020, 9:57 PM Reply Quote 0
      • T Offline
        timodejong95
        last edited by Apr 16, 2020, 7:39 PM

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • L Offline
          lavolp3 Module Developer @timodejong95
          last edited by lavolp3 Apr 16, 2020, 9:58 PM Apr 16, 2020, 9:57 PM

          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

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          1 Reply Last reply Reply Quote 1
          • T Offline
            timodejong95
            last edited by timodejong95 Apr 17, 2020, 6:43 AM Apr 17, 2020, 6:41 AM

            @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.

            L 1 Reply Last reply Apr 17, 2020, 8:16 AM Reply Quote 0
            • L Offline
              lavolp3 Module Developer @timodejong95
              last edited by Apr 17, 2020, 8:16 AM

              @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 thread

              When 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 Configuration
              

              Do we have to look into one of these characteristics/desricptors for the value?

              How to troubleshoot modules
              MMM-soccer v2, MMM-AVStock

              L 1 Reply Last reply Apr 17, 2020, 8:25 AM Reply Quote 0
              • L Offline
                lavolp3 Module Developer @lavolp3
                last edited by Apr 17, 2020, 8:25 AM

                @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 Configuration
                

                The characteristic is the one the referenced noble code is filtering for.

                Now GO Timo!
                Make brushing great again!

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                T 1 Reply Last reply Apr 18, 2020, 5:38 PM Reply Quote 0
                • T Offline
                  timodejong95 @lavolp3
                  last edited by Apr 18, 2020, 5:38 PM

                  @lavolp3

                  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.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    timodejong95
                    last edited by Apr 18, 2020, 9:30 PM

                    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 Connection
                    

                    I do not know why :/

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      timodejong95
                      last edited by Apr 19, 2020, 7:10 PM

                      @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!

                      L 1 Reply Last reply Apr 20, 2020, 8:09 AM Reply Quote 1
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 5 / 7
                      5 / 7
                      • First post
                        41/68
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy