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

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, ...
  • 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.1.0.tar.gz (14.5 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.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for midea_dishwasher_api-1.1.0.tar.gz
Algorithm Hash digest
SHA256 919cc33390de3d50bb65fe2de04dc13ece7ad713ab8259c3e063f40db6055406
MD5 a901bfd071a1458bc0d57a00ca32796c
BLAKE2b-256 b68bbc4bc7246da39e66769d97262336544df5fd7a6e71c063da46cdcd79d752

See more details on using hashes here.

Provenance

The following attestation bundles were made for midea_dishwasher_api-1.1.0.tar.gz:

Publisher: release.yml on roquerodrigo/midea-dishwasher-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for midea_dishwasher_api-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83e59948c16573b8807c3257329010fdc30f3ce0351fcd43135f13d54ba600a5
MD5 56c27ef3708e26ea07bd911c662d3992
BLAKE2b-256 e4e12dbcd5ede03a099ca8ed602411492558a82b70f4daedc07605b70f406a36

See more details on using hashes here.

Provenance

The following attestation bundles were made for midea_dishwasher_api-1.1.0-py3-none-any.whl:

Publisher: release.yml on roquerodrigo/midea-dishwasher-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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