本帖最后由 glxmostwanted 于 2021-6-5 13:08 编辑
首先介绍一下背景
----------------------------------------------(都是废话可以跳过)--------------------------------------------------------
本人在咸鱼买了一个日立的智控器的早期中弘版本,花了600大洋(貌似现在卖家还有货),然后弄回来本来以为直接用HA自带的zhonghong库就管用,结果状态反馈经常就没了。现在分析可能是HA的climate组件有问题。。。然后我又逛论坛看到 RobinVP大神发布了NodeRed版本的接入方式,用的是web界面实现的,不得不说很牛逼!! 然鹅我的这个不能用,那个页面的格式完全不同以至于改起来工作量巨大而且搞不清楚怎么发出控制指令。
但是受到了RobinVP大神的启发,我就试了试直接用TCP的方式可否好用,结果还真可以,于是我就用NodeRed搭了一个TCP版本的,理论上中弘系列的应该都是支持这个通讯协议的。经过紧张的两天调试以及1整天的实际测试,我家的一拖五空调完全没问题!当然这里面还是要再次感谢RobinVP大神之前提供的程序,我这里面MQTT模块的程序内容是直接复制RobinVP大神的,我只是把跟中弘通讯的部分重写了一下,因此省去了很大的工作量,非常感谢!!
----------------------------------------------(以下才是有用的信息)--------------------------------------------------------
首先下载附件中的程序,然后用文本打开这个json后全部复制,之后到Nodered里面粘贴就OK了。
然后只需要两步操作:
1、双击红圈里的这个,把ip地址 端口号修改成你的实际ip就ok了。(根据通讯协议,端口号应该就是9999,不需要修改)
2、修改所有MQTT节点为你目前实际的MQTT服务器,还有设定正确的MQTT的用户名密码即可
第二步
记得往下翻 后面还有MQTT读取,就是这种藕粉色的都需要看一下
3、部署之后就应该出现了,如果已经打开MQTT discover。
mqtt:
discovery: true
当然也有一个可能就是跟我一样,自动创建的这几个状态反馈依然会丢失,那么就手动在configuration.yaml里面添加这几个空调的climate配置即可,也是非常简单的:
自动创建的这个时间长了状态会全部丢失
这是手动创建的climate设备
4、这时候可以看一下自动创建的这个HVAC名字:例如我这里的是Zhonghong HVAC 0_0~0_4,然后在configuration.yaml里面创建的这些也都要按照这个数字改写即可。
例如我的配置文件如下所示:
# AC Controller
climate:
- platform: mqtt
name: WorkshopHVAC
modes:
- "off"
- "heat"
- "dry"
- "cool"
- "fan_only"
fan_modes:
- "high"
- "medium"
- "low"
- "auto"
- "silent"
power_command_topic: "homeassistant/climate/zhonghong/ac_0_4/power/set"
mode_command_topic: "homeassistant/climate/zhonghong/ac_0_4/mode/set"
current_temperature_topic: "homeassistant/climate/zhonghong/ac_0_4/cur_temp/state"
mode_state_topic: "homeassistant/climate/zhonghong/ac_0_4/mode/state"
temperature_command_topic: "homeassistant/climate/zhonghong/ac_0_4/temp/set"
temperature_state_topic: "homeassistant/climate/zhonghong/ac_0_4/temp/state"
fan_mode_command_topic: "homeassistant/climate/zhonghong/ac_0_4/fan/set"
fan_mode_state_topic: "homeassistant/climate/zhonghong/ac_0_4/fan/state"
precision: 1.0
- platform: mqtt
name: DiningroomHVAC
modes:
- "off"
- "heat"
- "dry"
- "cool"
- "fan_only"
fan_modes:
- "high"
- "medium"
- "low"
- "auto"
- "silent"
power_command_topic: "homeassistant/climate/zhonghong/ac_0_0/power/set"
mode_command_topic: "homeassistant/climate/zhonghong/ac_0_0/mode/set"
current_temperature_topic: "homeassistant/climate/zhonghong/ac_0_0/cur_temp/state"
mode_state_topic: "homeassistant/climate/zhonghong/ac_0_0/mode/state"
temperature_command_topic: "homeassistant/climate/zhonghong/ac_0_0/temp/set"
temperature_state_topic: "homeassistant/climate/zhonghong/ac_0_0/temp/state"
fan_mode_command_topic: "homeassistant/climate/zhonghong/ac_0_0/fan/set"
fan_mode_state_topic: "homeassistant/climate/zhonghong/ac_0_0/fan/state"
precision: 1.0
- platform: mqtt
name: GuestroomHVAC
modes:
- "off"
- "heat"
- "dry"
- "cool"
- "fan_only"
fan_modes:
- "high"
- "medium"
- "low"
- "auto"
- "silent"
power_command_topic: "homeassistant/climate/zhonghong/ac_0_1/power/set"
mode_command_topic: "homeassistant/climate/zhonghong/ac_0_1/mode/set"
current_temperature_topic: "homeassistant/climate/zhonghong/ac_0_1/cur_temp/state"
mode_state_topic: "homeassistant/climate/zhonghong/ac_0_1/mode/state"
temperature_command_topic: "homeassistant/climate/zhonghong/ac_0_1/temp/set"
temperature_state_topic: "homeassistant/climate/zhonghong/ac_0_1/temp/state"
fan_mode_command_topic: "homeassistant/climate/zhonghong/ac_0_1/fan/set"
fan_mode_state_topic: "homeassistant/climate/zhonghong/ac_0_1/fan/state"
precision: 1.0
- platform: mqtt
name: LivingroomHVAC
modes:
- "off"
- "heat"
- "dry"
- "cool"
- "fan_only"
fan_modes:
- "high"
- "medium"
- "low"
- "auto"
- "silent"
power_command_topic: "homeassistant/climate/zhonghong/ac_0_2/power/set"
mode_command_topic: "homeassistant/climate/zhonghong/ac_0_2/mode/set"
current_temperature_topic: "homeassistant/climate/zhonghong/ac_0_2/cur_temp/state"
mode_state_topic: "homeassistant/climate/zhonghong/ac_0_2/mode/state"
temperature_command_topic: "homeassistant/climate/zhonghong/ac_0_2/temp/set"
temperature_state_topic: "homeassistant/climate/zhonghong/ac_0_2/temp/state"
fan_mode_command_topic: "homeassistant/climate/zhonghong/ac_0_2/fan/set"
fan_mode_state_topic: "homeassistant/climate/zhonghong/ac_0_2/fan/state"
precision: 1.0
- platform: mqtt
name: MasterroomHVAC
modes:
- "off"
- "heat"
- "dry"
- "cool"
- "fan_only"
fan_modes:
- "high"
- "medium"
- "low"
- "auto"
- "silent"
power_command_topic: "homeassistant/climate/zhonghong/ac_0_3/power/set"
mode_command_topic: "homeassistant/climate/zhonghong/ac_0_3/mode/set"
current_temperature_topic: "homeassistant/climate/zhonghong/ac_0_3/cur_temp/state"
mode_state_topic: "homeassistant/climate/zhonghong/ac_0_3/mode/state"
temperature_command_topic: "homeassistant/climate/zhonghong/ac_0_3/temp/set"
temperature_state_topic: "homeassistant/climate/zhonghong/ac_0_3/temp/state"
fan_mode_command_topic: "homeassistant/climate/zhonghong/ac_0_3/fan/set"
fan_mode_state_topic: "homeassistant/climate/zhonghong/ac_0_3/fan/state"
precision: 1.0
修改其中/zhonghong/ac_0_0 为实际获得的名称即可,然后再重启HA就可以有两套一模一样的空调(name不同),我这边已经经过1整天的测试没有任何问题,若各位有发现其他问题可以及时反馈。
------------------------------------------------------题外话---------------------------------------------------------
个人分析感觉是HA的climate组件有点儿什么问题,由于本人编程能力实在有限,也不知道怎么调试HA的PY组件,所以研究了半天也不知道怎么弄。
所以就这样曲线救国搞了个这个,希望可以造福坛友增砖添瓦吧!
希望用过的坛友都能回复一下,不管好使还是不好使,谢谢啦!
|