hannseman / homebridge-mi-hygrothermograph

Homebridge plugin for the Xiaomi Mi Bluetooth Temperature and Humidity Sensor
MIT License
267 stars 52 forks source link

Time out on all my sensors #58

Closed kimme1024 closed 4 years ago

kimme1024 commented 5 years ago

Expected Behavior

Everything should work as it did before.

Current Behavior

Since the last homebridge update I'm getting errors from this plugin that there's a timeout on all my sensors. I read that it could be that the sensor is out of range but I'm having the issue on all of them. It starts working perfectly but after a couple of hours they just stop transmitting data to the pi.

Steps to Reproduce (for bugs)

Start homebridge and wait...

Versions

Configuration

"accessories": [ { "accessory": "Hygrotermograph", "name": "Slaapkamer", "address": "4C:65:A8:D7:94:03", "fakeGatoEnabled": "true", "forceDiscovering": "true" }, { "accessory": "Hygrotermograph", "name": "Badkamer", "address": "4C:65:A8:D8:54:24", "fakeGatoEnabled": "true", "forceDiscovering": "true" }, { "accessory": "Hygrotermograph", "name": "Fitness", "address": "4C:65:A8:DC:88:41", "fakeGatoEnabled": "true", "forceDiscovering": "true" } ],

Homebridge Log / Command Output

[2019-6-14 10:45:31] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-14T06:08:59.381Z [2019-6-14 10:45:31] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-14T06:08:59.381Z [2019-6-14 10:45:31] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-14T06:08:59.381Z [2019-6-14 10:45:31] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-14T06:09:02.307Z [2019-6-14 10:45:31] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-14T06:09:02.307Z [2019-6-14 10:45:31] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-14T06:09:02.307Z [2019-6-14 10:45:31] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-06-14T06:09:02.383Z [2019-6-14 10:45:31] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-06-14T06:09:02.383Z [2019-6-14 10:45:31] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-06-14T06:09:02.383Z

hannseman commented 5 years ago

Weird, can you see any errors like “Unknown event type” in the logs? Thinking if you also are affected by the issue described in https://github.com/hannseman/homebridge-mi-hygrothermograph/issues/56.

Could you turn on homebridge debug-logging with the -D flag and paste the log output here?

kimme1024 commented 5 years ago

I'm running homebridge in a detached screen so I can't scroll up to check for "unknown event type". As I had a couple of very busy days lately I didn't have time to check so I assumed everything would be down until I had the time to start investigating the issue but I now noticed that after some time the sensors reconnect and start working again.

Here's the debug logging:

[2019-6-16 11:13:38] [Fitness] [4c:65:a8:dc:88:41] Temperature: 22C [2019-6-16 11:13:38] [Slaapkamer] Fakegato-timer: addData Fitness { time: 1560676418.092, temp: 22, humidity: 57.4 } immediate: false [2019-6-16 11:13:38] [Slaapkamer] [4c:65:a8:d7:94:03] Discovered peripheral Id: 4c65a8d79403 LocalName: MJ_HT_V1 rssi: -91 serviceData: 5020aa01c30394d7a8654c0610023102 [2019-6-16 11:13:38] [Slaapkamer] [4c:65:a8:d7:94:03] Humidity: 56.1% [2019-6-16 11:13:38] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676418.591, temp: 22.8, humidity: 56.1 } immediate: false [2019-6-16 11:13:41] [Badkamer] [4c:65:a8:d8:54:24] Discovered peripheral Id: 4c65a8d85424 LocalName: MJ_HT_V1 rssi: -82 serviceData: 5020aa01bb2454d8a8654c0a100138 [2019-6-16 11:13:41] [Badkamer] [4c:65:a8:d8:54:24] Battery level: 56% [2019-6-16 11:13:42] [Fitness] [4c:65:a8:dc:88:41] Discovered peripheral Id: 4c65a8dc8841 LocalName: MJ_HT_V1 rssi: -86 serviceData: 5020aa01e64188dca8654c0d1004dd003e02 [2019-6-16 11:13:42] [Fitness] [4c:65:a8:dc:88:41] Temperature: 22.1C [2019-6-16 11:13:42] [Slaapkamer] Fakegato-timer: addData Fitness { time: 1560676422.101, temp: 22.1, humidity: 57.4 } immediate: false [2019-6-16 11:13:42] [Fitness] [4c:65:a8:dc:88:41] Humidity: 57.4% [2019-6-16 11:13:42] [Slaapkamer] Fakegato-timer: addData Fitness { time: 1560676422.105, temp: 22.1, humidity: 57.4 } immediate: false [2019-6-16 11:13:42] [Slaapkamer] [4c:65:a8:d7:94:03] Discovered peripheral Id: 4c65a8d79403 LocalName: MJ_HT_V1 rssi: -84 serviceData: 5020aa01c50394d7a8654c0d1004e4003102 [2019-6-16 11:13:42] [Slaapkamer] [4c:65:a8:d7:94:03] Temperature: 22.8C [2019-6-16 11:13:42] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676422.6, temp: 22.8, humidity: 56.1 } immediate: false [2019-6-16 11:13:42] [Slaapkamer] [4c:65:a8:d7:94:03] Humidity: 56.1% [2019-6-16 11:13:42] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676422.603, temp: 22.8, humidity: 56.1 } immediate: false [2019-6-16 11:13:43] [Badkamer] [4c:65:a8:d8:54:24] Discovered peripheral Id: 4c65a8d85424 LocalName: MJ_HT_V1 rssi: -82 serviceData: 5020aa01bc2454d8a8654c0610023c02 [2019-6-16 11:13:43] [Badkamer] [4c:65:a8:d8:54:24] Humidity: 57.2% [2019-6-16 11:13:43] [Slaapkamer] Fakegato-timer: addData Badkamer { time: 1560676423.505, temp: 22.8, humidity: 57.2 } immediate: false [2019-6-16 11:13:44] [Slaapkamer] [4c:65:a8:d7:94:03] Discovered peripheral Id: 4c65a8d79403 LocalName: MJ_HT_V1 rssi: -82 serviceData: 5020aa01c60394d7a8654c0d1004e3003102 [2019-6-16 11:13:44] [Slaapkamer] [4c:65:a8:d7:94:03] Temperature: 22.7C [2019-6-16 11:13:44] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676424.608, temp: 22.7, humidity: 56.1 } immediate: false [2019-6-16 11:13:44] [Slaapkamer] [4c:65:a8:d7:94:03] Humidity: 56.1% [2019-6-16 11:13:44] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676424.612, temp: 22.7, humidity: 56.1 } immediate: false [2019-6-16 11:13:46] [Fitness] [4c:65:a8:dc:88:41] Discovered peripheral Id: 4c65a8dc8841 LocalName: MJ_HT_V1 rssi: -94 serviceData: 5020aa01e84188dca8654c0d1004de003d02 [2019-6-16 11:13:46] [Fitness] [4c:65:a8:dc:88:41] Temperature: 22.2C [2019-6-16 11:13:46] [Slaapkamer] Fakegato-timer: addData Fitness { time: 1560676426.108, temp: 22.2, humidity: 57.4 } immediate: false [2019-6-16 11:13:46] [Fitness] [4c:65:a8:dc:88:41] Humidity: 57.3% [2019-6-16 11:13:46] [Slaapkamer] Fakegato-timer: addData Fitness { time: 1560676426.111, temp: 22.2, humidity: 57.3 } immediate: false [2019-6-16 11:13:46] [Slaapkamer] [4c:65:a8:d7:94:03] Discovered peripheral Id: 4c65a8d79403 LocalName: MJ_HT_V1 rssi: -82 serviceData: 5020aa01c70394d7a8654c0d1004e3003102 [2019-6-16 11:13:46] [Slaapkamer] [4c:65:a8:d7:94:03] Temperature: 22.7C [2019-6-16 11:13:46] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676426.616, temp: 22.7, humidity: 56.1 } immediate: false [2019-6-16 11:13:46] [Slaapkamer] [4c:65:a8:d7:94:03] Humidity: 56.1% [2019-6-16 11:13:46] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676426.62, temp: 22.7, humidity: 56.1 } immediate: false [2019-6-16 11:13:48] [Slaapkamer] [4c:65:a8:d7:94:03] Discovered peripheral Id: 4c65a8d79403 LocalName: MJ_HT_V1 rssi: -82 serviceData: 5020aa01c80394d7a8654c041002e300 [2019-6-16 11:13:48] [Slaapkamer] [4c:65:a8:d7:94:03] Temperature: 22.7C [2019-6-16 11:13:48] [Slaapkamer] Fakegato-timer: addData Slaapkamer { time: 1560676428.623, temp: 22.7, humidity: 56.1 } immediate: false [2019-6-16 11:13:49] [Badkamer] [4c:65:a8:d8:54:24] Discovered peripheral Id: 4c65a8d85424 LocalName: MJ_HT_V1 rssi: -81 serviceData: 5020aa01bf2454d8a8654c0d1004e4003c02 [2019-6-16 11:13:49] [Badkamer] [4c:65:a8:d8:54:24] Temperature: 22.8C [2019-6-16 11:13:49] [Slaapkamer] Fakegato-timer: addData Badkamer { time: 1560676429.512, temp: 22.8, humidity: 57.2 } immediate: false [2019-6-16 11:13:49] [Badkamer] [4c:65:a8:d8:54:24] Humidity: 57.2% [2019-6-16 11:13:49] [Slaapkamer] Fakegato-timer: addData Badkamer { time: 1560676429.516, temp: 22.8, humidity: 57.2 } immediate: false [2019-6-16 11:13:51] [Badkamer] [4c:65:a8:d8:54:24] Discovered peripheral Id: 4c65a8d85424 LocalName: MJ_HT_V1 rssi: -81 serviceData: 5020aa01c02454d8a8654c0d1004e5003c02

hannseman commented 5 years ago

That's odd. Maybe you could try and increase the timeout config to something larger than 15 minutes. Are you still having issues or can this issue be closed?

kimme1024 commented 5 years ago

Hi,

Sorry for the late reply, I've been on vacation last week. I'm not using the timeout config so that should not be the issue or am I wrong?

Sadly I'm still having the same issue:

[2019-6-26 17:09:18] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-26T04:06:09.287Z [2019-6-26 17:09:18] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-26T04:06:09.287Z [2019-6-26 17:09:18] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-26T04:06:09.287Z [2019-6-26 17:09:18] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-26T04:06:10.575Z [2019-6-26 17:09:18] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-26T04:06:10.575Z [2019-6-26 17:09:18] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-26T04:06:10.575Z [2019-6-26 17:09:23] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-06-26T04:06:09.287Z [2019-6-26 17:09:23] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-06-26T04:06:09.774Z [2019-6-26 17:09:23] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-06-26T04:06:10.575Z

I'm also using another sensor downstairs connected to a mac mini and this one never fails.

hannseman commented 5 years ago

And the sensors never recover after timing out? Does restarting homebridge solve it? Can you try placing them right next to the raspberry pi for a couple of hours and see if they still time out, just to rule out them being out of range (I understand that it've worked without errors before).

kimme1024 commented 5 years ago

No they never recover. Restart solves it immediately and 1 of 3 is within 2 meters reach. I removed the forceDiscovering and since then it didn't crash anymore. I'll give it some time now but it seems to be resolved by doing that.

hannseman commented 5 years ago

Did removing forceDiscovering solve it?

kimme1024 commented 5 years ago

I was just going to check this tonight :) It didn't crash once since I've removed it so I guess the forceDiscovering is what caused the bug.

Thanks for the support!

hannseman commented 5 years ago

No problem!

Good to know, weird that it behaved like this.

kimme1024 commented 5 years ago

Sadly I have spoken too soon :( Yesterday evening they all went down again :(

[2019-7-4 17:36:25] [Ikea Trådfri Gateway] Ping OK. [2019-7-4 17:36:36] [Ikea Trådfri Gateway] Outlet Slaapkamer in currently ALIVE. [2019-7-4 17:36:36] [Ikea Trådfri Gateway] Outlet Badkamer in currently ALIVE. [2019-7-4 17:36:36] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-02T20:55:32.451Z [2019-7-4 17:36:36] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-02T20:55:32.451Z [2019-7-4 17:36:36] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-02T20:55:32.451Z [2019-7-4 17:36:36] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-02T20:55:32.614Z [2019-7-4 17:36:36] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-02T20:55:32.614Z [2019-7-4 17:36:36] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-02T20:55:32.614Z [2019-7-4 17:36:36] [Ikea Trådfri Gateway] Outlet Garage in currently ALIVE. [2019-7-4 17:36:36] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-02T20:55:36.438Z [2019-7-4 17:36:36] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-02T20:55:36.438Z [2019-7-4 17:36:36] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-02T20:55:36.438Z [2019-7-4 17:36:36] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-02T20:55:32.614Z [2019-7-4 17:36:36] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-02T20:55:32.614Z [2019-7-4 17:36:36] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-02T20:55:32.614Z [2019-7-4 17:36:37] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-02T20:55:36.438Z [2019-7-4 17:36:37] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-02T20:55:36.438Z [2019-7-4 17:36:37] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-02T20:55:36.438Z [2019-7-4 17:36:37] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-02T20:55:32.451Z [2019-7-4 17:36:37] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-02T20:55:32.451Z [2019-7-4 17:36:37] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-02T20:55:32.451Z [2019-7-4 17:37:25] [Ikea Trådfri Gateway] Ping OK.

I also noticed the following when restarting the service:

[2019-7-4 18:01:57] --- [2019-7-4 18:01:57] Warning: skipping plugin found at '/usr/lib/node_modules/homebridge-mi-hygrothermograph' since we already loaded the same plugin from '/usr/local/lib/node_modules/homebridge-mi-hygrothermograph'. [2019-7-4 18:01:57] Loaded plugin: homebridge-mi-hygrothermograph [2019-7-4 18:01:59] Registering accessory 'homebridge-mi-hygrothermograph.Hygrotermograph' [2019-7-4 18:01:59] ---

codyc1515 commented 5 years ago

I am also having the same issue since the latest update. Restarting home bridge fixes it but this is not really a permanent fix. Logs look like:

[7/6/2019, 8:14:53 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 8:14:53 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 8:14:53 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:23 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:24 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:24 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:28 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:28 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:28 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:44 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:44 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 9:46:44 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:02 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:08 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:08 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:08 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:14 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:14 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:14 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:18 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:19 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:51:19 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:56:04 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:56:05 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:56:05 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:56:22 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:56:22 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z [7/6/2019, 10:56:22 PM] [Mi Thermostat] [undefined] Timed out, last update: 2019-07-04T15:49:06.468Z

codyc1515 commented 5 years ago

Actually it looks like this might be the cause of the error: https://github.com/raspberrypi/firmware/issues/1150

hannseman commented 5 years ago

It does indeed. Maybe you could try and downgrade to the previous version of the firmware by sudo rpi-update <hash>?

I think this bug was introduced in some update in May so try some version before that: https://github.com/raspberrypi/firmware/releases

hannseman commented 5 years ago

@codyc1515 looks like downgrading the firmware solved it right?

kimme1024 commented 5 years ago

I just started the downgrade as well. So I will also be testing this possible solution. Thanks again for the support!

kimme1024 commented 5 years ago

Downgrading didn’t fix the issue for me. All my sensors timed out after about 2 days.

kimme1024 commented 5 years ago

I just saw that the sensors were down again and when I checked my homebridge-screen I noticed this above the standard issue. It seems the issue already occured while starting but that it automatically fixed itself. As I'm not a developer I don't really know if this is relevant or not but you never know ;) After the restart I didn't have it.

[2019-7-16 13:05:58] [Badkamer] Error: Unknown event type: 16. 5020aa01682454d8a8654c100004d7002002 at Parser.parseEventData (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:174:15) at Parser.parse (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:56:23) at Scanner.parseServiceData (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:161:38) at Scanner.onDiscover (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:90:25) at emitOne (events.js:121:20) at Noble.emit (events.js:211:7) at Noble.onDiscover (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/noble.js:178:10) at emitMany (events.js:147:13) at NobleBindings.emit (events.js:224:7) at NobleBindings.onDiscover (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:174:10) [2019-7-16 23:32:28] [Slaapkamer] Stop scanning. (poweredOff) [2019-7-16 23:32:28] [Badkamer] Stop scanning. (poweredOff) [2019-7-16 23:32:28] [Fitness] Stop scanning. (poweredOff) [2019-7-16 23:32:29] [Slaapkamer] Start scanning. [2019-7-16 23:32:29] [Badkamer] Start scanning. [2019-7-16 23:32:29] [Fitness] Start scanning. [2019-7-19 07:54:08] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:08] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:08] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:08] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:08] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:08] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:08] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:08] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 07:54:08] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 07:54:08] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 07:54:09] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:09] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:09] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 07:54:09] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 07:54:09] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 07:54:09] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 07:54:09] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:09] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:09] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:15] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 07:54:15] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 08:10:41] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 08:10:41] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 08:10:41] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 08:10:41] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 08:10:41] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 08:10:41] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 08:10:41] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 08:10:41] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 08:10:41] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 11:34:47] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 11:34:47] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 11:34:47] [Slaapkamer] [4C:65:A8:D7:94:03] Timed out, last update: 2019-07-19T01:41:49.889Z [2019-7-19 11:34:47] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 11:34:47] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 11:34:47] [Fitness] [4C:65:A8:DC:88:41] Timed out, last update: 2019-07-19T01:41:49.777Z [2019-7-19 11:34:47] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 11:34:47] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z [2019-7-19 11:34:47] [Badkamer] [4C:65:A8:D8:54:24] Timed out, last update: 2019-07-19T01:41:47.702Z

hannseman commented 5 years ago

@kimme1024 yeah that error is familiar, see https://github.com/hannseman/homebridge-mi-hygrothermograph/issues/56.

I think that these two issues actually have the same cause which is some error introduced in the raspberry pi firmware.

Looks like a new firmware with a potential fix will be released soon: https://github.com/raspberrypi/firmware/issues/1150#issuecomment-510483643

Let’s hope this fixes all the issues and if it doesn’t it might be easiest to just invest in a cheap bluetooth usb-adapter and not use the raspberry pi built in.

kimme1024 commented 5 years ago

Great! I've subscribed to that thread so I'll check it out when it's released and report my findings over here!

Thanks for the great support!

hannseman commented 5 years ago

@kimme1024 @codyc1515 have you tried to update to the latest firmware? And did it solve the problem?

kimme1024 commented 5 years ago

@hannseman Hi, sorry for the late reply. I've been very busy lately. As I didn't really follow up the firmware updates I didn't know there was one available. I'll try to update tonight and I'll report back asap. I assume I just have to rpi-update?

hannseman commented 5 years ago

@kimme1024 yes according to the RPI devs the latest firmware should have a potential fix.

kimme1024 commented 5 years ago

Just quickly updated. Will keep you posted on the issue. Thanks!

kimme1024 commented 5 years ago

Sadly it didn't fix the issue. Had a timeout again after about a day I think... It's weird as I didn't have the problem once in the first year I've used the setup.

lukyer commented 4 years ago

I'm having the same issue for long time (raspbian 8-10, currently on completely clean raspbian 10) with external USB BT dongle (ASUS BT-400) used by RPi 2.

What usually helps me is to run in separate terminal bluetoothctl and then scan on. Homebridge-mi-hygrothermograph then immediately starts to reconnect and values are being detected again for some time.

Try if it helps or post here what helped you. Thanks!

kimme1024 commented 4 years ago

I'm having the same issue for long time (raspbian 8-10, currently on completely clean raspbian 10) with external USB BT dongle (ASUS BT-400) used by RPi 2.

What usually helps me is to run in separate terminal bluetoothctl and then scan on. Homebridge-mi-hygrothermograph then immediately starts to reconnect and values are being detected again for some time.

Try if it helps or post here what helped you. Thanks!

Sadly it doesn't seem to work with the internal bluetooth...

[bluetooth]# scan on No default controller available

codyc1515 commented 4 years ago

Check that you are not running some other plug-in which uses bluetooth. Also the newest firmware 100% resolves the issue.

kimme1024 commented 4 years ago

I've updated again but I think I already was on the latest version of the firmware. The only thing I could find was the following (part after which I start homebridge)

Last login: Fri Oct 4 12:28:42 on ttys000 Kim-Heymanss-iMac:~ kimheymans$ ssh pi@192.168.1.11 pi@192.168.1.11's password: Linux raspberrypi 4.19.69-v7+ #1256 SMP Fri Aug 30 16:30:49 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Oct 4 12:30:13 2019 from 192.168.1.184 pi@raspberrypi:~ $ sudo rpi-update Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom Performing self-update Relaunching after update Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom ############################################################# WARNING: 'rpi-update' updates to pre-releases of the linux kernel tree and Videocore firmware.

'rpi-update' should only be used if there is a specific reason to do so - for example, a request by a Raspberry Pi engineer.

DO NOT use 'rpi-update' as part of a regular update process.

############################################################## Would you like to proceed? (y/N)

Downloading specific firmware revision (this will take a few minutes) % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 168 0 168 0 0 360 0 --:--:-- --:--:-- --:--:-- 360 100 114M 100 114M 0 0 1229k 0 0:01:35 0:01:35 --:--:-- 952k Updating firmware Updating kernel modules depmod 4.19.76+ depmod 4.19.76-v7+ Updating VideoCore libraries Using HardFP libraries Updating SDK Running ldconfig Storing current firmware revision Deleting downloaded files Syncing changes to disk If no errors appeared, your firmware was successfully updated to 9f816f3392e1c1eae156b99bed94a8a314310999 A reboot is needed to activate the new firmware

pi@raspberrypi:~ $ homebridge -I [2019-10-7 15:03:06] Loaded config.json with 3 accessories and 1 platforms. [2019-10-7 15:03:06] --- [2019-10-7 15:03:06] Warning: skipping plugin found at '/usr/lib/node_modules/homebridge-config-ui-x' since we already loaded the same plugin from '/usr/local/lib/node_modules/homebridge-config-ui-x'. [2019-10-7 15:03:06] Warning: skipping plugin found at '/usr/lib/node_modules/homebridge-mi-hygrothermograph' since we already loaded the same plugin from '/usr/local/lib/node_modules/homebridge-mi-hygrothermograph'.

Could this have something to do with my issue? I guess not as it's skipping it but you never know. Also I don't really know how to solve this issue so it wouldn't appear again.

lukyer commented 4 years ago

I was fighting this issue for long time and my 100% working fix was to throw away (expensive) ASUS BT-400 and buy new Gembird BTD-MINI5 dongle. Everything works like a charm now!

pdonat01 commented 4 years ago

Hi, Same error here. Know someone any solution? Very annoying bug. I tried all that you mentioned but not works. Thanks

kimme1024 commented 4 years ago

Hi, Same error here. Know someone any solution? Very annoying bug. I tried all that you mentioned but not works. Thanks

Not really. Out of misery I just made a cron to reboot the pi every night at 3am. The pi only runs for these sensors so it doesn’t make a difference if you reboot it daily.

hannseman commented 4 years ago

The issue is still open https://github.com/raspberrypi/firmware/issues/1150

The two current fixes seems to be to buy a BT dongle or upgrade to RPI4. @lukyer suggested a working one and I'm running this one https://www.aliexpress.com/item/32704906488.html with no issues.

hannseman commented 4 years ago

I just released version 2.4.0 to npm. It upgrades noble to the latest version which have better support for node 12. It probably won't help with this issue but it's worth a shot!

kimme1024 commented 4 years ago

Hi All,

Today I got an update in following thread (https://github.com/raspberrypi/firmware/issues/1150#issuecomment-579832850) that there would be a possible fix for our issue.

I installed this and as I was already thinking to run homebridge as a service I also tried to change that. However this required a more recent version of node. I installed this, when restarting homebridge I immediately got an error that the plugins weren't compiled in this version of node.

I reinstalled the plugins, now homebridge starts without any issues but the plugin doesn't start scanning my sensors.

This is what homebridge gives as an output:

[1/30/2020, 20:59:43] ---
[1/30/2020, 20:59:43] Loaded plugin: homebridge-mi-hygrothermograph
[1/30/2020, 20:59:45] Registering accessory 'homebridge-mi-hygrothermograph.Hygrotermograph'
[1/30/2020, 20:59:45] ---
[1/30/2020, 20:59:45] Loading 1 platforms...
[1/30/2020, 20:59:45] [Config] Initializing config platform...
[1/30/2020, 20:59:45] [Config] Spawning homebridge-config-ui-x with PID 10207
[1/30/2020, 20:59:45] Loading 3 accessories...
[1/30/2020, 20:59:45] [Slaapkamer] Initializing Hygrotermograph accessory...
[1/30/2020, 20:59:45] [Badkamer] Initializing Hygrotermograph accessory...
[1/30/2020, 20:59:45] [Fitness] Initializing Hygrotermograph accessory...
Setup Payload:
X-HM://0023ISYWYB70F
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 031-45-154 │     
    └────────────┘     

[1/30/2020, 20:59:46] Homebridge is running on port 51826.
[1/30/2020, 20:59:50] [Config] Homebridge Config UI X v4.9.0 is listening on :: port 9090

Any idea's on how to fix this so I can continue to test if the rpi-update did fix the issue?

hannseman commented 4 years ago

Yes I saw that update, very interesting!

Hmm, does it work when running homebridge directly?

You might need to rerun setcap on the node binary to give it bluetooth access when running as non-root.

sudo setcap cap_net_raw+eip $(eval readlink -f which node)

30 jan. 2020 kl. 20:04 skrev kimme1024 notifications@github.com:

 Hi All,

Today I got an update in following thread (raspberrypi/firmware#1150 (comment)) that there would be a possible fix for our issue.

I installed this and as I was already thinking to run homebridge as a service I also tried to change that. However this required a more recent version of node. I installed this, when restarting homebridge I immediately got an error that the plugins weren't compiled in this version of node.

I reinstalled the plugins, now homebridge starts without any issues but the plugin doesn't start scanning my sensors.

This is what homebridge gives as an output:

`[1/30/2020, 20:59:43] --- [1/30/2020, 20:59:43] Loaded plugin: homebridge-mi-hygrothermograph [1/30/2020, 20:59:45] Registering accessory 'homebridge-mi-hygrothermograph.Hygrotermograph' [1/30/2020, 20:59:45] --- [1/30/2020, 20:59:45] Loading 1 platforms... [1/30/2020, 20:59:45] [Config] Initializing config platform... [1/30/2020, 20:59:45] [Config] Spawning homebridge-config-ui-x with PID 10207 [1/30/2020, 20:59:45] Loading 3 accessories... [1/30/2020, 20:59:45] [Slaapkamer] Initializing Hygrotermograph accessory... [1/30/2020, 20:59:45] [Badkamer] Initializing Hygrotermograph accessory... [1/30/2020, 20:59:45] [Fitness] Initializing Hygrotermograph accessory... Setup Payload: X-HM://0023ISYWYB70F Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐
│ 031-45-154 │
└────────────┘
[1/30/2020, 20:59:46] Homebridge is running on port 51826. [1/30/2020, 20:59:50] [Config] Homebridge Config UI X v4.9.0 is listening on :: port 9090`

Any idea's on how to fix this so I can continue to test if the rpi-update did fix the issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

kimme1024 commented 4 years ago

sudo setcap cap_net_raw+eip $(eval readlink -f which node)

You're a legend!

I was already running homebridge directly again and with your solution it worked instantly. However when I run homebridge as a service it doesn't seem to work. I can see in the logs that it starts scanning. but there's no data refresh...

[1/30/2020, 21:56:09] Loaded config.json with 3 accessories and 1 platforms.
[1/30/2020, 21:56:09] ---
[1/30/2020, 21:56:10] Loaded plugin: homebridge-config-ui-x
[1/30/2020, 21:56:10] Registering platform 'homebridge-config-ui-x.config'
[1/30/2020, 21:56:10] ---
[1/30/2020, 21:56:10] Loaded plugin: homebridge-mi-hygrothermograph
[1/30/2020, 21:56:09] Warning: skipping plugin found at '/usr/lib/node_modules/homebridge-config-ui-x' since we already loaded the same plugin from '/usr/local/lib/node_modules/homebridge-config-ui-x'.
[1/30/2020, 21:56:09] Warning: skipping plugin found at '/usr/lib/node_modules/homebridge-mi-hygrothermograph' since we already loaded the same plugin from '/usr/local/lib/node_modules/homebridge-mi-hygrothermograph'.
[1/30/2020, 21:56:12] [Config] Homebridge Config UI X v4.9.0 is listening on :: port 8581
[1/30/2020, 21:56:12] Registering accessory 'homebridge-mi-hygrothermograph.Hygrotermograph'
[1/30/2020, 21:56:12] ---
[1/30/2020, 21:56:12] Loading 1 platforms...
[1/30/2020, 21:56:12] [Config] Initializing config platform...
[1/30/2020, 21:56:12] [Config] Running in Standalone Mode.
[1/30/2020, 21:56:12] Loading 3 accessories...
[1/30/2020, 21:56:12] [Slaapkamer] Initializing Hygrotermograph accessory...
[1/30/2020, 21:56:12] [Badkamer] Initializing Hygrotermograph accessory...
[1/30/2020, 21:56:12] [Fitness] Initializing Hygrotermograph accessory...
Setup Payload:
X-HM://0023ISYWY4A2A
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 031-45-154 │     
    └────────────┘     

[1/30/2020, 21:56:12] Homebridge is running on port 51826.
[1/30/2020, 21:56:12] [Slaapkamer] Start scanning.
[1/30/2020, 21:56:12] [Badkamer] Start scanning.
[1/30/2020, 21:56:12] [Fitness] Start scanning.
[1/30/2020, 21:56:16] [Config] Multiple Instances Of Homebridge Found Installed
[1/30/2020, 21:56:16] [Config] /usr/local/lib/node_modules/homebridge
[1/30/2020, 21:56:16] [Config] /usr/lib/node_modules/homebridge

Also don't know how there are multiple instances installed... But other than the errors that never seemed to be an issue...

hannseman commented 4 years ago

Looks like you have to have two paths where globally-installed modules are present. You should try and only have one. I would go trough every warning and remove them from both paths and reinstall the package.

This is how my systemd-setup looks like for homebridge:

/etc/default/homebridge

# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge

# If you uncomment the following line, homebridge will log more 
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*

homebridge.service

[Unit]
Description=Node.js HomeKit Server
Wants=network-online.target
After=syslog.target network-online.target

[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
AmbientCapabilities=CAP_NET_RAW

[Install]
WantedBy=multi-user.target

Note that ExecStart=/usr/local/bin/homebridge will differ depending on if you end up installing global modules in to /usr/local/lib/node_modules vs /usr/lib/node_modules.

hannseman commented 4 years ago

I just released a new version (3.0.1) with updates to the bluetooth library. Please give it a shot.

hannseman commented 4 years ago

Closing this issue due to no responses.