Skip to main content

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

Discover devices on the LAN and bind immediately after scanning.

import asyncio

from greeclimate.device import Device
from greeclimate.discovery import Discovery


async def main():
    discovery = Discovery()
    try:
        for device_info in await discovery.scan(wait_for=5):
            device = Device(device_info)
            try:
                await device.bind()
                print(device_info.name, device_info.ip)
            finally:
                device.close()
    finally:
        discovery.close()


asyncio.run(main())

The following snippets run inside main(); device-control snippets go after binding and before closing device.

Scan a known IP address instead of broadcasting on the LAN.

from ipaddress import IPv4Address

devices = await discovery.scan(
    wait_for=5, target_addresses=[IPv4Address("192.0.2.10")]
)

Discover a device listening on UDP port 7000, including loopback addresses.

discovery = Discovery(allow_loopback=True)
devices = await discovery.scan(wait_for=5)

Manually poll for updated device state.

await device.update_state()

Cool to 25°C and send updates to the device.

from greeclimate.device import Mode, TemperatureUnits

device.power = True
device.mode = Mode.Cool
device.temperature_units = TemperatureUnits.C
device.target_temperature = 25
await device.push_state_update()

Set a Fahrenheit target by selecting units before setting the temperature.

from greeclimate.device import TemperatureUnits

device.temperature_units = TemperatureUnits.F
device.target_temperature = 77
await device.push_state_update()

Set fan speed and swing positions.

from greeclimate.device import FanSpeed, HorizontalSwing, VerticalSwing

device.fan_speed = FanSpeed.Auto
device.horizontal_swing = HorizontalSwing.FullSwing
device.vertical_swing = VerticalSwing.FullSwing
await device.push_state_update()

Enable optional features where supported by the device.

device.light = True
device.xfan = True
device.quiet = True
await device.push_state_update()

Set a dehumidifier's target relative humidity.

device.target_humidity = 45
await device.push_state_update()

Turn the device off, then request a fresh status update.

device.power = False
await device.push_state_update()
await device.update_state()

Automatic discovery uses IPv4 subnet broadcasts via ifaddr, skipping IPv6, loopback, and non-loopback /31 and /32 networks. allow_loopback=True adds loopback host addresses; non-empty target_addresses bypasses interface enumeration, while None or [] uses it.

Legacy bcast_ifaces (scan) and broadcastAddrs (search_devices) keywords and positional calls remain supported; combining an alias with non-None target_addresses raises ValueError.

Use Gree Emulator

Run these commands from the repository root with Python 3.10+ and dependencies installed; each server runs until Ctrl-C.

List supported simulated profiles and their exact MID values.

python -m gree_emulator --list-profiles

Run one simulated AC on loopback, with stable identity across restarts.

python -m gree_emulator --profile sim-w04n-v17 --mid 10001 --seed demo --listen 127.0.0.1

Run three independently controlled simulated ACs on the same endpoint.

python -m gree_emulator --profile sim-w04n-v17 --mid 10001 --count 3 --seed demo --listen 127.0.0.1

Run the supplied mixed-device configuration, including gateways and child devices.

python -m gree_emulator --config examples/emulator-devices.json

Expose the simulated ACs to LAN discovery on UDP port 7000, on a trusted test network only.

python -m gree_emulator --profile sim-w04n-v17 --mid 10001 --count 3 --seed demo --listen 0.0.0.0 --port 7000

Capture packet logs on stderr while keeping startup announcements on stdout; scrub identities, addresses, and bind exchanges before sharing.

python -m gree_emulator --profile sim-w04n-v17 --mid 10001 --seed demo --listen 127.0.0.1 2> emulator-packets.log

These are simulated appliances, not complete firmware emulations. The library's push_state_update() currently adds an unsupported BuzzerCtrl field, so simulator commands can be rejected even when sending succeeds. See the emulator guide for configuration, protocol differences, and consumer-compatibility limits.

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

Metadata

Release files for greeclimate 3.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greeclimate 3.5.0
File Size Uploaded Provenance
greeclimate-3.5.0.tar.gz 78.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for greeclimate 3.5.0
File Interpreter ABI Platform
greeclimate-3.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 144.8 kB

Release files / greeclimate-3.5.0.tar.gz

Download URL greeclimate-3.5.0.tar.gz
Size 78.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5c363062a90749bf212772ac5fe350988fcbb2351d09202914879af51d506ebc
BLAKE2b-256 checksum
How to use checksums
c4b1ac574f71d1b4c0771bac62dc570a62314bb38d3ea949752c90504cf15d6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / greeclimate-3.5.0-py3-none-any.whl

Download URL greeclimate-3.5.0-py3-none-any.whl
Size 66.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6e8742f09e3047d2fb8fc230959092d6604c9ad8ec5a64d3616b4aee45423fd
BLAKE2b-256 checksum
How to use checksums
22bf26830a2dc7361d2e0d483dc2e4d5f6869320ee81b2c781408140cfce7c09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for greeclimate 3.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for greeclimate-3.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

3.5.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page