NikolayBorisov / xiaomi_airfresh

Add support Xiaomi Mi Air Purifier A1 (MJXFJ-150-A1) Model: dmaker.airfresh.a1
13 stars 2 forks source link

could you add support dmaker.airfresh.t2017 #2

Open superwangmeng opened 4 years ago

superwangmeng commented 4 years ago

hi, thanks for your contribution,could you support dmaker.airfresh.t2017, I can find another version(mypal/mi-airfresh) support dmaker.airfresh.t2017, but it works not very well, only "turn on" and "turn off" works well, " auto, sleep, favourite" doesn't work,but in Mijia app, if you choose " auto, sleep, favourite",it works and the status will deliver to the homeassistant and Homekit .

NikolayBorisov commented 4 years ago

@superwangmeng Have you just tried this integration without specifying a model? The API looks very similar, if it at least partially works, then the chances to did it are great

superwangmeng commented 4 years ago

@NikolayBorisov thanks for your reply, i have tried 10 min before ,I delete the "model",and restart HA, it doesn't work now, there is the log when HA restart:

Logger: homeassistant.components.fan Source: custom_components/xiaomi_airfresh/fan.py:272 Integration: 风扇 (documentation, issues) First occurred: 下午8:27:55 (1 occurrences) Last logged: 下午8:27:55

xiaomi_airfresh: Error on device update! ValueError: None is not a valid OperationMode

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 319, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in async_device_update await self.async_update() File "/config/custom_components/xiaomi_airfresh/fan.py", line 438, in async_update key, value in self._available_attributes.items()}) File "/config/custom_components/xiaomi_airfresh/fan.py", line 438, in key, value in self._available_attributes.items()}) File "/config/custom_components/xiaomi_airfresh/fan.py", line 379, in _extract_value_from_attribute value = getattr(state, attribute) File "/config/custom_components/xiaomi_airfresh/fan.py", line 272, in mode return OperationMode(self.data["mode"]) File "/usr/local/lib/python3.7/enum.py", line 310, in call return cls.new(cls, value) File "/usr/local/lib/python3.7/enum.py", line 564, in new raise exc File "/usr/local/lib/python3.7/enum.py", line 548, in new result = cls.missing(value) File "/usr/local/lib/python3.7/enum.py", line 577, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: None is not a valid OperationMode

if I rename the model to"dmaker.airfresh.a1", the device in homeassistant and homekit no response .

superwangmeng commented 4 years ago

there is the log when I rename the model to"dmaker.airfresh.a1", it doesnt work too.

Logger: homeassistant.components.fan Source: custom_components/xiaomi_airfresh/fan.py:272 Integration: 风扇 (documentation, issues) First occurred: 下午8:47:41 (1 occurrences) Last logged: 下午8:47:41

xiaomi_airfresh: Error on device update! ValueError: None is not a valid OperationMode

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 319, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in async_device_update await self.async_update() File "/config/custom_components/xiaomi_airfresh/fan.py", line 438, in async_update key, value in self._available_attributes.items()}) File "/config/custom_components/xiaomi_airfresh/fan.py", line 438, in key, value in self._available_attributes.items()}) File "/config/custom_components/xiaomi_airfresh/fan.py", line 379, in _extract_value_from_attribute value = getattr(state, attribute) File "/config/custom_components/xiaomi_airfresh/fan.py", line 272, in mode return OperationMode(self.data["mode"]) File "/usr/local/lib/python3.7/enum.py", line 310, in call return cls.new(cls, value) File "/usr/local/lib/python3.7/enum.py", line 564, in new raise exc File "/usr/local/lib/python3.7/enum.py", line 548, in new result = cls.missing(value) File "/usr/local/lib/python3.7/enum.py", line 577, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: None is not a valid OperationMode