gree_havc_mqtt_bridge_go

command module
v0.0.0-...-ff864b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

README

Gree HVAC MQTT bridge GO

Enginsh 简体中文

Bridge service for communicating with Gree air conditioners using MQTT broadcasts. It can also be used as a Hass.io addon.

Requirements

  • GO (>=1.18.0)
  • An MQTT broker and Gree smart HVAC device on the same network

Running locally

Make sure you have GO (>=1.18.0) installed and run the following (adjust the arguments to match your setup):

Install
git clone https://github.com/FeranyDev/gree_havc_mqtt_bridge_go.git
cd gree_havc_mqtt_bridge_go
go install
go build
Run
./gree_havc_mqtt_bridge_go \
  -hvac-host 192.168.1.225 \
  -mqtt-broker-url 192.168.1.1 \
  -mqtt-broker-port 1883 \
  -mqtt-topic-prefix home/greehvac 
  • or
./gree_havc_mqtt_bridge_go \
  -hvac-host 192.168.1.225 \
  -bemfa-client-id bemfa_key \
  -bemfa-topic bemfa_topic 
  • or
./gree_havc_mqtt_bridge_go \
  -hvac-host 192.168.1.225 \
  -mqtt-broker-url 192.168.100.1 \
  -mqtt-broker-port 1883 \
  -mqtt-topic-prefix home/greehvac \
  -bemfa-client-id bemfa_key \
  -bemfa-topic bemfa_topic 
  • or
./gree_havc_mqtt_bridge_go -c ./config.json
Config file
mqtt:
  havc:
    host: 192.168.1.1
    port: 1883
    username: havc
    password: havc
    client_id: havc
    retain: false
    tls: false
  bemfa:
    host: bemfa.com
    port: 9501 # TLS 9503
    username: bemfa
    password: bemfa
    client_id: bemfa
    retain: false
    tls: false
gree:
  - host: 192.168.1.225
    port: 7000
    havc_topic: havc_topic_prefix
    bemfa_topic: bemfa_topic
  - host: 192.168.1.226
    port: 7000
    havc_topic: havc_topic_prefix
    bemfa_topic: bemfa_topic

Supported commands

MQTT topic scheme:

  • MQTT_TOPIC_PREFIX/COMMAND/get Get value
  • MQTT_TOPIC_PREFIX/COMMAND/set Set value

Note: boolean values are set using 0 or 1

Command Values Description
temperature any integer In degrees Celsius by default
mode off, auto, cool, heat, dry, fan_only Operation mode
fanspeed auto, low, mediumLow, medium, mediumHigh, high Fan speed
swinghor default, full, fixedLeft, fixedMidLeft, fixedMid, fixedMidRight, fixedRight Horizontal Swing
swingvert default, full, fixedTop, fixedMidTop, fixedMid, fixedMidBottom, fixedBottom, swingBottom, swingMidBottom, swingMid, swingMidTop, swingTop Vetical swing
power 0, 1 Turn device on/off
health 0, 1 Health ("Cold plasma") mode, only for devices equipped with "anion generator", which absorbs dust and kills bacteria
powersave 0, 1 Power Saving mode
lights 0, 1 Turn on/off device lights
quiet 0, 1, 2, 3 Quiet modes
blow 0, 1 Keeps the fan running for a while after shutting down (also called "X-Fan", only usable in Dry and Cool mode)
air off, inside, outside, mode3 Fresh air valve
sleep 0, 1 Sleep mode
turbo 0, 1 Turbo mode

Hass.io addon

The service can be used as a 3rd party addon for the Hass.io MQTT climate platform, although not all commands are supported.

  1. Install the addon
  2. Customize addon options (HVAC host, MQTT broker URL, MQTT topic prefix)
  3. Add the following to your configuration.yaml
climate:
  - platform: mqtt

    # Change to whatever you want
    name: Gree HVAC

    # 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"
How to power on/off

Hass.io doesn't supply separate on/off switch. Use the dedicated mode for that.

Configuring HVAC WiFi

  1. 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.
  2. Connect with the AP wifi network (the SSID name should be a 8-character alfanumeric, e.g. "u34k5l166").
  3. 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.

Changelog

[1.0.0]

First release

License

This project is licensed under the GNU GPLv3 - see the LICENSE file for details

Acknowledgments

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL