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
  • 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.0.tar.gz (14.8 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.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: midea_dishwasher_api-1.3.0.tar.gz
  • Upload date:
  • Size: 14.8 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.3.0.tar.gz
Algorithm Hash digest
SHA256 6153b27e4c9c42d04e757947e657aab1250ba32962c5fb4ac7f75ed2e4b01134
MD5 a4cdda9d41ce56c469cbadabca3f5e8d
BLAKE2b-256 d70437a4e79fff866c32bf230c77bede8350958239e2178c70dee972f3a4b49b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for midea_dishwasher_api-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d43284b98cc3862abdb60395699a4714a5044e8c2cc4da8e323cb669df2ac8b
MD5 a33bfe7e5ae636a579f4f71b4f1ca52f
BLAKE2b-256 1f5dc3f64f214296cc4aa33288ec35784742f66f43f72eb4eb888136bf5ee072

See more details on using hashes here.

Provenance

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