demirhanaydin / node-mi-flora

Node package for Xiaomi Mi Flora Plant Sensor
53 stars 21 forks source link

Do you know if the sensor data is in advertisement message? #2

Closed danielbh closed 7 years ago

danielbh commented 7 years ago

In other words is it required to connect in order to read sensor data? I'm getting a flora soon and was curious if you knew. Thanks.

demirhanaydin commented 7 years ago

As far as I know, advertised message does not contain sensor data. You have to connect to be able to access characteristics (which is what the library does for you) and read data from them. Checkout the links below for more info. I've learned a lot from those links when I was working on this library.

https://wiki.hackerspace.pl/projects:xiaomi-flora https://www.open-homeautomation.com/2016/08/23/reverse-engineering-the-mi-plant-sensor/

danielbh commented 7 years ago

Thanks for responding so quickly. Yeah I read those. It seems unclear to me after reading them if the answer is yes or no. You seem unsure. Have you looked at the advertising message after connecting to the sensors the first time? Thanks for any help you could provide. I will probably be using this project when my sensors arrive.

demirhanaydin commented 7 years ago

Here is what you'll get when you run noble's advertisement-discovery example. As you can see, advertised data is under fe95 service but sensor data is in another service according to my observations and also the links that I've shared. Would be cool to access data without connecting the device but it seems it's not possible right now.

peripheral discovered (ID with address <MAC, unknown>, connectable true, RSSI -62:
    hello my local name is:
        Flower care
    can I interest you in any of the following advertised services:
        ["fe95"]
    here is my service data:
        "fe95": "310298000a394c628d7cc40d"
danielbh commented 7 years ago

Ok thanks for answering my questions. I appreciate it very much.

ppannuto commented 6 years ago

Came across this in a similar search, just wanted to note for future folk that much of the information is in the advertisement, no need to connect. This library has an example of how to parse the advertisement: https://github.com/AlCalzone/ioBroker.ble/blob/master/src/plugins/lib/xiaomi_protocol.ts