xiaomi-mi-air-purifier: Child lock and Filter life don't work in 2H and Pro H

Child lock and Filter life don’t work in 2H and Pro H. They throw Cannot read properties of undefined (reading 'value').

20/11/2021, 19:08:09] [homebridge-xiaomi-mi-air-purifier] This plugin threw an error from the characteristic 'Lock Physical Controls': Unhandled error thrown inside read handler for characteristic: Cannot read properties of undefined (reading 'value'). See https://git.io/JtMGR for more info.
[20/11/2021, 19:08:09] [homebridge-xiaomi-mi-air-purifier] This plugin threw an error from the characteristic 'Filter Life Level': Unhandled error thrown inside read handler for characteristic: Cannot read properties of undefined (reading 'value'). See https://git.io/JtMGR for more info.
[20/11/2021, 19:08:09] [homebridge-xiaomi-mi-air-purifier] This plugin threw an error from the characteristic 'Filter Change Indication': Unhandled error thrown inside read handler for characteristic: Cannot read properties of undefined (reading 'value'). See https://git.io/JtMGR for more info.

Version is homebridge-xiaomi-mi-air-purifier v2.0.0 NPM 8.1.4 Node 16.13

Affected Devices

  • Xiaomi Air Purifier 2H
  • Xiaomi Air Purifier 2S
  • Xiaomi Air Purifier Pro H

_Reported by @Dane03 in https://github.com/torifat/xiaomi-mi-air-purifier/issues/226#issuecomment-974690483_ _Reported by @guesq in https://github.com/torifat/xiaomi-mi-air-purifier/issues/226#issuecomment-974759096_

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Thanks, @luluhoc. Can you please share the output of the following code snippet?

require('miio')
  .device({
    address: "?.?.?.?",
    token: "YOUR_TOKEN",
  })
  .then(console.log);

It should output something like:

MiioDevice {
  model=zhimi.airpurifier.mb3,
  types=miio:air-purifier, sensor, miio, air-purifier,
  capabilities=fan-speed, miio:led-brightness, pm2.5, relative-humidity, temperature, switchable-mode, mode, switchable-power, restorable-state, power, state
}

⚠️ If it spits out any private information please remove it before sharing.

@torifat, this is the output of my device. Looks like my device is Air Purifier 2. I thought it was 2H. Sorry for the misinformation.

MiioDevice {
  model=zhimi.airpurifier.m1,
  types=miio:air-purifier, sensor, miio, air-purifier,
  capabilities=miio:buzzer, miio:led-brightness, miio:switchable-led, pm2.5, relative-humidity, temperature, switchable-mode, mode, switchable-power, restorable-state, power, state
}

Can you folks try the new version 2.0.1 and see if it fixes your problem.

also check this out this guy listed all properties https://github.com/syssi/xiaomi_airpurifier

@luluhoc Thanks, but I don’t actually need those. Xiaomi has an official API that gives you those. I’m asking you folks to run it to see what miio library gives us, not what is supported.

@torifat Thanks for your effort. There are no error messages when starting Homebridge now. The values of Filter Life Level and Filter Change Indication should be correct. Filter Life Level

But when Fan speed is enabled and I’m trying to adjust the fan speed in Home app, I get the following errors:

[homebridge-xiaomi-mi-air-purifier] This plugin threw an error from the characteristic 'Rotation Speed': Unhandled error thrown inside write handler for characteristic: Mode `none` not supported. See https://git.io/JtMGR for more info.

When Child Lock is enabled and switched on or off in Home app, I get the following errors:

[homebridge-xiaomi-mi-air-purifier] This plugin threw an error from the characteristic 'Lock Physical Controls': Unhandled error thrown inside write handler for characteristic: device.changeChildLock is not a function. See https://git.io/JtMGR for more info.

Can you folks try the new version 2.0.1 and see if it fixes your problem.

also check this out this guy listed all properties https://github.com/syssi/xiaomi_airpurifier

@luluhoc Thanks, but I don’t actually need those. Xiaomi has an official API that gives you those. I’m asking you folks to run it to see what miio library gives us, not what is supported.

I will try it later when I’ll get home from work 😃

@torifat This is the 2S:

MiioDevice {
  model=zhimi.airpurifier.ma2,
  types=miio:air-purifier, sensor, miio, air-purifier,
  capabilities=miio:buzzer, miio:led-brightness, miio:switchable-led, pm2.5, relative-humidity, temperature, switchable-mode, mode, switchable-power, restorable-state, power, state
}

(edit: relevant to #10) Are you saying there differences depending on which version of the miio NPM module is installed?