v1.5.1: envoi firmware version dans payload UDP (bytes 69-71)
- Lecture fichier VERSION et pack major.minor.patch dans bytes 69-71 - README: documentation complete structure 100 bytes + conso data - Changelog mis a jour Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -386,6 +386,16 @@ class SensorPayload:
|
||||
"""Set device status flags (byte 68)"""
|
||||
self.payload[68] = status & 0xFF
|
||||
|
||||
def set_firmware_version(self, version_str):
|
||||
"""Set firmware version bytes 69-71 (major.minor.patch)"""
|
||||
try:
|
||||
parts = version_str.strip().split('.')
|
||||
self.payload[69] = int(parts[0]) & 0xFF
|
||||
self.payload[70] = int(parts[1]) & 0xFF
|
||||
self.payload[71] = int(parts[2]) & 0xFF
|
||||
except (IndexError, ValueError):
|
||||
pass # leave as 0xFF if VERSION file is malformed
|
||||
|
||||
def get_bytes(self):
|
||||
"""Get the complete 100-byte payload"""
|
||||
return bytes(self.payload)
|
||||
@@ -1126,6 +1136,13 @@ try:
|
||||
error_flags |= ERR_RTC_RESET
|
||||
payload.set_error_flags(error_flags)
|
||||
|
||||
# ---- Firmware version (bytes 69-71) ----
|
||||
try:
|
||||
with open("/var/www/nebuleair_pro_4g/VERSION", "r") as f:
|
||||
payload.set_firmware_version(f.read())
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
if send_miotiq:
|
||||
print('<p class="fw-bold">➡️SEND TO MIOTIQ</p>', end="")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user