Skip to main content

Small library for interfacing with Mitsubishi KumoCloud enabled devices

Project description

pykumo

Python library to interact with Mitsubishi Kumo Cloud devices via their local API.

The hard work of generating the security token was done by https://github.com/sushilks/kumojs, and that part of pykumo is based heavily on sushilks's code, translated to Python by me. pykumo has no dependency on kumojs.

Kumo System Components

Outdoor Unit

The outdoor unit houses the compressor and the outdoor coil. Each indoor unit connects to its outdoor unit via a pair of refrigerant lines and an electric power supply and communication cable. (Collectively this connection is called a lineset.) Kumo Cloud does not appear to be able to communicate directly with an outdoor unit.

Indoor Unit

Indoor units, also called air handlers, are in the conditioned space, and contain the indoor fan and heat exchanger coil, providing either cooling or heating. An indoor unit can be connected to some or all of the following:

  • WiFi adapter (e.g. PAC-USWHS002-WF-2) (via CN105 connector)
  • Wall-mounted controller MHK2 (via CN105 connector)
  • Wireless remote sensor (via Bluetooth to the WiFi adapter)

An indoor unit with a WiFi adapter has its own IP address on your local network.

Pykumo communicates with an indoor unit via its WiFi adapter, using an API exposed by the adapter.

MHK2

The MHK2 wall-mounted controller, if present, acts like a traditional thermostat for a single indoor unit, while also providing other controls. It also contains its own temperature and humidity sensors.

Kumo Station

Kumo Station allows controlling traditional HVAC equipment via the Kumo Cloud app, managing switchover between Kumo and external equipment. It also provides an outdoor temperature sensor. A Kumo Station has its own IP address.

Troubleshooting

WiFi

The most common cause of flaky behavior is weak WiFi signal at the indoor unit. Try measuring WiFi strength (2.4 GHz only) with a phone app. Also try repositioning the Mitsubishi WiFi adapter within the unit, positioning it close to the plastic exterior rather than metal interior components. Users have also reported that isolating the indoor units to their own subnet and WiFi SSID can improve behavior.

API errors

In early 2023 Mitsubishi appears to have made some change that makes the WiFi adapter less reliable. My educated guess is that it has a memory leak. See Issue 105 in the hass-kumo repository for discussion.

As of mid 2024, pykumo will issue a reboot command to the indoor unit's WiFi adapter (at most once every 30 minutes) if serializer_error or __no_memory errors occur when performing operations.

Interactive Use

It's possible to use pykumo in an interactive shell to do debugging, investigation of possible new features, and so on.

I recommend doing this work in a virtualenv. If you're not familiar with these, search the web for "python virtualenv" for details specific to your preferred operating system.

Start an Interactive Python Shell

pip3 install pykumo
python3

Set Up KumoCloudAccount

Inside the Python shell:

import pykumo
account = pykumo.KumoCloudAccount.Factory()

This will prompt for your KumoCloud username and password.

account.get_indoor_units()

If successful, get_indoor_units prints a list of your indoor units' serial numbers.

Get Indoor Units

kumos = account.make_pykumos()
unit = kumos['<indoor unit name>']
unit.update_status()

The indoor unit name is the human-readable name. If successful, update_status prints True. You can then make various API calls on the unit object.

Get Raw Information from Indoor Unit

You can print the internal state of the indoor unit object, which includes the JSON information fetched from the unit itself. This is a good place to look when requesting support for additional pykumo features.

import pprint
pp = pprint.PrettyPrinter()
pp.pprint(unit.__dict__)

Reboot a unit's WiFi adapter

If an indoor unit is reachable but returns error responses to legitimate commands, a reboot may help.

unit.do_reboot()

Query or Command an Indoor Unit Directly

Indoor units speak a simple protocol of nested JSON. I'm not documenting the protocol here (though documentation patches would be welcome!), but if you look through the pykumo.py code for calls to self._request you can see the queries and commands that are already enabled. For example:

query = '{"c":{"indoorUnit":{"status":{}}}}'.encode('utf-8')
unit._request(query)

This prints the primary record, the status object. Most of the valid queries and commands were discovered by snooping the traffic between the Kumo Cloud app and the indoor unit. A few were determined by experimentation. It's possible that additional values and controls are available beyond those already discovered, especially on indoor units newer than those owned by this author. I welcome details on these via pull requests or issues on this repo.

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

pykumo-0.4.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

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

pykumo-0.4.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file pykumo-0.4.0.tar.gz.

File metadata

  • Download URL: pykumo-0.4.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pykumo-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c2fd60f1e1e97cc6ceb9917e29e68c2a852de9bdff3b7674c0efaa03f16bce61
MD5 205e4e056cd2a622a0493b7c6c91e9a6
BLAKE2b-256 844c82538807ac6fc852d1cfc8d37348cc7597dc99e28af9a95307e37acf15c6

See more details on using hashes here.

File details

Details for the file pykumo-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pykumo-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pykumo-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e06e6cc504845c86df1bf9ca5d5a26d85cce3d15e5447a9f63b72442d36aa8df
MD5 5b6d80dd85ed67ecb583ab2988b30c88
BLAKE2b-256 0bea54da438d351f4892e91e1f5124b1f60c789384c237bf209b49f570ff8378

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