Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b5d00f7
Initial implementation of Gree climate integration component rewrite
p-monteiro Sep 16, 2025
187ef3c
Add support for external temperature and humidity sensors
p-monteiro Sep 16, 2025
1188118
Make manifest compliant with HA requirements
p-monteiro Sep 16, 2025
c71392f
Cleanup old code in preparation for backporting features
p-monteiro Sep 17, 2025
73ebfe2
Use encryption version as enum and cleanup
p-monteiro Sep 17, 2025
e0d9886
Multiple config_flow enhancements:
p-monteiro Sep 18, 2025
74809e9
Listen to external sensor states if using them
p-monteiro Sep 18, 2025
f088882
Try to fix external entities not being unselectable
p-monteiro Sep 18, 2025
9a78e8f
Reimplement Auto Light and X-Fan
p-monteiro Sep 19, 2025
29cbd31
Remove timeout from the coordinator
p-monteiro Sep 19, 2025
97201de
Feature: Restore entity states configurable by user
p-monteiro Sep 19, 2025
03b9597
Change set_fan debug
p-monteiro Sep 19, 2025
98ce923
Fix auto x-fan logic
p-monteiro Sep 20, 2025
5425b80
Improve Temperature Units select and restore state
p-monteiro Sep 20, 2025
8686f44
Realign with main branch for easier migrations
p-monteiro Sep 22, 2025
4f0876b
Add API support for device discovery
p-monteiro Sep 22, 2025
ce79013
Gree API: Reuse pack decryption code
p-monteiro Sep 22, 2025
3adef52
Fix translations
p-monteiro Sep 22, 2025
f779529
Fix imports
p-monteiro Sep 22, 2025
3a9f0b2
Bring back add device by discovery
p-monteiro Sep 22, 2025
034c93d
Fix Temperature Unit selector
p-monteiro Sep 24, 2025
6ff856d
Fix current temperature units in Climate Entity
p-monteiro Sep 24, 2025
4622516
Request a update when system units are changed
p-monteiro Sep 24, 2025
fd5a17e
Implement RestoreEntity in GreeClimate
p-monteiro Sep 24, 2025
e013a19
Use _attr_ instead of the cached property
p-monteiro Sep 24, 2025
58856aa
Implement availability check based on coordinator data update success…
p-monteiro Sep 25, 2025
6181526
Improve README
p-monteiro Sep 26, 2025
2f53486
Fix LICENSE links
p-monteiro Sep 26, 2025
679283c
Add contributing iinstructions to setup the devcontainer
p-monteiro Sep 26, 2025
1200efc
Fix CONTRIBUTING mistake
p-monteiro Sep 26, 2025
a2ef9d1
Fix sensor translation
p-monteiro Sep 26, 2025
b3e3008
Remove limitation of hvac on to change parameters
p-monteiro Sep 27, 2025
9bb9338
Support hvac_mode in the set_target_temperature action
p-monteiro Sep 27, 2025
2762017
Fix the use of a sub device (for VRF)
p-monteiro Oct 2, 2025
593ea5b
Added support for discovery of VRF devices (@meirlo)
p-monteiro Oct 2, 2025
d6e0a48
Add further debug to pack decoding
p-monteiro Oct 3, 2025
eac1fc8
Do not leak device key to debug output
p-monteiro Oct 3, 2025
c6540e0
Use default cipher for ffetching subdevice list
p-monteiro Oct 7, 2025
6869d0f
Fix payload with incorrect t parameter
p-monteiro Oct 7, 2025
660f18e
Simplify payload creation to avoid duplicate code
p-monteiro Oct 7, 2025
bdeb7d2
Fix entity selectors for external sensors
p-monteiro Oct 7, 2025
c29d5c6
Changed domain and bump version
p-monteiro Oct 7, 2025
964f389
Readd Temperature Step and move connection settings to the advanced s…
p-monteiro Oct 8, 2025
8391d5f
More debug logs for VRF
p-monteiro Oct 8, 2025
abc6f10
Log exceptions during device add
p-monteiro Oct 8, 2025
e934a92
Fix get status when the device returns an empty string
p-monteiro Oct 9, 2025
dfab2d5
Use stable entity ids
p-monteiro Oct 11, 2025
2b94488
Allow to reconfigure main options and add more error checking
p-monteiro Oct 11, 2025
fdc041d
Make device key a password field
p-monteiro Oct 11, 2025
8a4ae3c
Support importing from configuration YAML
p-monteiro Oct 11, 2025
ef00776
Also add main VRF to the discovered devices
p-monteiro Oct 12, 2025
20d3a6f
General cleanup of device code in preparation for VRF adjustments
p-monteiro Oct 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

This integration follows the development guidelines for Home Assistant integrations, while keeping the repository compatible with HACS.

## Development Environment

Home Assistant provides [several guidelines](https://developers.home-assistant.io/docs/development_environment) regarding the setup of the development environment. Because we are not contributing to the official integrations, there is no need to fork the official [Home Assistant Core](https://github.com/home-assistant/core) repository. However, it is useful to use it as it provides a preconfigured VSCode development environment with the necessary tools.

Here's a general guide to get it working with this integration repository:

1. Create a folder for the development (for example `development/`)
2. Clone [home-assistant/core ](https://github.com/home-assistant/core) inside of it (`development/core`)
3. Follow the [guidelines](https://developers.home-assistant.io/docs/development_environment) on getting the devcontainer working
4. Fork [this](https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent) repository and clone your fork inside of the same folder (`development/YourForkName`)
5. Create a branch for your changes in the cloned repo `git checkout -b my-branch-name`
6. Create a mount point for this integration in the devcontainer
1. Open `development/core/devcontainer/devcontainer.json`
2. Add the mounting:
```json
"mounts": [
"source=${localWorkspaceFolder}/../YourForkName/custom_components/gree_custom,target=/workspaces/core/config/custom_components/gree_custom,type=bind"
],
```
7. Open `development/core` with VSCode
8. Use the command **"Dev Containers: Reopen in Container"**
9. Once inside the container make sure the folder `config/custom_components/gree_custom` exists
10. You should be now be able to edit the integration files from inside the devcontainer
11. Make your changes
12. Push to your fork, rebase with the latest upstream version and submit a pull request

## Testing

Use the **Run Home Assistant Core** Task to start Home Assistant.

You should also be able to set and hit breakpoints in your code.

If you change your code, you have to restart Home Assistant (rerun the Task)

## Styling

Please adhere to the recomended coding style: https://developers.home-assistant.io/docs/development_guidelines
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
112 changes: 66 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)
[![HACS](https://img.shields.io/badge/HACS-Default-orange.svg)](https://hacs.xyz)
[![Home Assistant](https://img.shields.io/badge/Compatible-Home_Assistant_2025.9.4-blue.svg)](https://www.home-assistant.io)

# HomeAssistant-GreeClimateComponent
Custom Gree climate component written in Python3 for Home Assistant. Controls ACs supporting the Gree protocol.

For a comprehensive list of tested devices, see [Supported Devices](supported-devices.md).

Tested on Home Assistant 2025.6.3

**If you are experiencing issues please be sure to provide details about your device, Home Assistant version and what exactly went wrong.**
Custom Gree inetgration for Home Assistant written in Python3. Controls ACs supporting the Gree protocol.

This integration connects directly to your HVAC devices via their IP address on the local network, unlike the official mobile app, which establish a direct connection only during initial setup and subsequently operate through Gree’s servers.

The integration attempts to obtain the encryption key by the initial setup protocol, which has been reverse-engineered.

> [!WARNING]
> If your HVAC device was previously set up for remote access using a mobile app, the integration may fail to retrieve the encryption key automatically. Find out more on methods of obtaining your device key bellow.


For a comprehensive list of tested devices, see [Supported Devices](supported-devices.md).

**If you are experiencing issues please read the [Debugging](#debugging) section**


Official mobile applications:
- [Gree+ Android App](https://play.google.com/store/apps/details?id=com.gree.greeplus)
- [Gree+ iOS App](https://apps.apple.com/app/gree/id1167857672)
- [EWPE Smart Android App](https://play.google.com/store/apps/details?id=com.gree.ewpesmart)
- [EWPE Smart iOS App](https://apps.apple.com/app/ewpe-smart/id1189467454)

If your HVAC device was previously set up for remote access using a mobile app, the integration may fail to retrieve the encryption key automatically.
To configure HVAC wifi (without the mobile app): https://github.com/arthurkrupa/gree-hvac-mqtt-bridge#configuring-hvac-wifi

To extract encryption keys from an account on Gree’s cloud server: https://github.com/luc10/gree-api-client

To configure HVAC wifi (without the mobile app): https://github.com/arthurkrupa/gree-hvac-mqtt-bridge#configuring-hvac-wifi
## Installation

### HACS (recommended)

This integration is added to HACS default repository list. Search for 'Gree' in the HACS dashboard to find and install it.

### Manual

## HACS
This component is added to HACS default repository list.
Copy the `custom_components` folder to your own hassio `/config` folder.


## Configuration

### UI Configuration - Config Flow (recommended)

## Config Flow - UI Configuration (recommended)
The integration can be added from the Home Assistant UI.
1. Navigate to **Settings** > **Devices & Services** and click **Add Integration**.
2. Search for **Gree Climate** and fill in the desired `name`, `host`, `port` and `MAC address`.
3. After setup you can open the integration options to configure additional parameters.
4. Saving any changes in the options dialog automatically reloads the
integration, so new settings take effect immediately without
restarting Home Assistant.

## Manual Installation
1. Navigate to **Settings** > **Devices & Services** and click **Add Integration**.
2. Search for **Gree Climate**
3. Choose automatic discovery or manual setup and fill in the desired `name`, `host` and `MAC address`.
4. After a successfull connection with the device, you will be asked to configure the device options.

Your can also **Reconfigure** a device by changing its options. Saving any changes in the options dialog automatically reloads the integration, so new settings take effect immediately without restarting Home Assistant.

1. *(Skip if using HACS)* Copy the `custom_components` folder to your own hassio `/config` folder.
### Manual - YAML Configuration

2. **YAML Configuration:** See [`manual-configuration.yaml`](manual-configuration.yaml) for a complete configuration example with all available options and detailed comments.
See [`manual-configuration.yaml`](manual-configuration.yaml) for a complete configuration example with all available options and detailed comments.

Basic example:
```yaml
Expand All @@ -52,41 +64,49 @@ The integration can be added from the Home Assistant UI.
encryption_version: 2
```

3. In your configuration.yaml add the following:
### Obtaining the Encryption Key

```yaml
climate: !include your_configuration.yaml
```
The integration has the capability of automatically retrieve the encryption version and key of a device using the gree protocol which has been reverse-engineered.

4. *(Optional)* Add info logging to this component (to see if/how it works)
However, if your HVAC device was previously set up for remote access using a mobile app, the integration may fail to retrieve the encryption key automatically.

```yaml
logger:
default: error
logs:
custom_components.gree: debug
custom_components.gree.climate: debug
```
#### Method 1: From Gree's cloud server

5. *(Optional)* Provide encryption key if you have it or feel like extracting it.
To extract encryption keys from an account on Gree’s cloud server, follow the instructions in https://github.com/luc10/gree-api-client

One way is to pull the sqlite db from android device like described here:
#### Method 2: From the Android app

https://stackoverflow.com/questions/9997976/android-pulling-sqlite-database-android-device
One way is to pull the sqlite db from android device like described here:

```bash
adb backup -f ~/backup.ab -noapk com.gree.ewpesmart
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
sqlite3 data.ab 'select privateKey from db_device_20170503;' # but table name can differ a little bit.
```
https://stackoverflow.com/questions/9997976/android-pulling-sqlite-database-android-device

```bash
adb backup -f ~/backup.ab -noapk com.gree.ewpesmart
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
sqlite3 data.ab 'select privateKey from db_device_20170503;' # but table name can differ a little bit.
```

> [!TIP]
> If you are getting an UTF-8 error (like: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 1: invalid continuation byte"), see https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent/issues/318.

Optionally, you can also sniff the `uid` parameter. This is not needed for all devices.

### Icon configuration

You can set custom icons for the climate enity by modifying the icon translation file `icons.json`. Refer to this documentation: https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/icon-translations/

Write it down in `climate.yaml`: `encryption_key: <key>`.
## Debugging

> If you are getting an UTF-8 error (like: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 1: invalid continuation byte"), see https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent/issues/318.
If you are having problems with your device, whenever you write a bug report, be sure to provide details about your device, Home Assistant version and what exactly went wrong.

6. *(Optional)* Provide the `uid` parameter (can be sniffed). This is not needed for all devices.
It also helps tremendously if you include debug logs directly in your issue (otherwise we will just ask for them and it will take longer). So please enable debug logs in the integration UI or like this:

7. *(Optional)* You can set custom icons by modifying the icon translation file `icons.json`. Refer to this documentation: https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/icon-translations/
```yaml
logger:
default: error
logs:
custom_components.gree_custom: debug
```

## Additional Sensors

Expand Down
132 changes: 0 additions & 132 deletions custom_components/gree/__init__.py

This file was deleted.

Loading