Coder Social home page Coder Social logo

Comments (7)

Ernst79 avatar Ernst79 commented on June 27, 2024 1

It would save some bytes from the advertisements, as as one doesn't have to include the name anymore.

However, wouldn't this change force a sensor device to keep it awake all the time? It needs to be able to receive a request for its characteristics, so it can't go into a deep sleep, like the b-parisite sensors do, if I remember correct @rbaron

from bthome.io.

bdraco avatar bdraco commented on June 27, 2024

We could also interleave the advertisements to send this hourly and on first boot so we don't have to make a connection very often. Once it does makes a connection it never has to do it again.. or not at all if it saw it boot (also would handle passive only ones).

from bthome.io.

Ernst79 avatar Ernst79 commented on June 27, 2024

Maybe a different idea, if we include 2 bytes device_flag, we can add the above device characteristics in the code directly. This would add two bytes, but it saves al least 3 bytes of the name advertisement (len byte + name flag (0x09) + the actual name). Moreover, it would remove the need to make an active connection.

The only downside I see is that a user has to make a request to have its device_flag added to the code. But we can allow the old way as well (without device_flag, but with name).

e.g.

device_flag= "0x34AB" --> {
    "name": "b-parisite",
    "model": "plant sensor v1",
    "manufacturer": "rbaron",
    "firmware": "b-parasite firmware",
    "firmware version": "2.0",
    "broadcasting_interval": 600,
}

from bthome.io.

balloob avatar balloob commented on June 27, 2024

I guess bdraco's idea of transmitting device info once an hour works too. It's just a bid annoying because Home Assistant will need to allocate the device and it won't know the name.

from bthome.io.

Ernst79 avatar Ernst79 commented on June 27, 2024

That is why I propose to add a 2 byte device_flag in each message. In that way, each message has the device info (which we store in bthome-ble pypi package) linked to the device_flag bytes (2 bytes).

No need to send the name info anymore than, so in the end it would safe bytes, and we can define all the info in the bthome-ble parser pypi package we want.

Xiaomi does the same, they also have a 2 byte device identifier in the payload.

from bthome.io.

Ernst79 avatar Ernst79 commented on June 27, 2024

As discussed on discord, we abandoned the idea of a device_flag with 2 bytes that identify predefined devices and will define a device_info_available flag to tell that device information is available as GATT characteristic. The (yet to be defined) GATT characteristic(s) holds device information and (if safely possible) the 16 byte encryption key.

Example is the pvvx ATC firmware, that also holds device info and keys, that can be read after connecting to the device
https://github.com/pvvx/ATC_MiThermometer#control-function-id-when-connected

from bthome.io.

Ernst79 avatar Ernst79 commented on June 27, 2024

Moved the issue to the Bluetooth-Devices/bthome-ble repo. Bluetooth-Devices/bthome-ble#25

from bthome.io.

Related Issues (15)

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.