demirhanaydin / node-mi-flora

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

Spotty telemetry. #13

Closed GAZ082 closed 6 years ago

GAZ082 commented 6 years ago

Hi there. I'm having spotty telemetry from the device. I check it every 20 minutes (the device has latest firmware, 3.8.1). If i do it manually in Node Red i always get data, but when i leave it alone i get somethig like this: ` {"time":"2017-12-28T04:37:49.919Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":25,"moist":23,"light":42,"conductivity":133,"batteryLevel":100}

{"time":"2017-12-28T05:37:39.513Z","address":"c4:7c:8d:65:cc:a9","rssi":-89,"temp":25.2,"moist":22,"light":27,"conductivity":129}

{"time":"2017-12-28T05:57:39.691Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":24.3,"moist":22,"light":45,"conductivity":127,"batteryLevel":100}

{"time":"2017-12-28T07:17:38.332Z","address":"c4:7c:8d:65:cc:a9","rssi":-95,"temp":23.6,"moist":21,"light":8,"conductivity":127}

{"time":"2017-12-28T07:37:37.330Z","address":"c4:7c:8d:65:cc:a9","rssi":-89}

{"time":"2017-12-28T07:57:37.282Z","address":"c4:7c:8d:65:cc:a9","rssi":-89}

{"time":"2017-12-28T08:17:38.271Z","address":"c4:7c:8d:65:cc:a9","rssi":-96}

{"time":"2017-12-28T08:37:44.256Z","address":"c4:7c:8d:65:cc:a9","rssi":-89}

{"time":"2017-12-28T08:57:42.270Z","address":"c4:7c:8d:65:cc:a9","rssi":-97}

{"time":"2017-12-28T09:17:39.154Z","address":"c4:7c:8d:65:cc:a9","rssi":-88}

{"time":"2017-12-28T09:37:38.164Z","address":"c4:7c:8d:65:cc:a9","rssi":-93}

{"time":"2017-12-28T10:17:38.060Z","address":"c4:7c:8d:65:cc:a9","rssi":-95}

{"time":"2017-12-28T10:37:46.057Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":26.5,"moist":20,"light":5393,"conductivity":112,"batteryLevel":100}

{"time":"2017-12-28T10:57:45.945Z","address":"c4:7c:8d:65:cc:a9","rssi":-94,"temp":27,"moist":20,"light":5772,"conductivity":109,"batteryLevel":100}

{"time":"2017-12-28T11:17:40.160Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":28.4,"moist":20,"light":8533,"conductivity":107,"batteryLevel":100}

{"time":"2017-12-28T11:37:40.148Z","address":"c4:7c:8d:65:cc:a9","rssi":-92,"temp":28.8,"moist":20,"light":7467,"conductivity":104,"batteryLevel":100} `

I merged both data streams in an object. There is response from the bluetooth interface (you have the address and the signal strenght) but the data is not there.

demirhanaydin commented 6 years ago

The library just reflects what the device provides. What I suggest you to do in node red as a fallback is that whenever you connect to device every 20 mins, give some time to device, skip the unfilled data, stay connected and wait until you get the data that you'd like to read.

GAZ082 commented 6 years ago

Do you know what's the connection stay alive time?

demirhanaydin commented 6 years ago

I've never measured it to be honest. But when I was developing the library, i have connected too many times to my device and it caused to run out battery faster than expected.