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.69k stars 662 forks source link

小米空调伴侣2问题 #331

Closed sctale closed 2 years ago

sctale commented 2 years ago

从0.4.10左右版本开始,空调伴侣一直有点小问题,具体表现为关机状态下和米家APP中显示的温度不一样,点击HA中的开机会有延迟。 今天试着开加热模式,结果直接报错,但是再点一下又能用了。型号是lumi.acpartner.mcn02,版本是0.5.0b1, HASSOS12.3

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/xiaomi_miot/climate.py:358 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 20:18:36 (2 occurrences) Last logged: 20:20:47

[139828213622528] invalid literal for int() with base 10: 'unsupport' [139828458386000] invalid literal for int() with base 10: 'unsupport' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 470, in async_set_hvac_mode await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/xiaomi_miot/climate.py", line 386, in set_hvac_mode self.turn_on(without_modes=True) File "/config/custom_components/xiaomi_miot/climate.py", line 288, in turn_on ret = self.set_property(self._prop_power, True) File "/config/custom_components/xiaomi_miot/init.py", line 1464, in set_property result = self.set_miot_property(siid, piid, value) File "/config/custom_components/xiaomi_miot/init.py", line 1523, in set_miot_property self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, in _stringify_state if (state := self.state) is None: File "/config/custom_components/xiaomi_miot/climate.py", line 342, in state sta = self.hvac_mode File "/config/custom_components/xiaomi_miot/climate.py", line 358, in hvac_mode acm = -1 if acm is None else int(acm or 0) ValueError: invalid literal for int() with base 10: 'unsupport'

al-one commented 2 years ago

请提供下实体属性

sctale commented 2 years ago

hvac_modes: auto, cool, heat, dry, fan_only, off min_temp: 16 max_temp: 30 target_temp_step: 1 fan_modes: Auto, Low, Medium, High swing_modes: Off, Vertical current_temperature: null temperature: 30 fan_mode: null swing_mode: Off model: lumi.acpartner.mcn02 lan_ip: 192.168.20.201 mac_address: 58:B6:23:F0:B4:03 entity_class: MiotClimateEntity home_room: 浩浩的家 主卧 miot_type: urn:miot-spec-v2:device:air-conditioner:0000A004:lumi-mcn02:1 air_conditioner.on: false target_temperature-2-3: 30 state_updater: lan electric_power: 1.56 power_cost_today: 649 power_cost_month: 9520 air_conditioner.mode: unsupport fan_control.fan_level: unsupport fan_control.vertical_swing: false sub_entities: electric_power, power_cost_today, power_cost_month icon: hass:air-conditioner friendly_name: 主卧空调 supported_features: 41 tmall_genie: true tamll_genie_zone: 主卧 tmall_genie_name: 空调 tamll_genie_type: aircondition

al-one commented 2 years ago

该设备昨天由 @baiuu 适配支持了本地模式,报错是由于有两个属性由设备返回了unsupport导致的。

baiuu commented 2 years ago

该设备昨天由 @baiuu 适配支持了本地模式,报错是由于有两个属性由设备返回了unsupport导致的。

收到我看看

al-one commented 2 years ago

@sctale 请升级到master分支后尝试。

sctale commented 2 years ago

升级到master版本了,报错如下: 此错误来自自定义集成。

Logger: custom_components.xiaomi_miot.climate Source: custom_components/xiaomi_miot/init.py:1128 Integration: Xiaomi Miot Auto (documentation, issues) First occurred: 09:05:23 (1 occurrences) Last logged: 09:05:23

主卧空调 Air Conditioner: Got MiioException while fetching the state: Unable to discover the device 192.168.20.201, mapping: {'air_conditioner.on': {'siid': 2, 'piid': 1}, 'air_conditioner.mode': {'siid': 2, 'piid': 2}, 'target_temperature-2-3': {'siid': 2, 'piid': 3}, 'fan_control.fan_level': {'siid': 3, 'piid': 1}, 'fan_control.vertical_swing': {'siid': 3, 'piid': 2}}, max_properties: 10/5

此错误来自自定义集成。

Logger: custom_components.xiaomi_miot.climate Source: custom_components/xiaomi_miot/init.py:1510 Integration: Xiaomi Miot Auto (documentation, issues) First occurred: 09:05:18 (3 occurrences) Last logged: 09:05:19

主卧空调 Air Conditioner: Set miot property {'did': '433978542', 'siid': 2, 'piid': 3, 'value': 29} failed: Unable to discover the device 192.168.20.201 主卧空调 Air Conditioner: Set miot property {'did': '433978542', 'siid': 2, 'piid': 3, 'value': 28} failed: Unable to discover the device 192.168.20.201 主卧空调 Air Conditioner: Set miot property {'did': '433978542', 'siid': 2, 'piid': 1, 'value': True} failed: Unable to discover the device 192.168.20.201

实体属性: hvac_modes: auto, cool, heat, dry, fan_only, off min_temp: 16 max_temp: 30 target_temp_step: 1 fan_modes: Auto, Low, Medium, High swing_modes: Off, Vertical current_temperature: null temperature: 30 fan_mode: Auto swing_mode: Off model: lumi.acpartner.mcn02 lan_ip: 192.168.20.201 mac_address: 58:B6:23:F0:B4:03 entity_class: MiotClimateEntity home_room: 浩浩的家 主卧 miot_type: urn:miot-spec-v2:device:air-conditioner:0000A004:lumi-mcn02:1 air_conditioner.on: false target_temperature-2-3: 30 state_updater: lan electric_power: 40.08 power_cost_today: 274 power_cost_month: 9858 air_conditioner.mode: 0 fan_control.fan_level: 0 fan_control.vertical_swing: false sub_entities: electric_power, power_cost_today, power_cost_month icon: hass:air-conditioner friendly_name: 主卧空调 supported_features: 41 tmall_genie: true tamll_genie_zone: 主卧 tmall_genie_name: 空调 tamll_genie_type: aircondition

al-one commented 2 years ago

Unable to discover the device 192.168.20.201

新的报错看起来是连不上设备,请检查设备IP是否和日志中一样,并检查的网络环境。

sctale commented 2 years ago

重启了一下好像可以了,谢谢大神