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, ...
  • 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
  • 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.2.0.tar.gz (14.7 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.2.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: midea_dishwasher_api-1.2.0.tar.gz
  • Upload date:
  • Size: 14.7 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.2.0.tar.gz
Algorithm Hash digest
SHA256 d32b5972da2134b5c07f5765bd29a885c31e1e874951d190948711c35f27d894
MD5 4afed6757e18d66ab90c669668e6ab85
BLAKE2b-256 9960e1c476a584746bf0365ba34952991fc6e96370da331e7a59035d7bf7887f

See more details on using hashes here.

Provenance

The following attestation bundles were made for midea_dishwasher_api-1.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for midea_dishwasher_api-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51f92c81dd1105a51af1a77957bb04e03b1be64ee52d50e48ef6e9866c412e29
MD5 ba01f69bf9e5c5f25c3606a22d66796f
BLAKE2b-256 cb0d48f1c239a7fd4a83a204f741a3ec55ccaaa75f867857d95a64025b9f0242

See more details on using hashes here.

Provenance

The following attestation bundles were made for midea_dishwasher_api-1.2.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