Package: greeclimate
Gree ClimateDiscover, connect and control Gree based mini-split systems.greenclimatis afully asyncPython3 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 onProklima mini-splits unitsTrane 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 modelBased on the following workGree Remote by tomikaa87Getting the packageThe easiest way to grabgreeclimateis through PyPIpip3 install greeclimateUse Gree ClimateFinding and binding to devicesScan the network for devices, select a device and immediately bind. See the notes below for caveats.discovery=Discovery()fordevice_infoinawaitdiscovery.scan(wait_for=5):try:device=Device(device_info)awaitdevice.bind()# Device will auto bind on update if you omit this stepexceptCannotConnect:_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,)CaveatsDevices 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 stateIt's possible for devices to be updated from external sources, to update theDeviceinternal state with the physical device callDevice.update_state()PropertiesThere 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 untilDevice.push_state_update()is called.device=Device(...)device.power=Truedevice.mode=Mode.Autodevice.target_temperature=25device.temperature_units=TemperatureUnits.Cdevice.fan_speed=FanSpeed.Autodevice.fresh_air=Truedevice.xfan=Truedevice.anion=Truedevice.sleep=Truedevice.light=Truedevice.horizontal_swing=HorizontalSwing.FullSwingdevice.vertical_swing=VerticalSwing.FullSwingdevice.quiet=Truedevice.turbo=Truedevice.steady_heat=Truedevice.power_save=Truedevice.target_humidity=45# Send the state update to the HVACawaitdevice.push_state_update()DebuggingMaybe 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 usingWiresharkor tcpdump to capture the network traffic can greatly assist in investigations.SetupThis presumes you have python installedpipinstall-rrequirements.txtGetting some basic information about your networkLinux / OSXsudoroute-n
sudoifconfigWindows command lineroute print -4
ipconfigRunning the discovery testsFirst test is to check the response of devices when trying to discovery them, writes the results todiscovery_results.txt. UseWiresharkhere if you can.pythongree.py--discovery>discovery_results.txt