al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.7k stars 663 forks source link

Support for Aircon Companion: Device Support - lumi.acpartner.mcn04 / KTB04LM #191

Closed johnjoemorgan closed 3 years ago

johnjoemorgan commented 3 years ago

Devices are found and integrated as usual but are unavailable in HA

Logged error is: This error originated from a custom integration.

Logger: custom_components.xiaomi_miot.climate Source: custom_components/xiaomi_miot/init.py:1031 Integration: Xiaomi Miot Auto (documentation, issues) First occurred: 11:58:01 (5 occurrences) Last logged: 12:00:16

Aircon Master Air Conditioner: Got MiioException while fetching the state: {'code': -9999, 'message': 'user ack timeout'}, mapping: {'air_conditioner.on': {'siid': 3, 'piid': 1}, 'air_conditioner.mode': {'siid': 3, 'piid': 2}, 'air_conditioner.fault': {'siid': 3, 'piid': 3}, 'target_temperature-3-4': {'siid': 3, 'piid': 4}, 'indicator_light': {'siid': 9, 'piid': 1}, 'indicator_light.effective_time': {'siid': 9, 'piid': 2}, 'ac_function.set_ele_info': {'siid': 8, 'piid': 1}, 'ac_function.brand_id': {'siid': 8, 'piid': 2}, 'ac_function.remote_id': {'siid': 8, 'piid': 3}, 'ac_function.ac_mode': {'siid': 8, 'piid': 4}, 'ac_function.ac_type': {'siid': 8, 'piid': 5}, 'ac_function.ac_ctrl_range': {'siid': 8, 'piid': 6}, 'ac_function.ac_state': {'siid': 8, 'piid': 7}, 'ac_function.quick_cool_enable': {'siid': 8, 'piid': 8}, 'ac_function.quick_cool_time': {'siid': 8, 'piid': 9}, 'ac_function.quick_cool_status': {'siid': 8, 'piid': 10}, 'ac_function.sleep_cfg': {'siid': 8, 'piid': 11}, 'ac_function.sleep_status': {'siid': 8, 'piid': 12}, 'power_consumption': {'siid': 7, 'piid': 1}, 'electric_power-7-2': {'siid': 7, 'piid': 2}, 'power_consumption-7-3': {'siid': 7, 'piid': 3}, 'electric_power-7-4': {'siid': 7, 'piid': 4}, 'fan_control.fan_level': {'siid': 4, 'piid': 2}, 'fan_control.vertical_swing': {'siid': 4, 'piid': 4}}, max_properties: 10

al-one commented 3 years ago

This model: lumi.acpartner.mcn04 is defined in MIOT_LOCAL_MODELS because other users report that it supports miot in LAN. You can try to add custom attributes to the entity:

climate.lumi_mcn04_entity_id:
  chunk_properties: 7

If it is still unavailable after a few minutes, please add a custom attribute:

climate.lumi_mcn04_entity_id:
  miot_cloud: true
johnjoemorgan commented 3 years ago

@al-one Thank you Added

climate.lumi_mcn04_8e92_air_conditioner_2:
  chunk_properties: 7
climate.lumi_mcn04_8e92_air_conditioner_2:
  miot_cloud: true

to customize.yaml but the device is still unavailable

johnjoemorgan commented 3 years ago

@al-one My error. Updated code to:

climate.lumi_mcn04_8e92_air_conditioner_2:
  chunk_properties: 7
  miot_cloud: true

and the device is working great and reporting kWh and W

al-one commented 3 years ago

Please set miot_cloud: false to check whether this device can support miot in LAN:

climate.lumi_mcn04_8e92_air_conditioner_2:
  chunk_properties: 7
  miot_cloud: false

If the entity is still unavailable, set it to true.

johnjoemorgan commented 3 years ago

Hi

miot_cloud: false

works as well as true setting.

However, I have noticed that the temperature settings (for both miot_cloud true and false) does not work. The reading is 16 and if I try to change that to say 26 it reverts back to 16 after 2-3 seconds.

Error:

Logger: homeassistant.components.climate Source: custom_components/xiaomi_miio_airconditioningcompanionmcn02/climate.py:323 Integration: Climate (documentation, issues) First occurred: 20:45:50 (2 occurrences) Last logged: 20:45:50

xiaomi_miio_airconditioningcompanionmcn02: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 633, in async_device_update await task File "/config/custom_components/xiaomi_miio_airconditioningcompanionmcn02/climate.py", line 323, in async_update if state.target_temperature <= self.max_temp else None, File "/usr/local/lib/python3.9/site-packages/miio/airconditioningcompanionMCN.py", line 79, in target_temperature return self.data[2] IndexError: list index out of range

johnjoemorgan commented 3 years ago

The logs also shoiw this error:

This error originated from a custom integration.

Logger: custom_components.xiaomi_miot.climate Source: custom_components/xiaomi_miot/init.py:1330 Integration: Xiaomi Miot Auto (documentation, issues) First occurred: 20:48:10 (7 occurrences) Last logged: 20:52:49

Aircon Master Air Conditioner: Set miot property {'did': 'prop.3.4', 'siid': 3, 'piid': 4, 'value': 26.0} failed, result: {'did': 'prop.3.4', 'siid': 3, 'piid': 4, 'code': -4005} Aircon Master Air Conditioner: Set miot property {'did': 'prop.3.4', 'siid': 3, 'piid': 4, 'value': 27.0} failed, result: {'did': 'prop.3.4', 'siid': 3, 'piid': 4, 'code': -4005}

and:

This error originated from a custom integration.

Logger: homeassistant Source: custom_components/xiaomi_miio_airconditioningcompanionmcn02/climate.py:247 Integration: xiaomi_miio_airconditioningcompanionmcn02 (documentation, issues) First occurred: 20:47:07 (2 occurrences) Last logged: 20:48:27

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/xiaomi_miio_airconditioningcompanionmcn02/climate.py", line 266, in _async_sensor_changed await self._async_update_temp(new_state) File "/config/custom_components/xiaomi_miio_airconditioningcompanionmcn02/climate.py", line 247, in _async_update_temp self._current_temperature = self.hass.config.units.temperature( AttributeError: 'NoneType' object has no attribute 'config'

johnjoemorgan commented 3 years ago

OK - I restated and the temperature settings are now all working on the 2 MCN04 devices and the 1 MCN02.

To keep things simple I will update in the next couple of days to see if the operation for MCN04 is consistent

al-one commented 3 years ago

Please upgrade to the master branch and try again after clearing the entity's custom attributes.

johnjoemorgan commented 3 years ago

Thank you.I have manually updated the custom components folder and will monitor and report back

al-one commented 3 years ago

Is the device working fine now ?

johnjoemorgan commented 3 years ago

Yes Perfect. Just checked the logs again and no error messages. If any appear I'll raise a new issue. Happy to close this issue now.

Thank you for your time and help.