stackia / ha-deye-dehumidifier

Control Deye (德业) Dehumidifier devices from Home Assistant
MIT License
39 stars 4 forks source link

集成登陆成功,但不能发现除湿机设备 #3

Closed zslibra closed 1 year ago

zslibra commented 1 year ago

您好,非常感谢开发出此插件,能大大简化德业除湿机接入HA的步骤。 在测试中发现集成登陆成功,但不能发现除湿机设备。 请问我的HA环境如何哪里出了问题? 谢谢

HAOS版本:2023.3.6 集成版本:1.10

日志提示如下错误: 2023-04-05 09:16:08.635 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up deye_dehumidifier platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/deye_dehumidifier/sensor.py", line 31, in async_setup_entry DeyeHumiditySensor(device, data[DATA_MQTT_CLIENT]), File "/config/custom_components/deye_dehumidifier/sensor.py", line 49, in init super().init(device, mqtt_client) File "/config/custom_components/deye_dehumidifier/init.py", line 116, in init self.device_state = DeyeDeviceState(self._device["payload"]) File "/usr/local/lib/python3.10/site-packages/libdeye/device_state_command.py", line 67, in init state_hex = bytes.fromhex(state) TypeError: fromhex() argument must be str, not dict 2023-04-05 09:16:08.636 ERROR (MainThread) [homeassistant.components.switch] Error while setting up deye_dehumidifier platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/deye_dehumidifier/switch.py", line 28, in async_setup_entry async_add_entities([DeyeChildLockSwitch(device, data[DATA_MQTT_CLIENT])]) File "/config/custom_components/deye_dehumidifier/switch.py", line 48, in init super().init(device, mqtt_client) File "/config/custom_components/deye_dehumidifier/init.py", line 116, in init self.device_state = DeyeDeviceState(self._device["payload"]) File "/usr/local/lib/python3.10/site-packages/libdeye/device_state_command.py", line 67, in init state_hex = bytes.fromhex(state) TypeError: fromhex() argument must be str, not dict 2023-04-05 09:16:08.638 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up deye_dehumidifier platform for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/deye_dehumidifier/binary_sensor.py", line 30, in async_setup_entry DeyeWaterTankBinarySensor(device, data[DATA_MQTT_CLIENT]), File "/config/custom_components/deye_dehumidifier/binary_sensor.py", line 44, in init super().init(device, mqtt_client) File "/config/custom_components/deye_dehumidifier/init.py", line 116, in init self.device_state = DeyeDeviceState(self._device["payload"]) File "/usr/local/lib/python3.10/site-packages/libdeye/device_state_command.py", line 67, in init state_hex = bytes.fromhex(state) TypeError: fromhex() argument must be str, not dict 2023-04-05 09:16:08.639 ERROR (MainThread) [homeassistant.components.climate] Error while setting up deye_dehumidifier platform for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/deye_dehumidifier/climate.py", line 45, in async_setup_entry [DeyeAdvancedDehumidifier(device, data[DATA_MQTT_CLIENT])] File "/config/custom_components/deye_dehumidifier/climate.py", line 59, in init super().init(device, mqtt_client) File "/config/custom_components/deye_dehumidifier/init.py", line 116, in init self.device_state = DeyeDeviceState(self._device["payload"]) File "/usr/local/lib/python3.10/site-packages/libdeye/device_state_command.py", line 67, in init state_hex = bytes.fromhex(state) TypeError: fromhex() argument must be str, not dict

stackia commented 1 year ago

有条件的话,可以抓包一下德业 app 看一下 https://api.deye.com.cn/v3/enduser/deviceList/?app=new 这个请求的响应结果吗?

或者方便的话,也可以私发一下你的德业 app 账号和密码到我邮箱 jsq2627@gmail.com ,这样方便 debug(因为我自己手里只有 E12A3 这一款设备,所以很多其他型号测试不是很充分)

zslibra commented 1 year ago

有条件的话,可以抓包一下德业 app 看一下 https://api.deye.com.cn/v3/enduser/deviceList/?app=new 这个请求的响应结果吗?

或者方便的话,也可以私发一下你的德业 app 账号和密码到我邮箱 jsq2627@gmail.com ,这样方便 debug(因为我自己手里只有 E12A3 这一款设备,所以很多其他型号测试不是很充分)

抓包德业 app得到请求头 https://api.deye.com.cn:443/v3/enduser/deviceList/?0.08393073366501536&app=new 响应结果:(星号脱敏) { "meta":{ "code":0, "message":"device list by user." }, "data":[ { "online":true, "device_id":"f000a458d34511ed8aa902**", "role":1, "alias":"除湿机", "is_combo":true, "payload":"14118108303700000000000000003641552800000000", "protocol_version":"wifi_V2.4", "deviceid":"f000a458d34511ed8aa902**", "product_id":"2c4bd0861c3011e89d4c00**", "mac":"84**", "product_icon":"https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png", "product_name":"DYD-T22A3", "gatewaytype":0, "producttype_id":1, "product_type":"dehumidifier", "device_name":"除湿机" } ] }

stackia commented 1 year ago

麻烦尝试在 HACS 安装一下 v1.1.1-alpha.1 版本,然后重新运行,应该会有一些新的日志信息,贴出来看看

image
zslibra commented 1 year ago

您好,alpha.1版本可以发现除湿机,也能正常操作了,只是日志有warning信息。 非常感谢! (星号脱敏) 2023-04-05 17:09:49.627 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.629 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.630 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.631 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.632 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.633 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.633 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.634 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.634 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.636 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.636 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.637 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.637 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.637 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000 2023-04-05 17:09:49.638 WARNING (MainThread) [custom_components.deye_dehumidifier] Device: {'online': True, 'device_id': 'f000a458d34511ed8aa902**', 'role': 1, 'alias': '除湿机', 'is_combo': True, 'payload': '141181083037000000000000000036415A2800000000', 'protocol_version': 'wifi_V2.4', 'deviceid': 'f000a458d34511ed8aa902**', 'product_id': '2c4bd0861c3011e89d4c00**', 'mac': '84**', 'product_icon': 'https://deye-cloud.oss-cn-shanghai.aliyuncs.com/profile/1597889877269.png', 'product_name': 'DYD-T22A3', 'gatewaytype': 0, 'producttype_id': 1, 'product_type': 'dehumidifier', 'device_name': '除湿机'} 2023-04-05 17:09:49.638 WARNING (MainThread) [custom_components.deye_dehumidifier] Device payload: 141181083037000000000000000036415A2800000000

stackia commented 1 year ago

其实 v1.1.1-alpha.1 对比 v1.1.0 除了多输出了一些 waring 信息方便 debug 之外,没有任何区别 那么理论上你再换回 v1.1.0,应该也正常了吧

stackia commented 1 year ago

我大概弄明白这个 bug 的原因了,过两天更新一个版本,应该会更稳定

zslibra commented 1 year ago

是的,换回v1.1.0 又正常了。 谢谢!