tim-hellhake / mi-flora-adapter

Mozilla Public License 2.0
1 stars 3 forks source link

Add battery level? #8

Closed flatsiedatsie closed 4 years ago

flatsiedatsie commented 5 years ago

Perhaps it could be nice to add battery level as a property too. Or is it already possible to check on the battery level somehow?

tim-hellhake commented 5 years ago

https://github.com/mozilla-iot/addon-list/pull/364

tim-hellhake commented 5 years ago

Can you test it when it's out?

flatsiedatsie commented 5 years ago

I can see the battery property. Getting an error though:

2019-07-20 23:58:54.433 INFO   : mi-flora: Discovered services
2019-07-20 23:58:54.553 INFO   : mi-flora: Discovered characteristics
2019-07-20 23:58:54.597 INFO   : mi-flora: Enabled sensor mode
2019-07-20 23:58:54.628 INFO   : mi-flora: Read data characteristic
2019-07-20 23:58:54.630 INFO   : mi-flora: Unhandled Rejection
2019-07-20 23:58:54.631 ERROR  : mi-flora: TypeError: Cannot read property 'read' of undefined
2019-07-20 23:58:54.632 ERROR  : mi-flora:     at Promise (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:173:22)
2019-07-20 23:58:54.633 ERROR  : mi-flora:     at new Promise (<anonymous>)
2019-07-20 23:58:54.634 ERROR  : mi-flora:     at MiFlora.read (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:172:12)
2019-07-20 23:58:54.634 ERROR  : mi-flora:     at MiFlora.poll (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:104:33)
2019-07-20 23:58:54.635 ERROR  : mi-flora:     at <anonymous>
2019-07-20 23:58:57.047 INFO   : mi-flora: Connecting to MiFlora-c4:7c:ETC
2019-07-20 23:58:59.041 INFO   : mi-flora: Connected to MiFlora-c4:7c:ETC
2019-07-20 23:58:59.270 ERROR  : voice-addon: problem with request: connect ECONNREFUSED 127.0.0.1:4443
2019-07-20 23:58:59.288 INFO   : mi-flora: Discovered services
2019-07-20 23:58:59.356 INFO   : mi-flora: Discovered characteristics
2019-07-20 23:58:59.378 INFO   : mi-flora: Enabled sensor mode
2019-07-20 23:58:59.394 INFO   : mi-flora: Read data characteristic
2019-07-20 23:58:59.395 INFO   : mi-flora: Unhandled Rejection
2019-07-20 23:58:59.396 ERROR  : mi-flora: TypeError: Cannot read property 'read' of undefined
2019-07-20 23:58:59.397 ERROR  : mi-flora:     at Promise (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:173:22)
2019-07-20 23:58:59.398 ERROR  : mi-flora:     at new Promise (<anonymous>)
2019-07-20 23:58:59.398 ERROR  : mi-flora:     at MiFlora.read (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:172:12)
2019-07-20 23:58:59.399 ERROR  : mi-flora:     at MiFlora.poll (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:104:33)
2019-07-20 23:58:59.400 ERROR  : mi-flora:     at <anonymous>
tim-hellhake commented 5 years ago

Ok that's strange. You mentioned in another issue that you didn't update the firmware because of privacy reasons. Maybe the characteristic is only present in later versions?

flatsiedatsie commented 5 years ago

The latest version really doesn't work at all. No values are updated. I'm not spotting any errors in the log.

flatsiedatsie commented 5 years ago

Restarting the add-on lead to some errors.

2019-07-23 11:16:13.831 INFO   : mi-flora: Connecting to MiFlora-c4:7c:8d:62:80:74
2019-07-23 11:16:14.522 INFO   : mi-flora: Connecting to MiFlora-c4:7c:8d:6a:71:5a
2019-07-23 11:16:14.580 INFO   : mi-flora: Connected to MiFlora-c4:7c:8d:62:80:74
2019-07-23 11:16:14.741 INFO   : mi-flora: Discovered services
2019-07-23 11:16:14.809 INFO   : mi-flora: Discovered characteristics
2019-07-23 11:16:14.823 INFO   : mi-flora: Enabled sensor mode
2019-07-23 11:16:14.838 INFO   : mi-flora: Read data characteristic
2019-07-23 11:16:14.839 INFO   : mi-flora: Unhandled Rejection
2019-07-23 11:16:14.841 ERROR  : mi-flora: TypeError: Cannot read property 'read' of undefined
2019-07-23 11:16:14.841 ERROR  : mi-flora:     at Promise (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:173:22)
2019-07-23 11:16:14.843 ERROR  : mi-flora:     at new Promise (<anonymous>)
2019-07-23 11:16:14.844 ERROR  : mi-flora:     at MiFlora.read (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:172:12)
2019-07-23 11:16:14.845 ERROR  : mi-flora:     at MiFlora.poll (/home/pi/.mozilla-iot/addons/mi-flora-adapter/mi-flora-adapter.js:104:33)
2019-07-23 11:16:14.846 ERROR  : mi-flora:     at <anonymous>
tim-hellhake commented 5 years ago

It should work again with the new version.

flatsiedatsie commented 5 years ago

It does! Thank you for the update. I wanted to wait until I was completely sure that the interval settings didn't disappear again to tell you.

flatsiedatsie commented 5 years ago

So far only one of my three devices has any values.

Of the one that does have values, the battery level does not seem to be reported?

battery_level

I've set the interval to 30 minutes to test it.

Here are my logs:

Original installation and setting it to 1440 minutes:

2019-07-26 08:08:24.724 INFO   : Fetching add-on https://s3-us-west-2.amazonaws.com/mozilla-gateway-addons/mi-flora-adapter-0.2.1-linux-arm-v8.tgz as /tmp/n78O2a/mi-flora-adapter.tar.gz
2019-07-26 08:08:26.962 INFO   : Expanding add-on /tmp/n78O2a/mi-flora-adapter.tar.gz into /home/pi/.mozilla-iot/addons/mi-flora-adapter
2019-07-26 08:08:29.123 INFO   : Loading add-on: mi-flora-adapter
2019-07-26 08:08:29.586 INFO   : mi-flora: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2019-07-26 08:08:29.616 INFO   : mi-flora: Loading add-on for mi-flora-adapter from /home/pi/.mozilla-iot/addons/mi-flora-adapter
2019-07-26 08:08:30.012 INFO   : mi-flora: The pollInterval is 30 minutes
2019-07-26 08:08:30.026 INFO   : mi-flora: Noble adapter is poweredOn
2019-07-26 08:08:30.028 INFO   : mi-flora: Start scanning for devices
2019-07-26 08:08:30.378 INFO   : mi-flora: Detected new mi flora c4
2019-07-26 08:08:30.380 INFO   : mi-flora: Adding mi flora c4:7 to known devices
2019-07-26 08:08:30.777 INFO   : mi-flora: Detected new mi flora c4:
2019-07-26 08:08:30.779 INFO   : mi-flora: Adding mi flora c4: to known devices
2019-07-26 08:08:31.879 INFO   : mi-flora: Detected new mi flora c4
2019-07-26 08:08:31.880 INFO   : mi-flora: Adding mi flora c4: to known devices
2019-07-26 08:09:01.785 INFO   : Unloading MiFloraAdapter
2019-07-26 08:09:01.790 INFO   : mi-flora: Adapter: MiFloraAdapter unloaded
2019-07-26 08:09:05.578 INFO   : Loading add-on: mi-flora-adapter
2019-07-26 08:09:06.070 INFO   : mi-flora: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2019-07-26 08:09:06.100 INFO   : mi-flora: Loading add-on for mi-flora-adapter from /home/pi/.mozilla-iot/addons/mi-flora-adapter
2019-07-26 08:09:06.508 INFO   : mi-flora: The pollInterval is 1440 minutes
2019-07-26 08:09:06.522 INFO   : mi-flora: Noble adapter is poweredOn
2019-07-26 08:09:06.524 INFO   : mi-flora: Start scanning for devices
2019-07-26 08:09:06.833 INFO   : mi-flora: Detected new mi flora c4:7
2019-07-26 08:09:06.834 INFO   : mi-flora: Adding mi flora c4:7c to known devices
2019-07-26 08:09:07.051 INFO   : mi-flora: Detected new mi flora c4:7
2019-07-26 08:09:07.053 INFO   : mi-flora: Adding mi flora c4:7c to known devices
2019-07-26 08:09:07.564 INFO   : mi-flora: Detected new mi flora c4
2019-07-26 08:09:07.565 INFO   : mi-flora: Adding mi flora c4:7c to known devices

On every reboot it says it's added a new device to the devices list, for all three devices. Even thoguh it has already spotted them earlier?

2019-07-26 08:45:29.473 INFO   : mi-flora: Connecting to MiFlora-c4:7
2019-07-26 08:45:29.489 INFO   : mi-flora: Connecting to MiFlora-c4:7c:
2019-07-26 08:45:30.438 INFO   : mi-flora: Connected to MiFlora-c4:7c
2019-07-26 08:45:30.475 INFO   : mi-flora: Connected to MiFlora-c4:7
2019-07-26 08:45:30.629 INFO   : mi-flora: Discovered services
2019-07-26 08:45:30.654 INFO   : mi-flora: Discovered services
2019-07-26 08:45:30.689 INFO   : mi-flora: Discovered characteristics
2019-07-26 08:45:30.703 INFO   : mi-flora: Enabled sensor mode
2019-07-26 08:45:30.719 INFO   : mi-flora: Read data characteristic
2019-07-26 08:45:30.720 INFO   : mi-flora: No firmware characteristic found
2019-07-26 08:45:30.722 INFO   : mi-flora: Saving new values to config
2019-07-26 08:45:30.909 INFO   : mi-flora: Discovered characteristics
2019-07-26 08:45:30.954 INFO   : mi-flora: Enabled sensor mode
2019-07-26 08:45:30.984 INFO   : mi-flora: Read data characteristic
2019-07-26 08:45:30.986 INFO   : mi-flora: No firmware characteristic found
2019-07-26 08:45:30.988 INFO   : mi-flora: Saving new values to config
2019-07-26 08:45:31.055 INFO   : mi-flora: Connecting to MiFlora-c4
2019-07-26 08:45:32.030 INFO   : mi-flora: Connected to MiFlora-c4:
2019-07-26 08:45:32.183 INFO   : mi-flora: Discovered services
2019-07-26 08:45:32.243 INFO   : mi-flora: Discovered characteristics
2019-07-26 08:45:32.258 INFO   : mi-flora: Enabled sensor mode
2019-07-26 08:45:32.274 INFO   : mi-flora: Read data characteristic
2019-07-26 08:45:32.275 INFO   : mi-flora: No firmware characteristic found
2019-07-26 08:45:32.276 INFO   : mi-flora: Saving new values to config

And then 30 minutes later:

2019-07-26 09:15:29.476 INFO   : mi-flora: Connecting to MiFlora-c4:7
2019-07-26 09:15:29.489 INFO   : mi-flora: Connecting to MiFlora-c4:7c
2019-07-26 09:15:29.708 INFO   : mi-flora: Connected to MiFlora-c4:7c
2019-07-26 09:15:29.903 INFO   : mi-flora: Discovered services
2019-07-26 09:15:30.014 INFO   : mi-flora: Discovered characteristics
2019-07-26 09:15:30.029 INFO   : mi-flora: Enabled sensor mode
2019-07-26 09:15:30.044 INFO   : mi-flora: Read data characteristic
2019-07-26 09:15:30.046 INFO   : mi-flora: No firmware characteristic found
2019-07-26 09:15:30.047 INFO   : mi-flora: Saving new values to config
2019-07-26 09:15:30.423 INFO   : mi-flora: Connected to MiFlora-c4:7c:8d:6a:71:5a
2019-07-26 09:15:30.606 INFO   : mi-flora: Discovered services
2019-07-26 09:15:30.738 INFO   : mi-flora: Discovered characteristics
2019-07-26 09:15:30.783 INFO   : mi-flora: Enabled sensor mode
2019-07-26 09:15:30.813 INFO   : mi-flora: Read data characteristic
2019-07-26 09:15:30.815 INFO   : mi-flora: No firmware characteristic found
2019-07-26 09:15:30.816 INFO   : mi-flora: Saving new values to config
2019-07-26 09:15:31.056 INFO   : mi-flora: Connecting to MiFlora-c4:7
2019-07-26 09:15:31.249 INFO   : mi-flora: Connected to MiFlora-c4:7c:
2019-07-26 09:15:31.405 INFO   : mi-flora: Discovered services
2019-07-26 09:15:31.465 INFO   : mi-flora: Discovered characteristics
2019-07-26 09:15:31.480 INFO   : mi-flora: Enabled sensor mode
2019-07-26 09:15:31.495 INFO   : mi-flora: Read data characteristic
2019-07-26 09:15:31.498 INFO   : mi-flora: No firmware characteristic found
2019-07-26 09:15:31.499 INFO   : mi-flora: Saving new values to config
flatsiedatsie commented 5 years ago

All three devices have a moisture value now. None of them have a battery level though.

flatsiedatsie commented 5 years ago

On a fresh install I had the add-on running all day with an interval of 30 minutes. After all this time the value of only one device is visible.

Two of the sensors are next to each other, so range isn't a likely culprit.

Could it be that:

One of my devices is older, while the other two are brand new. Perhaps that could have something to do with it?

flatsiedatsie commented 5 years ago

I had reset it back to 1440 minutes interval.

This morning two of them are back to 0%

Beejeedeb commented 5 years ago

I bought 2 devices and only get one value after the first add-on. Not much happens after that.

tim-hellhake commented 5 years ago

@flatsiedatsie Sorry I didn't saw your last messages until now.

None of them have a battery level though.

I suppose the older firmware version does not support that.

On a fresh install I had the add-on running all day with an interval of 30 minutes. After all this time the value of only one device is visible.

I'll add a few debug logs in the next days. Then we can see what's actually happening.

flatsiedatsie commented 5 years ago

Great. Currently the add-on doesn't really work for me :-(

Beejeedeb commented 5 years ago

firmware version on the Mi Flora sensors I have is 3.2.1.

link to page with more information about the Mi Flora. For example you can let the led blink on top of the sensor if you read the information. Nice for debugging.

flatsiedatsie commented 5 years ago

I have one ancient one, and two cheap Chinese ones I bought recently. For privacy reasons I never connect (or even install) the Xiaomi app, so I can't update them.

tim-hellhake commented 5 years ago

@flatsiedatsie I checked the source code and the most parts a pretty well covered by logs.

I would suggest the following:

  1. Restart the gateway.
  2. Look for messages like Detected new mi flora. There should be one for each mi flora device. If there is one missing the bluetooth controller is not able to see the device at all.
  3. Right after the detection of a mi flora device it should be polled. This begins with the message Connecting to and ends with the message Saving new values to config. The actual values are read shortly after the message Read data characteristic.
  4. Wait for a few poll intervals and check if the messages are still complete in the log
tim-hellhake commented 5 years ago

@Beejeedeb

I bought 2 devices and only get one value after the first add-on. Not much happens after that.

You mean the values do not change after that? Did you get an initial value for both devices?

Beejeedeb commented 5 years ago

@Beejeedeb

I bought 2 devices and only get one value after the first add-on. Not much happens after that.

You mean the values do not change after that? Did you get an initial value for both devices?

I have to test this again because I think the problems started because my wife installed the Mi Flora App and was also connecting to the Mi Flora via the app. There can of course only be one device connected to the Mi Flora exchanging data. The Mi Flora connects to the device that is active looking for the Mi Flora at that moment. I can "steal" one Mi Flora back from my wife for testing purposes :-)

flatsiedatsie commented 5 years ago

I installed the latest version onto a clean system.

It only detected one of my MiFlora devices. It did not show battery level.

In the log:

2019-09-11 21:32:04.194 INFO   : mi-flora: Connecting to MiFlora-c4:7c:8d:62:80:74
2019-09-11 21:32:06.601 INFO   : mi-flora: Connected to MiFlora-c4:7c:------
2019-09-11 21:32:06.795 INFO   : mi-flora: Discovered services
2019-09-11 21:32:06.914 INFO   : mi-flora: Discovered characteristics
2019-09-11 21:32:06.945 INFO   : mi-flora: Enabled sensor mode
2019-09-11 21:32:06.974 INFO   : mi-flora: Read data characteristic
2019-09-11 21:32:06.976 INFO   : mi-flora: Update value for temperature of MiFlora-c4:7c:------ to 20.7
2019-09-11 21:32:06.976 INFO   : mi-flora: Update value for moisture of MiFlora-c4:7c:--------- to 39
2019-09-11 21:32:06.977 INFO   : mi-flora: No firmware characteristic found
2019-09-11 21:32:06.978 INFO   : mi-flora: Saving new values to config
tim-hellhake commented 5 years ago

It did not show battery level.

I don't know why but there seems to be no firmware characteristic available on your device. The battery level is located in this characteristic.

It only detected one of my MiFlora devices.

Just to be sure: this means there was only one Detected new mi flora message in the log? I see three possible explanations for this:

According to the older logs, they were detected in the past. Therefore I would rule out the second explanation.

Could you try to scan for the missing devices with a ble mobile app? This should also show you the advertised name.

flatsiedatsie commented 5 years ago

I changed the battery on a Chinese one (their plastic is a bit more green), and now it was spotted too.

No battery life indication on this one either though.

Do you have a recommendation for a BLE test app?

Beejeedeb commented 5 years ago

Two Mi Flora devices, one is still paired to the Android App. Both Mi Flora's are the light green versions with the latest Firmware 3.2.1. Only one Mi Flora (MiFlora-c4:7c:8d:6b:1d:28) is seen (this is the Mi Flora which is still paired to the Android App)

2019-09-12 17:00:57.045 INFO : Unloading MiFloraAdapter 2019-09-12 17:00:57.049 INFO : mi-flora: Adapter: MiFloraAdapter unloaded 2019-09-12 17:00:59.529 INFO : Loading add-on: mi-flora-adapter 2019-09-12 17:01:00.325 INFO : mi-flora: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3 2019-09-12 17:01:00.371 INFO : mi-flora: Loading add-on for mi-flora-adapter from /home/pi/.mozilla-iot/addons/mi-flora-adapter 2019-09-12 17:01:01.057 INFO : mi-flora: The pollInterval is 30 minutes 2019-09-12 17:01:01.059 INFO : mi-flora: Recreating mi flora c4:7c:8d:6b:1d:28 from knownDevices 2019-09-12 17:01:01.064 INFO : mi-flora: Loading last known value 21.4 for temperature of MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:01:01.066 INFO : mi-flora: Loading last known value 38 for moisture of MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:01:01.067 INFO : mi-flora: Update value for temperature of MiFlora-c4:7c:8d:6b:1d:28 to 21.4 2019-09-12 17:01:01.069 INFO : mi-flora: Update value for moisture of MiFlora-c4:7c:8d:6b:1d:28 to 38 2019-09-12 17:01:01.091 INFO : mi-flora: Noble adapter is poweredOn 2019-09-12 17:01:01.093 INFO : mi-flora: Start scanning for devices 2019-09-12 17:01:01.541 INFO : mi-flora: Detected new mi flora c4:7c:8d:6b:1d:28 2019-09-12 17:01:01.546 INFO : mi-flora: Connecting to MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:01:02.617 INFO : mi-flora: Connected to MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:01:02.791 INFO : mi-flora: Discovered services 2019-09-12 17:01:02.926 INFO : mi-flora: Discovered characteristics 2019-09-12 17:01:02.955 INFO : mi-flora: Enabled sensor mode 2019-09-12 17:01:02.986 INFO : mi-flora: Read data characteristic 2019-09-12 17:01:02.988 INFO : mi-flora: Update value for temperature of MiFlora-c4:7c:8d:6b:1d:28 to 21 2019-09-12 17:01:02.990 INFO : mi-flora: Update value for moisture of MiFlora-c4:7c:8d:6b:1d:28 to 38 2019-09-12 17:01:02.991 INFO : mi-flora: No firmware characteristic found 2019-09-12 17:01:02.994 INFO : mi-flora: Saving new values to config

After restarting (disable and enable add-on) several times also the second Mi Flora (MiFlora-c4:7c:8d:6b:26:8f) is seen. This Mi Flora (MiFlora-c4:7c:8d:6b:26:8f) is not paired to any other device.

2019-09-12 17:21:20.603 INFO : Unloading MiFloraAdapter 2019-09-12 17:21:20.606 INFO : mi-flora: Adapter: MiFloraAdapter unloaded 2019-09-12 17:21:22.199 INFO : Loading add-on: mi-flora-adapter 2019-09-12 17:21:23.015 INFO : mi-flora: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3 2019-09-12 17:21:23.065 INFO : mi-flora: Loading add-on for mi-flora-adapter from /home/pi/.mozilla-iot/addons/mi-flora-adapter 2019-09-12 17:21:23.783 INFO : mi-flora: The pollInterval is 30 minutes 2019-09-12 17:21:23.785 INFO : mi-flora: Recreating mi flora c4:7c:8d:6b:1d:28 from knownDevices 2019-09-12 17:21:23.789 INFO : mi-flora: Loading last known value 21 for temperature of MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:21:23.791 INFO : mi-flora: Loading last known value 38 for moisture of MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:21:23.792 INFO : mi-flora: Update value for temperature of MiFlora-c4:7c:8d:6b:1d:28 to 21 2019-09-12 17:21:23.794 INFO : mi-flora: Update value for moisture of MiFlora-c4:7c:8d:6b:1d:28 to 38 2019-09-12 17:21:23.816 INFO : mi-flora: Noble adapter is poweredOn 2019-09-12 17:21:23.818 INFO : mi-flora: Start scanning for devices 2019-09-12 17:21:24.365 INFO : mi-flora: Detected new mi flora c4:7c:8d:6b:26:8f 2019-09-12 17:21:24.366 INFO : mi-flora: Adding mi flora c4:7c:8d:6b:26:8f to known devices 2019-09-12 17:21:24.371 INFO : mi-flora: Connecting to MiFlora-c4:7c:8d:6b:26:8f 2019-09-12 17:21:24.486 INFO : mi-flora: Detected new mi flora c4:7c:8d:6b:1d:28 2019-09-12 17:21:24.488 INFO : mi-flora: Connecting to MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:21:25.485 INFO : mi-flora: Connected to MiFlora-c4:7c:8d:6b:26:8f 2019-09-12 17:21:27.574 INFO : mi-flora: Connected to MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:21:27.753 INFO : mi-flora: Discovered services 2019-09-12 17:21:27.889 INFO : mi-flora: Discovered characteristics 2019-09-12 17:21:27.933 INFO : mi-flora: Enabled sensor mode 2019-09-12 17:21:27.963 INFO : mi-flora: Read data characteristic 2019-09-12 17:21:27.965 INFO : mi-flora: Update value for temperature of MiFlora-c4:7c:8d:6b:1d:28 to 21 2019-09-12 17:21:27.967 INFO : mi-flora: Update value for moisture of MiFlora-c4:7c:8d:6b:1d:28 to 38 2019-09-12 17:21:27.968 INFO : mi-flora: No firmware characteristic found 2019-09-12 17:21:27.971 INFO : mi-flora: Saving new values to config

The sensor values of the MiFlora-c4:7c:8d:6b:26:8f are zero. Looks like it is detected and nothing more. Both sensors work fine in the Android app.

-

-

After half an hour.

019-09-12 17:51:24.369 INFO : mi-flora: Connecting to MiFlora-c4:7c:8d:6b:26:8f 2019-09-12 17:51:24.486 INFO : mi-flora: Connecting to MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:51:26.398 INFO : mi-flora: Connected to MiFlora-c4:7c:8d:6b:26:8f 2019-09-12 17:51:26.574 INFO : mi-flora: Connected to MiFlora-c4:7c:8d:6b:1d:28 2019-09-12 17:51:26.637 INFO : mi-flora: Discovered services 2019-09-12 17:51:26.639 INFO : mi-flora: Discovered services 2019-09-12 17:51:26.763 INFO : mi-flora: Discovered services 2019-09-12 17:51:26.847 INFO : mi-flora: Discovered characteristics 2019-09-12 17:51:26.849 INFO : mi-flora: Discovered characteristics 2019-09-12 17:51:26.874 INFO : mi-flora: Discovered characteristics 2019-09-12 17:51:26.904 INFO : mi-flora: Enabled sensor mode 2019-09-12 17:51:26.933 INFO : mi-flora: Read data characteristic 2019-09-12 17:51:26.937 INFO : mi-flora: Update value for temperature of MiFlora-c4:7c:8d:6b:1d:28 to 20.9 2019-09-12 17:51:26.938 INFO : mi-flora: Update value for moisture of MiFlora-c4:7c:8d:6b:1d:28 to 38 2019-09-12 17:51:26.941 INFO : mi-flora: No firmware characteristic found 2019-09-12 17:51:26.943 INFO : mi-flora: Saving new values to config

tim-hellhake commented 5 years ago

Do you have a recommendation for a BLE test app?

Nordic has a pretty decent one: https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp

tim-hellhake commented 5 years ago

2019-09-12 17:51:26.847 INFO : mi-flora: Discovered characteristics 2019-09-12 17:51:26.849 INFO : mi-flora: Discovered characteristics 2019-09-12 17:51:26.874 INFO : mi-flora: Discovered characteristics 2019-09-12 17:51:26.904 INFO : mi-flora: Enabled sensor mode

It looks like the second one is stuck in the enabling sensor mode phase.

tim-hellhake commented 5 years ago

@flatsiedatsie @Beejeedeb Which BLE Adapters are you using? Usually, there is a limit on how many connections they can handle simultaneously. Maybe thats an issue.

Beejeedeb commented 5 years ago

@flatsiedatsie @Beejeedeb Which BLE Adapters are you using? Usually, there is a limit on how many connections they can handle simultaneously. Maybe thats an issue.

Could be, I am using a Raspbery Pi with the Webthings Gateway 0.9.2 on an SD Card. I did not tweak the Linux version.

flatsiedatsie commented 5 years ago

I used a BLE app.

Once connected, all three show a few services:

I'm using the Raspberry Pi 4 built in Bluetooth

Beejeedeb commented 5 years ago

Used the Nordic tool on my Android with the problematic one:

Mi Flower 8F

Debug log after connecting:


nRF Connect, 2019-09-12 Flower care (C4:7C:8D:6B:26:8F) V 19:35:20.981 Connecting to C4:7C:8D:6B:26:8F... D 19:35:20.981 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 19:35:22.759 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 19:35:22.759 Connected to C4:7C:8D:6B:26:8F D 19:35:22.763 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED V 19:35:22.782 Discovering services... D 19:35:22.782 gatt.discoverServices() I 19:35:23.233 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 19:35:23.839 [Callback] Services discovered with status: 0 I 19:35:23.839 Services discovered V 19:35:23.865 Generic Access (0x1800)

Beejeedeb commented 5 years ago

Used also the Nordic tool on my Android with the working one:

Mi Flower 28

Debug log after connecting:


nRF Connect, 2019-09-12 Flower care (C4:7C:8D:6B:1D:28) V 19:53:37.433 Connecting to C4:7C:8D:6B:1D:28... D 19:53:37.433 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 19:53:38.910 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 19:53:38.910 Connected to C4:7C:8D:6B:1D:28 D 19:53:38.937 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED V 19:53:38.957 Discovering services... D 19:53:38.957 gatt.discoverServices() I 19:53:39.384 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 19:53:39.961 [Callback] Services discovered with status: 0 I 19:53:39.961 Services discovered V 19:53:39.981 Generic Access (0x1800)

Beejeedeb commented 5 years ago

After removing the battery three times and disabled the add-on several times it looks like it is doing something. Will check the loggings tomorrow what both Mi Flora's are doing.

tim-hellhake commented 5 years ago

It sees all three devices, while the add-on only sees two. Maybe the low battery is stopping the third from being picked up properly.

Do you have a replacement battery? The problem is I can't do much about the discovery. Noble is responsible for that. Either the signal is too weak or noble does not receive the advertisement packets reliable.

tim-hellhake commented 5 years ago

@flatsiedatsie @Beejeedeb Do you have other ble addons installed in the gateway?

tim-hellhake commented 5 years ago

@Beejeedeb I added a little bit more error logging in the new version. Maybe this will reveal some new errors during the polling.

flatsiedatsie commented 5 years ago

It's working fully now!

tim-hellhake commented 5 years ago

The third device has appeared.

Did you change anything?

All devices show battery level.

Yeah, I tried to fix that too. Looking through @Beejeedeb debug logs, I noticed that the battery level is not working although the characteristic is present on his devices. I didn't mention it because I didn't want to disappoint you if it doesn't work. I hope everything is fine now. I'm sorry it took me so long to fix it.

@Beejeedeb I'm curious if the new update will fix things for you too.

Beejeedeb commented 5 years ago

First of all you never ever have to apologize to me, you do this in your spare time, I am happy you do this at all.

Yep both sensors did work the whole night with the new version. Including the battery status.

Is the pairing and adding of a new device also solved or is this still an error and trial process of removing the battery en restarting the add-on several times? Timing problem or did fixing the battery issue also fix the other problems.

Beejeedeb commented 5 years ago

@flatsiedatsie @Beejeedeb Do you have other ble addons installed in the gateway?

no

flatsiedatsie commented 5 years ago

Did you change anything?

No, I just updated the add-on. It still has the old battery (which I now know has 69% left).

I spoke too soon though. One device still does not show battery level.

Beejeedeb commented 5 years ago

:-( This morning getting information stopped for both sensors (see log). Distance between RaspBerry PI and the sensors is 2 meters. My wife can still connect to the sensor MiFlora-c4:7c:8d:6b:1d:28 via the app. It takes however sometimes three or four attempts to get a good connection and transfer all the historical information. This is something that she is already used too.

Beejeedeb commented 5 years ago

Log information

Last good data from both the sensors:

2019-09-13 06:53:05.675 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 06:53:06.118 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 06:53:06.256 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 06:53:06.296 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 06:53:06.416 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 06:53:06.461 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Enabled sensor mode 2019-09-13 06:53:06.506 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read data characteristic 2019-09-13 06:53:06.508 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for temperature to 20 2019-09-13 06:53:06.509 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for moisture to 36 2019-09-13 06:53:06.536 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read firmware characteristic 2019-09-13 06:53:06.538 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for battery to 99 2019-09-13 06:53:06.541 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Saving new values to config 2019-09-13 06:53:08.656 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected 2019-09-13 06:53:08.835 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 06:53:08.964 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 06:53:08.999 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Enabled sensor mode 2019-09-13 06:53:09.030 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read data characteristic 2019-09-13 06:53:09.032 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for temperature to 19.4 2019-09-13 06:53:09.033 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for moisture to 37 2019-09-13 06:53:09.061 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read firmware characteristic 2019-09-13 06:53:09.062 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for battery to 99 2019-09-13 06:53:09.064 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Saving new values to config

No information from MiFlora-c4:7c:8d:6b:1d:28 anymore

2019-09-13 07:23:05.676 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 07:23:06.257 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 07:23:08.109 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 07:23:08.288 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 07:23:08.408 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 07:23:08.453 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Enabled sensor mode 2019-09-13 07:23:08.483 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read data characteristic 2019-09-13 07:23:08.485 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for temperature to 20.2 2019-09-13 07:23:08.486 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for moisture to 36 2019-09-13 07:23:08.513 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read firmware characteristic 2019-09-13 07:23:08.515 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for battery to 99 2019-09-13 07:23:08.517 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Saving new values to config 2019-09-13 07:23:09.672 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected

half hour later

2019-09-13 07:53:05.677 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 07:53:06.075 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 07:53:06.254 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 07:53:06.258 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 07:53:06.389 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 07:53:06.434 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Enabled sensor mode 2019-09-13 07:53:06.464 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read data characteristic 2019-09-13 07:53:06.469 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for temperature to 20.7 2019-09-13 07:53:06.470 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for moisture to 37 2019-09-13 07:53:06.495 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read firmware characteristic 2019-09-13 07:53:06.497 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for battery to 99 2019-09-13 07:53:06.499 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Saving new values to config 2019-09-13 07:53:06.603 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected 2019-09-13 07:53:06.783 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 07:53:06.784 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 07:53:06.993 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 07:53:06.994 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics

half hour later - the sun is shining

2019-09-13 08:23:05.678 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 08:23:06.259 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 08:23:11.005 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 08:23:11.184 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 08:23:11.304 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 08:23:11.349 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Enabled sensor mode 2019-09-13 08:23:11.379 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read data characteristic 2019-09-13 08:23:11.381 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for temperature to 26.1 2019-09-13 08:23:11.382 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for moisture to 38 2019-09-13 08:23:11.415 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read firmware characteristic 2019-09-13 08:23:11.416 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for battery to 99 2019-09-13 08:23:11.418 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Saving new values to config 2019-09-13 08:23:11.549 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected

half hour later - no more information from the other MiFlora-c4:7c:8d:6b:26:8f

2019-09-13 08:53:05.678 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 08:53:06.260 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 08:53:07.051 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 08:53:13.530 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected

half hour later

2019-09-13 09:23:05.680 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 09:23:06.028 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 09:23:06.260 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 09:23:08.473 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected 2019-09-13 09:23:08.652 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 09:23:08.654 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 09:23:08.655 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 09:23:08.952 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 09:23:08.954 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 09:23:08.955 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics

half hour later

2019-09-13 09:53:05.681 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 09:53:06.262 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 09:53:06.960 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 09:53:07.139 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 09:53:07.141 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 09:53:07.142 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 09:53:07.454 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 09:53:07.456 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 09:53:07.457 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 09:53:08.471 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected

Beejeedeb commented 5 years ago

Both sensors are working again, looks like it is an intermittent problem, sometimes it works sometimes not. Could it be that you should check until you got a value?

2019-09-13 14:23:05.694 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 14:23:06.268 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 14:23:08.638 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 14:23:08.817 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 14:23:08.943 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 14:23:08.983 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Enabled sensor mode 2019-09-13 14:23:09.014 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read data characteristic 2019-09-13 14:23:09.016 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for temperature to 21.7 2019-09-13 14:23:09.019 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for moisture to 37 2019-09-13 14:23:09.043 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Read firmware characteristic 2019-09-13 14:23:09.046 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Update value for battery to 99 2019-09-13 14:23:09.047 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Saving new values to config 2019-09-13 14:23:09.446 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected 2019-09-13 14:23:09.623 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 14:23:09.760 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 14:23:09.804 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Enabled sensor mode 2019-09-13 14:23:09.834 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read data characteristic 2019-09-13 14:23:09.837 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for temperature to 21.3 2019-09-13 14:23:09.838 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for moisture to 37 2019-09-13 14:23:09.865 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read firmware characteristic 2019-09-13 14:23:09.867 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for battery to 98 2019-09-13 14:23:09.869 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Saving new values to config

strange log message

2019-09-13 14:45:34.765 INFO : getValue for property temperature for: MiFlora-c4:7c:8d:6b:26:8f returning 21.7 2019-09-13 14:45:34.767 INFO : getValue for property moisture for: MiFlora-c4:7c:8d:6b:26:8f returning 37

One sensor is working

2019-09-13 14:53:05.696 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 14:53:06.270 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 14:53:06.658 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 14:53:10.419 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected 2019-09-13 14:53:10.598 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 14:53:10.718 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 14:53:10.763 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Enabled sensor mode 2019-09-13 14:53:10.794 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read data characteristic 2019-09-13 14:53:10.796 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for temperature to 21.5 2019-09-13 14:53:10.798 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for moisture to 38 2019-09-13 14:53:10.824 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read firmware characteristic 2019-09-13 14:53:10.837 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for battery to 99 2019-09-13 14:53:10.840 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Saving new values to config

One sensor

2019-09-13 15:23:05.698 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 15:23:06.271 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 15:23:06.617 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 15:23:07.404 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected 2019-09-13 15:23:07.599 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered services 2019-09-13 15:23:07.719 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Discovered characteristics 2019-09-13 15:23:07.763 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Enabled sensor mode 2019-09-13 15:23:07.794 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read data characteristic 2019-09-13 15:23:07.796 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for temperature to 21.1 2019-09-13 15:23:07.797 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for moisture to 38 2019-09-13 15:23:07.824 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Read firmware characteristic 2019-09-13 15:23:07.828 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Update value for battery to 99 2019-09-13 15:23:07.830 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Saving new values to config

No sensor

2019-09-13 15:53:05.700 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connecting 2019-09-13 15:53:06.271 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connecting 2019-09-13 15:53:06.550 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Connected 2019-09-13 15:53:06.730 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 15:53:06.731 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 15:53:06.732 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered services 2019-09-13 15:53:07.045 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 15:53:07.046 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 15:53:07.047 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:26:8f] Discovered characteristics 2019-09-13 15:53:08.376 INFO : mi-flora: [MiFlora-c4:7c:8d:6b:1d:28] Connected

Beejeedeb commented 5 years ago

Looks like it is an intermittent problem, sometimes it works sometimes not. Could it be that you should check until you got a value?

tim-hellhake commented 5 years ago

I spoke too soon though. One device still does not show battery level.

The Flower care?

tim-hellhake commented 5 years ago

Looks like it is an intermittent problem, sometimes it works sometimes not.

The connection process is sometimes a bit unreliable. I'll try to improve the poll loop.

flatsiedatsie commented 5 years ago

I restarted the add-on. Now the situation seems to be the old one: only one device shows data. The two newer Chinese ones don't.

2019-09-14 00:04:59.390 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 00:05:00.497 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 00:05:00.690 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 00:05:00.810 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 00:05:00.840 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 00:05:00.871 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 00:05:00.872 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 21.2
2019-09-14 00:05:00.872 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 16
2019-09-14 00:05:00.901 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 00:05:00.902 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 73
2019-09-14 00:05:00.903 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config
2019-09-14 00:19:59.391 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 00:19:59.804 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 00:19:59.999 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 00:20:00.118 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 00:20:00.148 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 00:20:00.179 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 00:20:00.180 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 21.1
2019-09-14 00:20:00.180 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 16
2019-09-14 00:20:00.208 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 00:20:00.209 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 70
2019-09-14 00:20:00.210 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config
2019-09-14 08:19:59.424 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 08:20:00.616 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 08:20:00.795 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 08:20:00.915 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 08:20:00.945 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 08:20:00.976 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 08:20:00.977 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 20.8
2019-09-14 08:20:00.978 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 14
2019-09-14 08:20:01.005 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 08:20:01.007 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 72
2019-09-14 08:20:01.009 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config
2019-09-14 08:25:33.143 ERROR  : (node:823) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 actionStatus listeners added. Use emitter.setMaxListeners() to increase limit
2019-09-14 08:34:59.425 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 08:35:00.930 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 08:35:01.125 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 08:35:01.275 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 08:35:01.320 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 08:35:01.350 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 08:35:01.351 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 20.8
2019-09-14 08:35:01.352 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 14
2019-09-14 08:35:01.380 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 08:35:01.381 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 70
2019-09-14 08:35:01.381 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config
2019-09-14 08:49:59.426 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 08:50:00.274 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 08:50:00.453 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 08:50:00.588 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 08:50:00.618 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 08:50:00.648 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 08:50:00.649 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 21
2019-09-14 08:50:00.650 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 15
2019-09-14 08:50:00.678 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 08:50:00.679 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 72
2019-09-14 08:50:00.679 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config
2019-09-14 09:04:59.427 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 09:05:00.581 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 09:05:00.791 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 09:05:00.911 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 09:05:00.941 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 09:05:00.986 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 09:05:00.988 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 21
2019-09-14 09:05:00.988 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 14
2019-09-14 09:05:01.016 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 09:05:01.017 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 69
2019-09-14 09:05:01.018 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config
2019-09-14 09:19:59.428 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connecting
2019-09-14 09:20:00.947 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Connected
2019-09-14 09:20:01.157 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered services
2019-09-14 09:20:01.277 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Discovered characteristics
2019-09-14 09:20:01.306 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Enabled sensor mode
2019-09-14 09:20:01.337 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read data characteristic
2019-09-14 09:20:01.338 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for temperature to 20.9
2019-09-14 09:20:01.338 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for moisture to 15
2019-09-14 09:20:01.367 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Read firmware characteristic
2019-09-14 09:20:01.368 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Update value for battery to 69
2019-09-14 09:20:01.369 INFO   : mi-flora: [MiFlora-c4:7c:8d:62:80:74] Saving new values to config

This is odd:

2019-09-14 09:22:25.052 INFO   : getValue for property temperature for: MiFlora-c4:7c:8d:------- returning 20.9
2019-09-14 09:22:25.053 INFO   : getValue for property moisture for: MiFlora-c4:7c:8d:------- returning 15
2019-09-14 09:22:25.054 INFO   : getValue for property battery for: MiFlora-c4:7c:8d:------- returning 69
2019-09-14 09:22:25.071 ERROR  : Failed to get property temperature: getProperty: device: MiFlora-c4:7c:------- not found.
2019-09-14 09:22:25.071 ERROR  : Failed to get property moisture: getProperty: device: MiFlora-c4:7c:8d:------- not found.
2019-09-14 09:22:25.072 ERROR  : Failed to get property battery: getProperty: device: MiFlora-c4:7c:8d:------- not found.
2019-09-14 09:22:25.090 ERROR  : Failed to get property temperature: getProperty: device: MiFlora-c4:7c:8d:------- not found.
2019-09-14 09:22:25.091 ERROR  : Failed to get property moisture: getProperty: device: MiFlora-c4:7c:8d:------- not found.
2019-09-14 09:22:25.091 ERROR  : Failed to get property battery: getProperty: device: MiFlora-c4:7c:8d:------- not found.
flatsiedatsie commented 5 years ago

Unfortunately it seems I'm back where I started, with only one device showing data.

tim-hellhake commented 4 years ago

I'm closing this now since we will replace the adapter with a python based.