merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
386 stars 61 forks source link

Xiaomi ClearGrass Air Detector - no data after last firmware update #323

Closed OwlBawl closed 2 years ago

OwlBawl commented 2 years ago

Describe the bug After last updating a ClearGrass Air Monitor to 4.1.8_0244 in quingping app (in MiHome shows as 4.1.8_9999) the device data is not available in HK / HB. It is still available in MiHome.

Your config.json { "micloud": { "username": "mail", "password": "secret", "country": "cn", "forceMiCloud": false }, "devices": [ { "name": "Air quality detector", "ip": "10.10.20.31", "token": "token", "model": "cgllc.airmonitor.s1", "pollingInterval": 10, "deepDebugLog": false, "micloud": { "username": "mail", "password": "password", "country": "cn", "forceMiCloud": false }, "buzzerControl": false, "ledControl": false, "childLockControl": false, "modeControl": false, "co2AbnormalThreshold": 1000 } ], "platform": "miot" }

Debug log [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Model known: cgllc.airmonitor.s1! [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Initializing device! [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Using module class for device type AirMonitor, indentified by miot spec! Not all features might work! [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Initializing device services [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Device services: [ "environment", "battery" ] [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Initializing device properties [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Device properties: [ "environment:relative-humidity", "environment:pm2.5-density", "environment:temperature", "environment:co2-density", "environment:tvoc-density", "battery:battery-level", "battery:charging-state" ] [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Initializing device actions [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Successfully created a AirMonitor device! It is a Unknown air monitor device. [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Initializing accessory! [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Accessory successfully initialized! [8/21/2022, 1:51:43 AM] [miot] [Air quality detector] Registering 1 accessories! [8/21/2022, 1:51:44 AM] [miot] [Air quality detector] Everything looks good! Initiating property polling!

Screenshots

Screenshot 2022-08-21 at 01 42 11 Screenshot 2022-08-21 at 01 42 37
merdok commented 2 years ago

Might be that the spec has changed. In that case you would need remove the cached spec and the plugin will re download it. The spec directory is located under your prefsDirwhich is usually located in the .homebridge directory under .xiaomiMiot

OwlBawl commented 2 years ago

Removed cgllc.airmonitor.s1.spec.json in /var/lib/homebridge/.xiaomiMiot/spec (Homebridge installed on RPi) Nothing changed after reboot and .json restore...

Screenshot 2022-08-21 at 09 39 01
merdok commented 2 years ago

Then you would need to post a homebridge debug log so we can see what is actually happening there.

OwlBawl commented 2 years ago

[8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Successfully created a AirMonitor device! It is a Unknown air monitor device. [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Found cached accessory for this device! Unregistering it first! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Initializing accessory! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Creating AirMonitor accessory for device Air quality detector! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Found accessory class at ../modules/airmonitor/AirMonitorAccessory.js! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Accessory successfully initialized! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Final properties to monitor: [ "environment:relative-humidity", "environment:pm2.5-density", "environment:temperature", "environment:co2-density", "environment:tvoc-density", "battery:battery-level", "battery:charging-state" ] [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Registering 1 accessories! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] Everything looks good! Initiating property polling! [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] (Protocol) Start handshake 10.10.20.31 [8/21/2022, 10:23:44 AM] [miot] [Air quality detector] (Protocol) Server listening 0.0.0.0:53861 [8/21/2022, 10:23:44 AM] [RPi] hardware: Raspberry Pi 4B 1.1 (4GB) [8/21/2022, 10:23:44 AM] [RPi] os: Debian GNU/Linux 11 (bullseye) [8/21/2022, 10:23:44 AM] [RPi] restored 1 accessories from cache [8/21/2022, 10:23:45 AM] [Camera FFmpeg] Launched child bridge with PID 208262 [8/21/2022, 10:23:45 AM] [Google Smart Home] Launched child bridge with PID 208263 [8/21/2022, 10:23:45 AM] [RPi] check RPi at localhost:8888 [8/21/2022, 10:23:45 AM] [RPi] read file: /proc/1/sched [8/21/2022, 10:23:45 AM] [RPi] npm registry: request 1: GET /homebridge-rpi/latest [8/21/2022, 10:23:45 AM] [RPi] exec: vcgencmd measure_temp [8/21/2022, 10:23:45 AM] [RPi] RPi: Raspberry Pi 4B 1.1 (4GB) - 10000000B592908B [8/21/2022, 10:23:45 AM] [RPi] RPi: localhost [8/21/2022, 10:23:45 AM] [RPi] warning: RPi: Raspberry Pi 4B: no USB power support [8/21/2022, 10:23:45 AM] [RPi] RPi History: restored 1576 history entries [8/21/2022, 10:23:45 AM] [RPi] RPi: used gpios: [] [8/21/2022, 10:23:45 AM] [RPi] initialised [8/21/2022, 10:23:45 AM] [RPi] flush cachedAccessories [8/21/2022, 10:23:45 AM] Registering platform 'homebridge-gsh.google-smarthome' [8/21/2022, 10:23:45 AM] [Google Smart Home] Loaded homebridge-gsh v2.2.0 child bridge successfully [8/21/2022, 10:23:45 AM] Registering platform 'homebridge-camera-ffmpeg.Camera-ffmpeg' [8/21/2022, 10:23:45 AM] [Camera FFmpeg] Loaded homebridge-camera-ffmpeg v3.1.4 child bridge successfully [8/21/2022, 10:23:45 AM] Loaded 0 cached accessories from cachedAccessories.0E49D0A579E2. [8/21/2022, 10:23:46 AM] Publishing bridge accessory (name: Google Smart Home, publishInfo: { username: '0E:49:D0:A5:79:E2', port: 34589, pincode: '*-*-', category: 2, bind: [ 'eth0', [length]: 1 ], mdns: undefined, addIdentifyingMaterial: true, advertiser: 'bonjour-hap' }). [8/21/2022, 10:23:46 AM] Loaded 0 cached accessories from cachedAccessories.0E18D14B4B95. [8/21/2022, 10:23:46 AM] [RPi] npm registry: request 1: 200 OK [8/21/2022, 10:23:46 AM] [RPi] latest version: homebridge-rpi v1.3.25 [8/21/2022, 10:23:46 AM] Publishing bridge accessory (name: Camera FFmpeg, publishInfo: { username: '0E:18:D1:4B:4B:95', port: 48422, pincode: '*-*-', category: 2, bind: [ 'eth0', [length]: 1 ], mdns: undefined, addIdentifyingMaterial: true, advertiser: 'bonjour-hap' }). [8/21/2022, 10:23:46 AM] Homebridge v1.5.0 (HAP v0.10.2) (Camera FFmpeg) is running on port 48422. [8/21/2022, 10:23:46 AM] Homebridge v1.5.0 (HAP v0.10.2) (Google Smart Home) is running on port 34589. [8/21/2022, 10:23:46 AM] [Google Smart Home] Waiting 15 seconds before starting instance discovery... [8/21/2022, 10:23:47 AM] [Google Smart Home] Connected (1) - wss://homebridge-gsh.iot.oz.nu [8/21/2022, 10:23:49 AM] [miot] [Air quality detector] Error: Could not connect to device, handshake timeout [8/21/2022, 10:23:49 AM] [miot] [Air quality detector] Could not connect to the device! Retrying in 60 seconds! [8/21/2022, 10:23:51 AM] [RPi] RPi History: add entry 1577: {"time":1661066632,"temp":51.1} [8/21/2022, 10:23:51 AM] [RPi] RPi History: set history status to: "0b411300 00000000 fdd39e28 [03 0102 0202 0302] 2a06 c00f 00000000 000000000101" [8/21/2022, 10:23:51 AM] [RPi] RPi History: set History Status from "rz8TAAAAAAD9054oAwECAgIDAikGwA8AAAAAAAAAAAEB" to "C0ETAAAAAAD9054oAwECAgIDAioGwA8AAAAAAAAAAAEB" [8/21/2022, 10:24:00 AM] [RPi] RPi: exec: vcgencmd measure_temp [8/21/2022, 10:24:00 AM] [RPi] RPi: exec: vcgencmd measure_clock arm [8/21/2022, 10:24:00 AM] [RPi] RPi: exec: vcgencmd measure_volts [8/21/2022, 10:24:00 AM] [RPi] RPi: exec: vcgencmd get_throttled [8/21/2022, 10:24:00 AM] [RPi] RPi: state: {"date":"2022-08-21T07:24:01.000Z","boot":"2022-08-17T04:00:17.630Z","powerLed":null,"load":0.3,"temp":51.6,"freq":900228544,"volt":0.85,"throttled":0} [8/21/2022, 10:24:00 AM] [RPi] RPi: set Current Temperature from 51.1°C to 51.6°C [8/21/2022, 10:24:00 AM] [RPi] RPi: set Frequency from 1500MHz to 900MHz [8/21/2022, 10:24:00 AM] [RPi] RPi: set Load from 0.01 to 0.3 [8/21/2022, 10:24:00 AM] [RPi] RPi: set Last Updated from "Sun Aug 21 2022 10:23:13" to "Sun Aug 21 2022 10:24:01" [8/21/2022, 10:24:02 AM] [RPi] RPi History: send data: 00 [8/21/2022, 10:24:02 AM] [RPi] RPi History: get History Entries: return "AA==" [8/21/2022, 10:24:12 AM] [Google Smart Home] Finished instance discovery [8/21/2022, 10:24:12 AM] [Google Smart Home] Not registering DS-KH8520-WTE1/1/0 - Pin cide has not been set and is required for secure LockMechanism accessory types. See https://git.io/JUQWX [8/21/2022, 10:24:12 AM] [Google Smart Home] HAP Event listeners registered succesfully [8/21/2022, 10:24:15 AM] [RPi] flush cachedAccessories [8/21/2022, 10:24:15 AM] [RPi] RPi: exec: vcgencmd measure_temp [8/21/2022, 10:24:15 AM] [RPi] RPi: exec: vcgencmd measure_clock arm [8/21/2022, 10:24:15 AM] [RPi] RPi: exec: vcgencmd measure_volts [8/21/2022, 10:24:15 AM] [RPi] RPi: exec: vcgencmd get_throttled [8/21/2022, 10:24:15 AM] [RPi] RPi: state: {"date":"2022-08-21T07:24:16.000Z","boot":"2022-08-17T04:00:17.620Z","powerLed":null,"load":0.23,"temp":52.1,"freq":600169920,"volt":0.85,"throttled":0} [8/21/2022, 10:24:15 AM] [RPi] RPi: set Current Temperature from 51.6°C to 52.1°C [8/21/2022, 10:24:15 AM] [RPi] RPi: set Frequency from 900MHz to 600MHz [8/21/2022, 10:24:15 AM] [RPi] RPi: set Load from 0.3 to 0.23 [8/21/2022, 10:24:15 AM] [RPi] RPi: set Last Updated from "Sun Aug 21 2022 10:24:01" to "Sun Aug 21 2022 10:24:16" [8/21/2022, 10:24:17 AM] [Google Smart Home] Sending State Report [8/21/2022, 10:24:17 AM] [Google Smart Home] { "type": "report-state", "body": { "2f05d9586af35bf6a4c0ec2b79ea83b593bf248d26446586f35246459ae58d38": { "online": true, "temperatureSetpointCelsius": 52.1, "temperatureAmbientCelsius": 52.1 } } } [8/21/2022, 10:24:27 AM] [Google Smart Home] Sending Sync Request [8/21/2022, 10:24:27 AM] [Google Smart Home] Please connect with the Google Home app: https://git.io/JfuHC [8/21/2022, 10:24:30 AM] [RPi] RPi: exec: vcgencmd measure_temp [8/21/2022, 10:24:30 AM] [RPi] RPi: exec: vcgencmd measure_clock arm [8/21/2022, 10:24:30 AM] [RPi] RPi: exec: vcgencmd measure_volts [8/21/2022, 10:24:30 AM] [RPi] RPi: exec: vcgencmd get_throttled [8/21/2022, 10:24:30 AM] [RPi] RPi: state: {"date":"2022-08-21T07:24:31.000Z","boot":"2022-08-17T04:00:17.640Z","powerLed":null,"load":0.18,"temp":50.6,"freq":600117184,"volt":0.85,"throttled":0} [8/21/2022, 10:24:30 AM] [RPi] RPi: set Current Temperature from 52.1°C to 50.6°C [8/21/2022, 10:24:30 AM] [RPi] RPi: set Load from 0.23 to 0.18 [8/21/2022, 10:24:30 AM] [RPi] RPi: set Last Updated from "Sun Aug 21 2022 10:24:16" to "Sun Aug 21 2022 10:24:31" [8/21/2022, 10:24:32 AM] [Google Smart Home] Sending State Report [8/21/2022, 10:24:32 AM] [Google Smart Home] { "type": "report-state", "body": { "2f05d9586af35bf6a4c0ec2b79ea83b593bf248d26446586f35246459ae58d38": { "online": true, "temperatureSetpointCelsius": 50.6, "temperatureAmbientCelsius": 50.6 } } } [8/21/2022, 10:24:44 AM] [Plugin Update] homebridge-config-ui-x reports 0 outdated package(s): [] [8/21/2022, 10:24:45 AM] [RPi] RPi: exec: vcgencmd measure_temp [8/21/2022, 10:24:45 AM] [RPi] RPi: exec: vcgencmd measure_clock arm [8/21/2022, 10:24:45 AM] [RPi] RPi: exec: vcgencmd measure_volts [8/21/2022, 10:24:45 AM] [RPi] RPi: exec: vcgencmd get_throttled [8/21/2022, 10:24:45 AM] [RPi] RPi: state: {"date":"2022-08-21T07:24:46.000Z","boot":"2022-08-17T04:00:17.640Z","powerLed":null,"load":0.14,"temp":51.1,"freq":1500345728,"volt":0.85,"throttled":0} [8/21/2022, 10:24:45 AM] [RPi] RPi: set Current Temperature from 50.6°C to 51.1°C [8/21/2022, 10:24:45 AM] [RPi] RPi: set Frequency from 600MHz to 1500MHz [8/21/2022, 10:24:45 AM] [RPi] RPi: set Load from 0.18 to 0.14 [8/21/2022, 10:24:45 AM] [RPi] RPi: set Last Updated from "Sun Aug 21 2022 10:24:31" to "Sun Aug 21 2022 10:24:46" [8/21/2022, 10:24:47 AM] [Google Smart Home] Sending State Report [8/21/2022, 10:24:47 AM] [Google Smart Home] { "type": "report-state", "body": { "2f05d9586af35bf6a4c0ec2b79ea83b593bf248d26446586f35246459ae58d38": { "online": true, "temperatureSetpointCelsius": 51.1, "temperatureAmbientCelsius": 51.1 } } } [8/21/2022, 10:24:49 AM] [miot] [Air quality detector] (Protocol) Start handshake 10.10.20.31 [8/21/2022, 10:24:54 AM] [miot] [Air quality detector] Error: Could not connect to device, handshake timeout [8/21/2022, 10:24:54 AM] [miot] [Air quality detector] Could not connect to the device! Retrying in 60 seconds! [8/21/2022, 10:25:00 AM] [RPi] RPi: exec: vcgencmd measure_temp [8/21/2022, 10:25:00 AM] [RPi] RPi: exec: vcgencmd measure_clock arm [8/21/2022, 10:25:00 AM] [RPi] RPi: exec: vcgencmd measure_volts [8/21/2022, 10:25:00 AM] [RPi] RPi: exec: vcgencmd get_throttled [8/21/2022, 10:25:00 AM] [RPi] RPi: state: {"date":"2022-08-21T07:25:01.000Z","boot":"2022-08-17T04:00:17.640Z","powerLed":null,"load":0.11,"temp":51.6,"freq":600169920,"volt":0.85,"throttled":0} [8/21/2022, 10:25:00 AM] [RPi] RPi: set Current Temperature from 51.1°C to 51.6°C [8/21/2022, 10:25:00 AM] [RPi] RPi: set Frequency from 1500MHz to 600MHz [8/21/2022, 10:25:00 AM] [RPi] RPi: set Load from 0.14 to 0.11 [8/21/2022, 10:25:00 AM] [RPi] RPi: set Last Updated from "Sun Aug 21 2022 10:24:46" to "Sun Aug 21 2022 10:25:01" [8/21/2022, 10:25:02 AM] [Google Smart Home] Sending State Report [8/21/2022, 10:25:02 AM] [Google Smart Home] { "type": "report-state", "body": { "2f05d9586af35bf6a4c0ec2b79ea83b593bf248d26446586f35246459ae58d38": { "online": true, "temperatureSetpointCelsius": 51.6, "temperatureAmbientCelsius": 51.6 } } } [8/21/2022, 10:25:15 AM] [RPi] RPi: exec: vcgencmd measure_temp [8/21/2022, 10:25:15 AM] [RPi] RPi: exec: vcgencmd measure_clock arm [8/21/2022, 10:25:15 AM] [RPi] RPi: exec: vcgencmd measure_volts [8/21/2022, 10:25:15 AM] [RPi] RPi: exec: vcgencmd get_throttled [8/21/2022, 10:25:15 AM] [RPi] RPi: state: {"date":"2022-08-21T07:25:16.000Z","boot":"2022-08-17T04:00:17.640Z","powerLed":null,"load":0.08,"temp":50.6,"freq":600169920,"volt":0.85,"throttled":0} [8/21/2022, 10:25:15 AM] [RPi] RPi: set Current Temperature from 51.6°C to 50.6°C [8/21/2022, 10:25:15 AM] [RPi] RPi: set Load from 0.11 to 0.08 [8/21/2022, 10:25:15 AM] [RPi] RPi: set Last Updated from "Sun Aug 21 2022 10:25:01" to "Sun Aug 21 2022 10:25:16"

OwlBawl commented 2 years ago
Screenshot 2022-08-21 at 10 26 40
OwlBawl commented 2 years ago

Foud it's the common problem for last update https://github.com/Cheaterdev/clear_grass-ha/issues/13

merdok commented 2 years ago

I am seeing a handshake timeout on your device, which might indicate that your token is not correct. Maybe it changed?

OwlBawl commented 2 years ago

That’s why added screen with token from cloud… or should I try another option to check it?

merdok commented 2 years ago

I do not know if your cloud token is up to date... The token from the cloud can be outdated. Either update the cloud token by resetting the device and re-adding it to the cloud or try to retrieve it manually.

OwlBawl commented 2 years ago

Made reset and repaired yesterday... would try to find other working solution for mac to check tocken

OwlBawl commented 2 years ago

Tried now also https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor and https://github.com/Maxmudjon/Get_MiHome_devices_token/releases

tools for get token - all give the same result.... and the Air Sensor works fine in MiHome as well token was renewed yesterday when RePaired

merdok commented 2 years ago

If you say that the token is correct then i am not sure what the issue is. Other then that you could try to force it over the micloud and see if that helps.

OwlBawl commented 2 years ago

Tried already "force micloud", had no luck...

merdok commented 2 years ago

In that case something broke the device after the update which i have no control over unfortunately. But handshake timeout is in 95% of the cases incorrect token so other then advising to make sure that it is correct, there is nothing else i can do...

OwlBawl commented 2 years ago

Made the wifi reconnect and MiHome reconnect. The token has updated propertly after manipulation as it should.. added new token to config and still no luck. It seems they broke the data response somehow. For HA people already found the fix https://github.com/rytilahti/python-miio/pull/1510 Hope it could help to fix the integration...

merdok commented 2 years ago

Your problem has nothing to do with the mentioned issue...

The plugin cannot connect to your device anymore and the most likely issue is either your token or ip are incorrect!

In those issue which you mentioned people are writing that after the update the token has changed for their devices, I assume the same happened to you... Did you enter the new token in the config.json?

OwlBawl commented 2 years ago

Yes, changed token twice already

OwlBawl commented 2 years ago

The IP is fixed and also confirmed by token extractor…

OwlBawl commented 2 years ago

And after token update for HA users - it didn’t work before fix also…

OwlBawl commented 2 years ago

The device is accessible itself also, checked:

traceroute to 10.10.20.31 (10.10.20.31), 64 hops max, 52 byte packets 1 unifi (10.10.10.1) 4.377 ms 3.580 ms 3.505 ms 2 qingping-air-monitor (10.10.20.31) 97.862 ms 6.858 ms 5.396 ms

PING 10.10.20.31 (10.10.20.31): 56 data bytes 64 bytes from 10.10.20.31: icmp_seq=0 ttl=63 time=110.315 ms 64 bytes from 10.10.20.31: icmp_seq=1 ttl=63 time=16.911 ms 64 bytes from 10.10.20.31: icmp_seq=2 ttl=63 time=7.651 ms 64 bytes from 10.10.20.31: icmp_seq=3 ttl=63 time=64.819 ms

OwlBawl commented 2 years ago
Screenshot 2022-08-22 at 12 18 31
merdok commented 2 years ago

I mean you can post a homebridge debug log with the deepDebugLog parameter set to true, but it still looks like a connection issue for me.

OwlBawl commented 2 years ago

The log I've already posted was with debug = true set

merdok commented 2 years ago

But you did not have the deepDebugLog property enabled.

OwlBawl commented 2 years ago

Take a look at screenshot I've poster 3 messages earlier DeepDebug = true

merdok commented 2 years ago

Oh, right...

Yeah, so based on that everything points to an invalid token. The plugin simply cannot connect to the device with the data which you specified.