Skip to main content

Cliente Python para lava-louças Midea (device_type 0xE1, plugin v5) — codec do frame AA + transporte LAN V3.

Project description

midea-dishwasher-api

CI PyPI

Cliente Python para lava-louças Midea (device_type 0xE1, plugin v5).

Implementa o protocolo de aplicação AA … E1 e a camada de transporte LAN V3 (handshake 8370 + AES-128-CBC + SHA-256, com framing V2 5A5A interno).

Instalação

pip install midea-dishwasher-api

Uso rápido

from midea_dishwasher_api import BrightLevel, Client, Mode, V3Transport

with V3Transport(
    host="192.168.5.100",
    device_id=151732606394621,
    token=bytes.fromhex("..."),  # 64 bytes
    key=bytes.fromhex("..."),    # 32 bytes
) as transport:
    client = Client(send=transport)

    status = client.query_status()
    print(status.machine_state)   # MachineState.POWER_ON / POWER_OFF
    print(status.cycle_state)     # CycleState.IDLE / WORK / ORDER / ...
    print(status.left_time)       # minutos restantes (apenas em WORK)
    print(status.door_closed)
    print(status.bright_lack)     # secante acabou?

    client.power_on()
    client.start_to_work(mode=Mode.ECO, extra_drying=True)
    client.set_bright(BrightLevel.L3)
    client.cancel_work()
    client.power_off()

Os métodos de controle não retornam estado (a máquina demora alguns segundos para refletir a mudança). Chame query_status() quando quiser estado fresco.

API

Client

Método Efeito
query_status() -> DishwasherStatus Lê o estado atual
power_on() Liga a máquina
power_off() Desliga
cancel_work() Cancela ciclo / volta ao idle
start_to_work(mode, extra_drying=False) Inicia ciclo
set_bright(level: BrightLevel) Ajusta o nível do abrilhantador (1–5)

DishwasherStatus

Campos decodificados da resposta:

  • machine_state: MachineState | NonePOWER_ON / POWER_OFF
  • cycle_state: CycleState | Noneidle, order, work, error, ...
  • mode: Mode | int | None — programa em execução; None quando nenhum (0x00), int para bytes de programa que ainda não foram catalogados no enum
  • extra_drying: bool — flag "secagem extra" do programa atual
  • wash_stage: WashStage | int | NoneIDLE, PRE_WASH, MAIN_WASH, RINSE, DRY, FINISH
  • error_code: ErrorCode | intNONE, WATER_SUPPLY, HEATING, OVERFLOW, WATER_VALVE
  • left_time: int | None — minutos restantes (preenchido apenas quando cycle_state == WORK)
  • door_closed: bool
  • bright_lack: bool — secante (rinse aid) acabou
  • bright: BrightLevel | int | None — nível atual do abrilhantador (1–5)

Modos disponíveis (Mode)

AUTO, INTENSIVE, NORMAL, ECO, GLASS, NINETY_MIN, ONE_HOUR, RAPID, SOAK, THREE_IN_ONE, HYGIENE, QUIET, PARTY, FRUIT.

Transporte customizado

Client aceita qualquer Callable[[bytes], bytes] como send. Útil para testes com transporte mock, integração com cloud, ou pipeline próprio:

from midea_dishwasher_api.protocol import assemble_frame

def fake_send(frame: bytes) -> bytes:
    return assemble_frame(b"...", 0x02)

client = Client(send=fake_send)

O codec low-level (assemble_frame, parse_frame, build_query, build_control, make_sum) e o decoder de status (decode_response) ficam em midea_dishwasher_api.protocol e midea_dishwasher_api.state respectivamente — fora do __init__.py público.

Como obter token e key

São credenciais por dispositivo emitidas pela cloud da Midea. Use ferramentas existentes (midea-msmart, midea-beautiful-air, midea-discover) para extrair a partir da sua conta no app.

Licença

MIT — ver LICENSE.

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

midea_dishwasher_api-1.3.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

midea_dishwasher_api-1.3.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file midea_dishwasher_api-1.3.2.tar.gz.

File metadata

  • Download URL: midea_dishwasher_api-1.3.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for midea_dishwasher_api-1.3.2.tar.gz
Algorithm Hash digest
SHA256 ad3bbf086a04ad89f6509320c4884852d6dc5a0022c2c4693c7150e659133129
MD5 ab7fde1cb2f5374b3a45cd2f30ce29fb
BLAKE2b-256 93d860d443e46337ace0d22a5cb30db45a09884dad773f88e3d1fe2408cd23b3

See more details on using hashes here.

File details

Details for the file midea_dishwasher_api-1.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for midea_dishwasher_api-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f21fb3a84644de5a83b76337d20dae484ec73310c46b2bf847ca7a69985a04b8
MD5 7d01eb6be4dfd1718e2d1420a5f39d9c
BLAKE2b-256 0b43ba16354d38f21966bbdeee64c994e424ae6cd00e8b628576c654145943bc

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