本帖最后由 671792320 于 2019-4-11 17:46 编辑
我只是一个搬运工,https://github.com/arthurkrupa/gree-hvac-mqtt-bridge 这个是项目地址。无奈本人大白一个,研究了好久才折腾成功。这个插件支持 hassio,homeassistant。
要求:
NodeJS (>=8.11.0) with NPM An MQTT broker and Gree smart HVAC device on the same network Docker (for building Hass.io addon)
我的是群晖docker的homeassistant。需要采用nodejs的方式进行安装。
首先群晖下载entware套件,这个里面的nodejs版本比较高可以运行。我的群晖是安装的918+dsm系统,套件中心安装这个文件
ebi_0.5-049_noarch.spk.zip
(116.06 KB, 下载次数: 21)
然后选择安装entware,获得opkg命令。安装nodejs
然后ssh连接到群晖,随便找一个地方新建一个文件夹给到项目使用,我是在docker\gree
进入后输入
npm install
node index.js \
--hvac-host="192.168.1.255" \ ###你的格力空调在路由器下的地址
--mqtt-broker-url="mqtt://localhost" \ #####本地mqtt地址
--mqtt-topic-prefix="home/greehvac" \ #######mqtt主题
--mqtt-username="" \ #########mqtt用户名
--mqtt-password=""#########mqtt密码
复制代码
然后就愉快的跑起来代码了。然后将空调接入到路由器
如果你是大神就用插件项目里说的命令接入内容如下
Make sure your HVAC is running in AP mode. You can reset the WiFi config by pressing MODE +WIFI (or MODE + TURBO) on the AC remote for 5s.
Connect with the AP wifi network (the SSID name should be a 8-character alfanumeric, e.g. "u34k5l166").
Run the following in your UNIX terminal:
echo -n "{"psw": "YOUR_WIFI_PASSWORD","ssid": "YOUR_WIFI_SSID","t": "wlan"}" | nc -cu 192.168.1.1 7000
Note: This command may vary depending on your OS (e.g. Linux, macOS, CygWin). If facing problems, please consult the appropriate netcat manual.
复制代码
如果你跟我一个是小白请使用手机app客户端
格力智联
苹果直接商店搜索即可,安卓请百度。
然后就可以路由器下看到你的空调ip了。
然后ha的配置文件就直接如下
climate:
- platform: mqtt
# Change to whatever you want
name: Gree HVAC
###这里的MQTT_TOPIC_PREFIX就是刚刚node index.js写的home/greehvac替换进入,重启ha即可看到。
# Change MQTT_TOPIC_PREFIX to what you've set in addon options
current_temperature_topic: "MQTT_TOPIC_PREFIX/temperature/get"
temperature_command_topic: "MQTT_TOPIC_PREFIX/temperature/set"
temperature_state_topic: "MQTT_TOPIC_PREFIX/temperature/get"
mode_state_topic: "MQTT_TOPIC_PREFIX/mode/get"
mode_command_topic: "MQTT_TOPIC_PREFIX/mode/set"
fan_mode_state_topic: "MQTT_TOPIC_PREFIX/fanspeed/get"
fan_mode_command_topic: "MQTT_TOPIC_PREFIX/fanspeed/set"
swing_mode_state_topic: "MQTT_TOPIC_PREFIX/swingvert/get"
swing_mode_command_topic: "MQTT_TOPIC_PREFIX/swingvert/set"
power_state_topic: "MQTT_TOPIC_PREFIX/power/get"
power_command_topic: "MQTT_TOPIC_PREFIX/power/set"
# Keep the following as is
payload_off: 0
payload_on: 1
modes:
- "off"
- "auto"
- "cool"
- "heat"
- "dry"
- "fan_only"
swing_modes:
- "default"
- "full"
- "fixedTop"
- "fixedMidTop"
- "fixedMid"
- "fixedMidBottom"
- "fixedBottom"
- "swingBottom"
- "swingMidBottom"
- "swingMid"
- "swingMidTop"
- "swingTop"
fan_modes:
- "auto"
- "low"
- "mediumLow"
- "medium"
- "mediumHigh"
- "high"
复制代码
然后就可以Siri或者ha控制格力WiFi空调了。
当然现在这个插件不会自动启动,所以需要在群晖下添加计划任务,让脚本开机自启动