openlifu.io.LIFUUserConfig.LifuUserConfig¶
- class openlifu.io.LIFUUserConfig.LifuUserConfig(header: LifuUserConfigHeader | None = None, json_data: Dict[str, Any] | None = None)[source]¶
Bases:
objectEncapsulates the Lifu configuration stored in device flash.
The configuration is stored as a JSON blob with metadata including: - magic number for validation - version for compatibility - sequence number (monotonically increasing) - CRC for integrity
- __init__(header: LifuUserConfigHeader | None = None, json_data: Dict[str, Any] | None = None)[source]¶
Initialize LifuUserConfig
- Parameters:
header – Configuration header metadata
json_data – Configuration JSON data as a dictionary
- classmethod from_wire_bytes(data: bytes) LifuUserConfig[source]¶
Parse configuration from wire format bytes
- Wire format:
[header: 16 bytes][json: json_len bytes]
- Parameters:
data – Raw bytes from device
- Returns:
LifuUserConfig instance
- Raises:
ValueError – If data is invalid or malformed
- set_json_str(json_str: str)[source]¶
Set configuration from JSON string
- Parameters:
json_str – JSON string to parse
- Raises:
json.JSONDecodeError – If JSON is invalid