Fix: ping Miotiq command=0x02 pour retrocompat avec capteurs deployés (byte 9 = 0x01)

Les capteurs en production envoient 0x01 sur le byte 9 (ancien protocol_version).
Cote serveur: 0x00 et 0x01 = data normal, 0x02 = ping test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
PaulVua
2026-04-27 16:43:19 +02:00
parent 8785f8cff4
commit 1c565435e7
4 changed files with 4 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ import sqlite3
MIOTIQ_IP = "192.168.0.20" MIOTIQ_IP = "192.168.0.20"
MIOTIQ_PORT = 4242 MIOTIQ_PORT = 4242
PAYLOAD_SIZE = 100 PAYLOAD_SIZE = 100
COMMAND_PING = 0x01 COMMAND_PING = 0x02
LISTEN_TIMEOUT = 15 # seconds to wait for downlink response LISTEN_TIMEOUT = 15 # seconds to wait for downlink response
# --- Load device_id from SQLite --- # --- Load device_id from SQLite ---

View File

@@ -334,7 +334,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<p class="card-text"><strong>3. Test aller-retour</strong></p> <p class="card-text"><strong>3. Test aller-retour</strong></p>
<p class="text-muted small mb-2">Envoie un payload ping (command=1) via UDP puis écoute la réponse descendante Miotiq (~15s).</p> <p class="text-muted small mb-2">Envoie un payload ping (command=2) via UDP puis écoute la réponse descendante Miotiq (~15s).</p>
<button class="btn btn-primary" onclick="pingMiotiq()">Ping Miotiq</button> <button class="btn btn-primary" onclick="pingMiotiq()">Ping Miotiq</button>
<div id="loading_ping_miotiq" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div> <div id="loading_ping_miotiq" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div>
<div id="response_ping_miotiq"></div> <div id="response_ping_miotiq"></div>

View File

@@ -387,7 +387,7 @@ class SensorPayload:
self.payload[68] = status & 0xFF self.payload[68] = status & 0xFF
def set_command(self, value): def set_command(self, value):
"""Set command byte (byte 9): 0x00 = normal data, 0x01 = ping test""" """Set command byte (byte 9): 0x00 = normal data, 0x01 = legacy (ancien protocol_version), 0x02 = ping test"""
self.payload[9] = value & 0xFF self.payload[9] = value & 0xFF
def set_firmware_version(self, version_str): def set_firmware_version(self, version_str):

View File

@@ -13,7 +13,7 @@ etre actifs simultanement.
## Position dans la payload ## Position dans la payload
``` ```
Byte 9 : command (0x00 = data normal, 0x01 = ping test) Byte 9 : command (0x00 = data normal, 0x01 = legacy/ancien protocol_version, 0x02 = ping test)
Bytes 0-8 : device_id (8 bytes) + signal_quality (1 byte) Bytes 0-8 : device_id (8 bytes) + signal_quality (1 byte)
Bytes 10-65 : donnees capteurs Bytes 10-65 : donnees capteurs
Byte 66 : error_flags (erreurs systeme) Byte 66 : error_flags (erreurs systeme)