Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for: xiaomi.airp.cpa4 #1869

Closed
Dentrax opened this issue Dec 4, 2023 · 5 comments
Closed

Add support for: xiaomi.airp.cpa4 #1869

Dentrax opened this issue Dec 4, 2023 · 5 comments

Comments

@Dentrax
Copy link

Dentrax commented Dec 4, 2023

If you are receiving a warning indicating an unsupported model (Found an unsupported model '<model>' for class '<class>'.),
this means that the implementation does not list your model as supported.

If it is working fine for you nevertheless, feel free to open an issue or create a PR to add the model to the _supported_models (example) for that class.

Before submitting, use the search to see if there is an existing issue for the device model, thanks!

Device information:

Use miiocli device --ip <ip address> --token <token>.

  • Model: xiaomi.airp.cpa4
  • Hardware version: esp32
  • Firmware version: 2.1.8_0012
@Dentrax
Copy link
Author

Dentrax commented Dec 4, 2023

I couldn't see any airprufier integration in xiaomi folder: https://github.com/rytilahti/python-miio/tree/master/miio/integrations/xiaomi

In which source file should this work be done?

@Dentrax
Copy link
Author

Dentrax commented Dec 4, 2023

$ miiocli device --token TOKEN --ip $IP info
Model: xiaomi.airp.cpa4
Hardware version: esp32
Firmware version: 2.1.8_0012

Whereas the following doesn't:

$ miiocli airpurifier --token $TOKEN --ip $IP status
WARNING:miio.device:Found an unsupported model 'xiaomi.airp.cpa4' for class 'AirPurifier'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
ERROR:miio.miioprotocol:Got error when receiving: {'code': -9999, 'message': 'user ack timeout'}
Error: Unable to recover failed command

Falling back to zhimi.airpurifier.ma4, also does not work

miiocli airpurifiermiot --token $XAP_TOKEN --ip 192.168.3.17 status
WARNING:miio.device:Found an unsupported model 'xiaomi.airp.cpa4' for class 'AirPurifierMiot'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
WARNING:miio.miot_device:Unable to find mapping for xiaomi.airp.cpa4, falling back to zhimi.airpurifier.ma4
Power: off
...
...
...
Filter type: None

@rytilahti
Copy link
Owner

Hi,

what's the name of the class you are getting this warning, probably something that is using MiotDevice or Device directly? Anyway, the new devices are supported by genericmiot integration (https://github.com/rytilahti/python-miio/#controlling-modern-miot-devices) and the warning will disappear when I find enough time to prepare a new release.

@Dentrax
Copy link
Author

Dentrax commented Dec 7, 2023

what's the name of the class you are getting this warning

Ah, missed that one. Here it is:
WARNING:miio.device:Found an unsupported model 'xiaomi.airp.cpa4' for class 'AirPurifier'.

the new devices are supported by genericmiot integration

I've already tried that but ran into an issue:

$ miiocli genericmiot --token $TOKEN --ip $IP status
Usage: miiocli [OPTIONS] COMMAND [ARGS]...
Try 'miiocli --help' for help.

Error: No such command 'genericmiot'.

I think that's because 0.6.0 haven't cut yet.

Edit:

I tried to install the latest version with the following:

pip3 install git+https://github.com/rytilahti/python-miio.git@master

Now I able to get success responses, thank you!

miiocli genericmiot --token $TOKEN --ip $IP status
Running command status
Service [bold]Air Purifier (air-purifier)[/bold]
	Device Fault (air-purifier:fault, access: R): No Faults (value: 0)
Service [bold]Environment (environment)[/bold]
	PM2.5 Density (environment:pm2.5-density, access: R): 3 None
Service [bold]Filter (filter)[/bold]
	Filter Life Level (filter:filter-life-level, access: R): 100 %
	Filter Used Time (filter:filter-used-time, access: R): 2 days, 11:00:00
	Filter Left Time (filter:filter-left-time, access: R): 289 days, 0:00:00
Service [bold]custom-service (custom-service)[/bold]
	 (custom-service:motor-speed-rpm, access: R): 2048 None

Will there be a new version cut soon?

@rytilahti
Copy link
Owner

You're welcome! I haven't had much time nor motivation to work on finishing some remaining issues to get a new release out, but you can click "watch" on #1808 to follow the status. I'll close this issue now given it's fixed :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants