rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.73k stars 558 forks source link

add support for dmaker.fan.p39 #1768

Open JoeTN opened 1 year ago

JoeTN commented 1 year ago

Would be great to have support for:

Device information:

Model: dmaker.fan.p39 Hardware version: RTL8720C Firmware version: 2.0.5

iwconfig commented 1 year ago

It has already been requested in https://github.com/rytilahti/python-miio/issues/1544 and I think already added as a generic device with https://github.com/rytilahti/python-miio/pull/1581

But i'm not sure it works as expected so I'm chiming in here with an error message I want to get rid of:

2023-04-26 16:34:54.214 WARNING (SyncWorker_1) [miio.miot_device] Unable to find mapping for dmaker.fan.p39, falling back to dmaker.fan.p9
2023-04-26 16:34:54.498 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 193, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 341, in _async_refresh
    self.async_update_listeners()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 142, in async_update_listeners
    update_callback()
  File "/usr/lib/python3.10/site-packages/homeassistant/components/xiaomi_miio/fan.py", line 1085, in _handle_coordinator_update
    self._preset_mode = self.coordinator.data.mode.name
  File "/usr/lib/python3.10/site-packages/miio/integrations/fan/dmaker/fan_miot.py", line 153, in mode
    return OperationMode[OperationModeMiot(self.data["mode"]).name]
  File "/usr/lib/python3.10/enum.py", line 385, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.10/enum.py", line 710, in __new__
    raise ve_exc
ValueError: None is not a valid OperationModeMiot

I could be wrong but I suspect it is related.

JoeTN commented 1 year ago

Got the same error, so it could be related.

sicardf commented 1 year ago

Hey 👋

I made a configuration with dmaker.fan.p11 specification in HASS. All operation except oscillation angle change 🙃

Capture d’écran 2023-05-31 à 13 46 23
Landrash commented 1 year ago

Added support in #1784 even tough there's support with genericmiot in #1581.