Asynchronous Python client for controlling Melcloud devices.
Project description
pymelcloud
This is a package for interacting with MELCloud and Mitsubishi Electric devices. It's still a little rough around the edges and the documentation is non-existent.
The goals for this package are:
- To control and automate devices, not to configure them.
- Handle device capabilities behind the scenes.
- Make the different device types behave in predictable way.
Notes on usage
There are built-in rate limits and debouncing for most of the methods
with the exception of the Device update method.
- Initialize devices for each account only once during application runtime.
- Make sure the
updatecalls for eachDeviceare rate limited. A 60 second update interval is a good starting point. Going much faster will exceed the expected load for MELCloud and can potentially cause availability issues. - Make absolutely sure the
updatecalls are rate limited.
Supported devices
- Air-to-air heat pumps (DeviceType=0)
- Air-to-water heat pumps (DeviceType=1)
- Energy Recovery Ventilators (DeviceType=3)
Read
Reads access only locally cached state. Call device.update() to
fetch the latest state.
Available properties:
namemacserialunits- model info of related units.temp_unitlast_seenpowerdaily_energy_consumedwifi_signal
Other properties are available through _ prefixed state objects if
one has the time to go through the source.
Air-to-air heat pump properties
room_temperatureoutdoor_temperaturetarget_temperaturetarget_temperature_steptarget_temperature_mintarget_temperature_maxoperation_mode- available
operation_modes fan_speed- available
fan_speeds vane_horizontal- available
vane_horizontal_positions vane_vertical- available
vane_vertical_positions total_energy_consumedin kWh. See notes below.
Air-to-water heat pump properties
tank_temperaturetarget_tank_temperaturetank_temperature_mintank_temperature_maxoutside_temperaturezonesnamestatusroom_temperaturetarget_temperature
statusoperation_mode- available
operation_modes
Energy recovery ventilator properties
room_temperatureoutdoor_temperature- available
fan_speeds fan_speedactual_supply_fan_speedactual_exhaust_fan_speed- available
ventilation_modes ventilation_modeactual_ventilation_modetotal_energy_consumedwifi_signalpresetserror_codecore_maintenance_requiredfilter_maintenance_requirednight_purge_moderoom_co2_level
Energy consumption
The energy consumption reading is a little strange. The API returns a value of 1.8e6 for my unit. Judging by the scale the unit is either kJ or Wh. However, neither of them quite fits.
- Total reading in kJ matches better what I would expect based on the energy reports in MELCloud.
- In Wh the reading is 3-5 times greater than what I would expect, but the reading is increasing at a rate that seems to match energy reports in MELCloud.
Here are couple of readings with monthly reported usage as reference:
- 2020-01-04T23:42:00+02:00 - 1820400, 28.5 kWh
- 2020-01-05T09:44:00+02:00 - 1821300, 29.4 kWh
- 2020-01-05T10:49:00+02:00 - 1821500, 29.6 kWh
I'd say it's pretty clear that it is Wh and the total reading is not
reflective of unit lifetime energy consumption. total_energy_consumed
converts Wh to kWh.
Write
Writes are applied after a debounce and update the local state once completed. The physical device does not register the changes immediately due to the 60 second polling interval.
Writable properties are:
power
Air-to-air heat pump write
target_temperatureoperation_modefan_speedvane_horizontalvane_vertical
There's weird behavior associated with the horizontal vane swing. Toggling it on will also toggle vertical swing on and the horizontal swing has to be disabled before vertical vanes can be adjusted to any other position. This behavior can be replicated using the MELCloud user inteface.
Air-to-water heat pump write
target_tank_temperatureoperation_modezone_1_target_temperaturezone_2_target_tempeature
Zone target temperatures can also be set via the Zone object
returned by zones property on AtwDevice.
Energy recovery ventilator write
ventilation_modefan_speed
Example usage
import aiohttp
import asyncio
import pymelcloud
async def main():
async with aiohttp.ClientSession() as session:
# call the login method with the session
token = await pymelcloud.login("my@example.com", "mysecretpassword", session=session)
# lookup the device
devices = await pymelcloud.get_devices(token, session=session)
device = devices[pymelcloud.DEVICE_TYPE_ATW][0]
# perform logic on the device
await device.update()
print(device.name)
await session.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_melcloud-0.1.2.tar.gz.
File metadata
- Download URL: python_melcloud-0.1.2.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f1f5dc9c4aeb1b9411d6d7cedd87298ccd48d7d5e62889a974cc93111a6e6dd
|
|
| MD5 |
a67cc8eb5a021836e5a48629161bdfd8
|
|
| BLAKE2b-256 |
921db03e135f9039c1cc921050c9b1ff87a20ebb369e7e8c71edb10f80178125
|
Provenance
The following attestation bundles were made for python_melcloud-0.1.2.tar.gz:
Publisher:
release.yaml on erwindouna/python-melcloud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_melcloud-0.1.2.tar.gz -
Subject digest:
7f1f5dc9c4aeb1b9411d6d7cedd87298ccd48d7d5e62889a974cc93111a6e6dd - Sigstore transparency entry: 584329517
- Sigstore integration time:
-
Permalink:
erwindouna/python-melcloud@8584582532e5cf38b341c8a18492f5cfd2441254 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/erwindouna
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8584582532e5cf38b341c8a18492f5cfd2441254 -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_melcloud-0.1.2-py3-none-any.whl.
File metadata
- Download URL: python_melcloud-0.1.2-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81cb720c63ecab2ea87213e08e81df1c731282e591a38e388db62e83366b551d
|
|
| MD5 |
6deb70b612c27424d0de7227a337366e
|
|
| BLAKE2b-256 |
4c3d5f75ba5682009278d00c3efc40bcf5fe11dbefe19b60a1b4cc65f0a27707
|
Provenance
The following attestation bundles were made for python_melcloud-0.1.2-py3-none-any.whl:
Publisher:
release.yaml on erwindouna/python-melcloud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_melcloud-0.1.2-py3-none-any.whl -
Subject digest:
81cb720c63ecab2ea87213e08e81df1c731282e591a38e388db62e83366b551d - Sigstore transparency entry: 584329519
- Sigstore integration time:
-
Permalink:
erwindouna/python-melcloud@8584582532e5cf38b341c8a18492f5cfd2441254 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/erwindouna
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8584582532e5cf38b341c8a18492f5cfd2441254 -
Trigger Event:
release
-
Statement type: