Meross IoT Library
raw JSON → 0.4.10.4 verified Fri May 01 auth: no python
A simple Python library to control Meross smart devices, including smart plugs (MSS110, MSS210, MSS310, MSS310H, MSS425E power strip) and other devices with limited functionality. Current version 0.4.10.4, requires Python >=3.8. Released approximately monthly.
pip install meross-iot Common errors
error ModuleNotFoundError: No module named 'meross_iot' ↓
cause Library not installed or installed under a different name.
fix
Run pip install meross-iot
error AttributeError: module 'meross_iot' has no attribute 'client' ↓
cause Import path changed in 0.4.x; old import pattern used.
fix
Use from meross_iot.cloud.client import MerossCloudClient
Warnings
gotcha asyncio event loop must be explicitly managed; calling async methods without running the loop will raise RuntimeError. ↓
fix Wrap all async calls in asyncio.run() or run inside a running event loop.
breaking Major API restructuring between 0.3.x and 0.4.x; many classes and imports changed. Old code using MerossClient from meross_iot.client will break. ↓
fix Use MerossCloudClient from meross_iot.cloud.client and HttpApiConfig for credentials.
gotcha Device control requires calling async_http_init() before any API call; forgetting leads to 'HTTP not initialized' errors. ↓
fix Always await client.async_http_init() before listing devices or sending commands.
Imports
- MerossDeviceDescriptor wrong
from meross_iot.device import MerossDeviceDescriptorcorrectfrom meross_iot.model.device import MerossDeviceDescriptor - MerossCloudClient wrong
from meross_iot.client import MerossCloudClientcorrectfrom meross_iot.cloud.client import MerossCloudClient
Quickstart
import asyncio
from meross_iot.cloud.client import MerossCloudClient
from meross_iot.model.http import HttpApiConfig
async def main():
email = os.environ.get('MEROSS_EMAIL', '')
password = os.environ.get('MEROSS_PASSWORD', '')
client = MerossCloudClient(http=HttpApiConfig(email=email, password=password))
await client.async_http_init()
devices = await client.async_get_device_list()
for d in devices:
print(d.name, d.uuid)
await client.async_http_deinit()
if __name__ == '__main__':
asyncio.run(main())