Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homeassistant mqtt 报错 - 德业型号 T22A3 #2

Open
zhaosk opened this issue Feb 16, 2021 · 14 comments
Open

Homeassistant mqtt 报错 - 德业型号 T22A3 #2

zhaosk opened this issue Feb 16, 2021 · 14 comments

Comments

@zhaosk
Copy link

zhaosk commented Feb 16, 2021

你好,德业全网唯一插件一哥。按照blog 的操作后遇到如下错误,请问插件可以支持 T22A3型号吗?谢谢!

错误提示:
2021-02-16 20:06:43 ERROR (Thread-5) [custom_components.mqtt] Unable to connect to the MQTT broker: Connection Refused: not authorised.
2021-02-16 20:06:43 WARNING (Thread-5) [custom_components.mqtt] Disconnected from MQTT server ccae4711e7829100163e.mqtt.iot.gz.baidubce.com:1883 (5)

我的操作:

  1. 沿用HA的MQTT源码(复制到custom_components)
  2. 修改MQTT switch.py 配置

软件版本:

System Health

version core-2021.2.3
installation_type Home Assistant Container
dev false
hassio false
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.10.14-v7l+
arch armv7l
timezone Asia/Shanghai
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 1
resources 0
mode auto-gen
@yongman
Copy link
Owner

yongman commented Feb 16, 2021

看报错像是登录mqtt的认证信息不匹配,建议先用mqtt客户端验证一下获取的mqtt登录信息的正确性

@zhaosk
Copy link
Author

zhaosk commented Feb 16, 2021

看报错像是登录mqtt的认证信息不匹配,建议先用mqtt客户端验证一下获取的mqtt登录信息的正确性

回复的好快啊,我用客户端连接配置好了(client id, host, port, username, password)显示connected,这是代表成功了不?不懂 topic 所以不知道怎么继续测试 :(

@zhaosk
Copy link
Author

zhaosk commented Feb 18, 2021

请问有办法不?谢谢帮忙

@yongman
Copy link
Owner

yongman commented Feb 19, 2021

@zhaosk 可以按https://xiking.win/2020/11/12/3-deye-dehumidifer-add-to-homeassistant/ 上面的获取topic信息的说明自己拼一下两个topic的名称,这个信息需要自己通过http接口获取。

@zhaosk
Copy link
Author

zhaosk commented Mar 2, 2021

@zhaosk 可以按https://xiking.win/2020/11/12/3-deye-dehumidifer-add-to-homeassistant/ 上面的获取topic信息的说明自己拼一下两个topic的名称,这个信息需要自己通过http接口获取。

大佬,已经按照上面的配置好了,但是homekit家庭里还是”未响应“,反复尝试都不行。方便私信个微信帮忙看一下不?谢谢啊!

@yongman
Copy link
Owner

yongman commented Mar 31, 2021

@zhaosk 可以按https://xiking.win/2020/11/12/3-deye-dehumidifer-add-to-homeassistant/ 上面的获取topic信息的说明自己拼一下两个topic的名称,这个信息需要自己通过http接口获取。

大佬,已经按照上面的配置好了,但是homekit家庭里还是”未响应“,反复尝试都不行。方便私信个微信帮忙看一下不?谢谢啊!

其实这个就是一个switch了,如果ha中开关正常,那应该是homekit的配置问题了。

@itispip
Copy link

itispip commented Jun 15, 2021

同样的,T22a3, 登录后无法开关,估计是stuck payload的格式不同?

@yongman
Copy link
Owner

yongman commented Jun 15, 2021

同样的,T22a3, 登录后无法开关,估计是stuck payload的格式不同?

可以首先用mqtt命令行客户端pub sub调试一下,先看下是否可以订阅到状态更新,先确认配置正确,如果还不行,就需要看一下app的反编译代码。

@itispip
Copy link

itispip commented Jun 29, 2021

同样的,T22a3, 登录后无法开关,估计是stuck payload的格式不同?

可以首先用mqtt命令行客户端pub sub调试一下,先看下是否可以订阅到状态更新,先确认配置正确,如果还不行,就需要看一下app的反编译代码。

用mqtt客户端是可以登录并获得mqtt msg的。但是用mosquitto bridge模式,就是不行。mosquitto报错Connection Refused: identifier rejected

@itispip
Copy link

itispip commented Jun 30, 2021

最终终于可以登录了。用mosquitto的bridge模式登录,一定要关闭notification message,否则就是出Connetion Refursed

我的发现:
不需要用修改版本的MQTT,可以在configuration.yaml里面通过value_template完成status payload的数据截取和判断,二进制Buffer格式的数据也可以直接用yaml来发送。这样可以使用原版的MQTT Component,以后升级Hass就会少很多麻烦。

我的configuration.yaml
switch:

  • platform: mqtt
    name: deye
    unique_id: deye_switch
    state_topic: xxxx/xxxx/xxx/status/hex
    command_topic: xxx/xxxx/xxx/command/hex
    state_on: 30
    state_off: 20
    value_template: "{{ value_json.data[5:7] }}" #(这是TA22的状态码,TA12要按楼主给的抓第4:6位)
    payload_on: "\x08\x02\x03\x20\x19\x00\x00\x00\x00\x00" #(这是TA22的控制码,TA12要按楼主给的写)
    payload_off: "\x08\x02\x02\x20\x19\x00\x00\x00\x00\x00" #(这是TA22的控制码,TA12要按楼主给的写)

@yongman
Copy link
Owner

yongman commented Jul 1, 2021

@itispip 赞!

@wbsu2003
Copy link

wbsu2003 commented Dec 6, 2021

@yongman @itispip 按你们写的搞定,👍👍👍

记录了一下过程:德业DYD-T22A3除湿机接入HomeAssistant记录

@yongman
Copy link
Owner

yongman commented Dec 6, 2021

@wbsu2003 到位!

@yongman
Copy link
Owner

yongman commented Jun 11, 2022

最终终于可以登录了。用mosquitto的bridge模式登录,一定要关闭notification message,否则就是出Connetion Refursed

@itispip 想问一下,mosquitto bridge模式是如何配置的,我这边配置了notification false后还是报错socker error,是否需要增加特殊的bridge配置项

connection bridge-deye
address xxx.mqtt.iot.gz.baidubce.com:1833
remote_username xx
remote_password xx
remote_clientid xx
cleansession true
start_type automatic
notifications false
topic xx/xx/xx/status/hex both 0
topic xx/xx/xx/command/hex both 0

报错日志

Socket error on client local.app_45abed2ec8de11eaa06c0242ac4800091, disconnecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants