hannseman / homebridge-mi-hygrothermograph

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

[Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z #102

Closed splashibiza closed 4 years ago

splashibiza commented 4 years ago

Expected Behavior

Device should not time out after a couple of hours and work continuously 24/7

Current Behavior

Device does time out and stops working in homekit after a few hours

Steps to Reproduce (for bugs)

Set it up and run normally

Versions

Configuration

        {
            "accessory": "Hygrotermograph",
            "name": "Temperature & Humidity",
            "address": "58:2D:34:38:28:17",
            "humidityName": "Humedad",
            "temperatureName": "Temperatura",
            "fakeGatoEnabled": false,
            "forceDiscovering": true,
            "forceDiscoveringDelay": 2500,
            "lowBattery": 10
        },

Homebridge Log / Command Output

[2020-4-22 7:23:22] Loaded plugin: homebridge-mi-hygrothermograph
[2020-4-22 7:23:27] Registering accessory 'homebridge-mi-hygrothermograph.Hygrotermograph'
[2020-4-22 7:23:34] [Temperature & Humidity] Initializing Hygrotermograph accessory...
[2020-4-22 7:23:35] [Temperature & Humidity] Start scanning.
HAP Warning: Characteristic undefined not in required or optional characteristics for service 0000008A-0000-1000-8000-0026BB765291. Adding anyway.
HAP Warning: Characteristic 00000010-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000008A-0000-1000-8000-0026BB765291. Adding anyway.
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 158-02-737 │     
    └────────────┘     

[2020-4-22 7:23:43] Homebridge is running on port 51051.

[2020-4-22 6:59:33] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z
[2020-4-22 6:59:33] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z
[2020-4-22 6:59:35] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z
[2020-4-22 6:59:35] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z
[2020-4-22 6:59:44] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z
[2020-4-22 6:59:44] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z
[2020-4-22 6:59:44] [Temperature & Humidity] [58:2D:34:38:28:17] Timed out, last update: 2020-04-21T21:01:59.904Z

Thank you!

splashibiza commented 4 years ago

This just appeared in the log also

[2020-4-22 8:29:16] [Temperature & Humidity] Error: Unknown event type: 16. 5020aa0155172838342d58100002d900 at Parser.parseEventData (/usr/lib/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:226:15) at Parser.parse (/usr/lib/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:64:23) at Scanner.parseServiceData (/usr/lib/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:171:52) at Scanner.onDiscover (/usr/lib/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:92:25) at Noble.emit (events.js:310:20) at Noble.onDiscover (/usr/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/noble.js:178:10) at NobleBindings.emit (events.js:310:20) at NobleBindings.onDiscover (/usr/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:174:10) at Gap.emit (events.js:310:20) at Gap.onHciLeAdvertisingReport (/usr/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/gap.js:256:10)

netRunner0 commented 4 years ago

Not responding…

netRunner0 commented 4 years ago

This problem appeared after updating Node (12.11.1>12.6.2) and Homebridge (0.4.50>0.4.53)

hecguillem commented 4 years ago

Hello,

I have had the same problem but it`s solved.

I am running latest versión of node.js, npm and Homebridge 1.0.4.

First of all uninstall plugin and remove data of json. Restart Homebridge.

Install the plugin using HB terminal: npm install --save homebridge-mi-hygrothermograph@latest

Go again to HB terminal and introduce:

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

Restart Homebridge

Works for me.

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.

iShift commented 4 years ago

Periodically have timeout, only that help me - homebridge restart

holypetrus commented 4 years ago

Hey, I've the same problems. Always "[Temperature & Humidity] [undefined] Timed out" after a few hours running. May that be due to the distance to the sensor? I try to put it near the raspi and leave it there for some weeks.

iShift commented 4 years ago

strange workaround: when i see "no response" i type in terminal: sudo hcitool lescan

and after that - all comes to normal...

holypetrus commented 4 years ago

Hey, it also works for me... But what causes the time out? Is there a fix? Actually its isn't working reliable. That makes it unusable for me.

iShift commented 4 years ago

I made workaround: add this to crontab -e 0 * * * * sudo timeout -s INT 1s hcitool lescan

This command rescan LE devices every one hour

iShift commented 4 years ago

hmm, i have migrated to Raspbian Buster (last OS version) and now all is ok without cron script.

hannseman commented 4 years ago

Looks like some firmware / bluetooth-library issue. Since there's known workarounds and @iShift added documentations about these I'm closing this issue.