banto6 / haier

海尔智能家居设备接入HomeAssistant
Apache License 2.0
626 stars 124 forks source link

修复因为windDirectionVertical不存在导致的climate实体不可用的问题 #163

Closed pangjian closed 4 months ago

pangjian commented 4 months ago

haier的中央空调climate实体不可用,查看报错日志为

Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/haier/entity.py", line 74, in data_callback
self._update_value()
File "/config/custom_components/haier/climate.py", line 91, in updatevalue
wind_direction_vertical = int(self._get_wind_direction_vertical())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/haier/climate.py", line 189, in getwind_direction_vertical
return self._attributes_data['windDirectionVertical']
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'windDirectionVertical'

应该就是因为windDirectionVertical不存在导致的,修改了代码兼容了这种不存在的场景。

gzw993946527 commented 3 months ago

我还是提示不可用 好烦