1.7 KiB
1.7 KiB
ESP-NOW API v1
Date: 2026-02-23
Ce document est synchronisé avec le contrat opérationnel: docs/espnow_contract.md.
Source de vérité
- Canonique:
docs/espnow_contract.md - Ce fichier doit rester cohérent avec ce contrat.
Reprise du contrat (v1)
- Trame recommandée:
type: "command",ack: true. - Corrélation:
msg_id+seq. - Corps: objet JSON dans
payload, ou texte compatible selon parser legacy.
Exemple de demande:
{
"msg_id": "req-001",
"seq": 7,
"type": "command",
"ack": true,
"payload": {
"cmd": "WIFI_STATUS"
}
}
Réponse attendue:
{
"msg_id": "req-001",
"seq": 7,
"type": "ack",
"ack": true,
"payload": {
"ok": true,
"code": "WIFI_STATUS",
"error": "",
"data": {}
}
}
Compatibilité parser (legacy)
cmd,command,action(root oupayload).- format texte:
"CMD arg". - ancien champ
idau lieu demsg_idcôté trames historiques.
Commandes supportées
STATUSWIFI_STATUSESPNOW_STATUSUNLOCKNEXTWIFI_DISCONNECTWIFI_RECONNECTESPNOW_ONESPNOW_OFFSTORY_REFRESH_SDSC_EVENTRINGSCENE <id>SCENEretourne une erreurmissing_scene_idsiidabsentNEXTretournescene_not_foundsi aucune scène n’est active
Erreurs connues
unsupported_commandmissing_scene_idscene_not_foundWIFI_RECONNECT no_credentials- erreurs réseau:
peer,payloadvide, trame > 240
Limites runtime
- Trame brute max:
240 - Peers:
16 - RX queue:
6
Réception firmware
type=command->executeEspNowCommandPayloadtypenon-commandignoré pour dispatch de commandetype=ackignoré côté dispatch commande