Skip to main content

Discover, connect and control Gree based minisplit systems

Project description

Python package

Gree Climate

Discover, connect and control Gree based mini-split systems.

greeclimate is a fully async Python3 based package for controlling Gree based ACs and heat pumps. Gree is a common brand for mini-split systems and is licensed and resold under many product names. This module should work for any device that also works with the Gree+ app, but has been tested on

  • Proklima mini-splits units
  • Trane mini-split heat pump (4TXK38)

If you have tested and know of others systems that work, please fork and submit a PR with the make and model

Based on the following work

Getting the package

The easiest way to grab greeclimate is through PyPI pip3 install greeclimate

Use Gree Climate

Finding and binding to devices

Scan the network for devices, select a device and immediately bind. See the notes below for caveats.

discovery = Discovery()
for device_info in await discovery.scan(wait_for=5):
    try:
        device = Device(device_info)
        await device.bind() # Device will auto bind on update if you omit this step
    except CannotConnect:
        _LOGGER.error("Unable to bind to gree device: %s", device_info)
        continue

    _LOGGER.debug(
        "Adding Gree device at %s:%i (%s)",
        device.device_info.ip,
        device.device_info.port,
        device.device_info.name,
    )

Caveats

Devices have and use 2 encryption keys. 1 for discovery and setup which is the same on all gree devices, and a second which is negotiated during the binding process.

Binding is incredibly finnicky, if you do not have the device key you must first scan and re-bind. The device will only respond to binding requests immediately proceeding a scan.

Update device state

It's possible for devices to be updated from external sources, to update the Device internal state with the physical device call Device.update_state()

Properties

There are several properties representing the state of the HVAC. Setting these properties will command the HVAC to change state.

Not all properties are supported on each device, in the event a property isn't supported commands to the HVAC will simply be ignored.

When setting a value it is cached but not pushed to the device until Device.push_state_update() is called.

device = Device(...)
device.power = True
device.mode = Mode.Auto
device.target_temperature = 25
device.temperature_units = TemperatureUnits.C
device.fan_speed = FanSpeed.Auto
device.fresh_air = True
device.xfan = True
device.anion = True
device.sleep = True
device.light = True
device.horizontal_swing = HorizontalSwing.FullSwing
device.vertical_swing = VerticalSwing.FullSwing
device.quiet = True
device.turbo = True
device.steady_heat = True
device.power_save = True
device.target_humidity = 45

# Send the state update to the HVAC
await device.push_state_update()

Disable beep

In-door units have a very annoying beep on each status push. Hopefully, there is a parameter that can help to avoid it.

Unfortunately, it doesn't work on some firmware versions.

device = Device(...)
device.beep = False
await device.push_state_update()

This setting is not stored on the device and must be set in python each time you want to use it.

Based on the following discussion

Debugging

Maybe the reason you're here is that you're working with Home Assistant and your device isn't being detected.

There are a few tools to help investigate the various compatibility problems that Gree based devices present.

Below is a series of tests, please run them and use their output in issue reports. Additionally using Wireshark or tcpdump to capture the network traffic can greatly assist in investigations.

Setup

This presumes you have python installed

pip install -r requirements.txt

Getting some basic information about your network

Linux / OSX

sudo route -n
sudo ifconfig

Windows command line

route print -4
ipconfig

Running the discovery tests

First test is to check the response of devices when trying to discovery them, writes the results to discovery_results.txt. Use Wireshark here if you can.

python gree.py --discovery > discovery_results.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greeclimate-3.1.0.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

greeclimate-3.1.0-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file greeclimate-3.1.0.tar.gz.

File metadata

  • Download URL: greeclimate-3.1.0.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for greeclimate-3.1.0.tar.gz
Algorithm Hash digest
SHA256 da427f31d16116b96ceeeab6ac2dc280b6f5f368ec2369290281a2d0b45272d3
MD5 c3a1d9e7e5184928bbcb84dc17e5dc30
BLAKE2b-256 beb1e4751f4db31fb5280e3743f2d6a9393b81800d70473d64dc7f86345f384e

See more details on using hashes here.

File details

Details for the file greeclimate-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: greeclimate-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for greeclimate-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1e899fd3aefde1cfa33a326a454b212f8ec6776aa034f4e63ce90aff8884d41
MD5 f0ae147b73c33b3ce2a421ed5e9a5d64
BLAKE2b-256 d8dca77799a46fb80eeadafbbf1044cd259e735cef241e6a1f6c8783ed0503a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page