plesty.lib.solver.iceblock
ICEBLOCK JSON operation solver for Plesty devices.
Classes
Operation solver for the ICEBLOCK JSON message protocol. |
Module Contents
- class plesty.lib.solver.iceblock.ICEBLOCKSolver
Bases:
plesty.lib.solver.OpSolverOperation solver for the ICEBLOCK JSON message protocol.
The solver builds compact JSON messages with an auto-incrementing
transmission_idtoken and provides helpers to decode responses and evaluate success status.- tk = 1
- _build_msg(op, parameters=None)
Build a protocol message and serialize it as compact JSON.
- Parameters:
op – Operation name sent to the remote device.
parameters – Optional operation parameters dictionary.
- Returns:
{"message": {"transmission_id": [id], "op": op, ...}}- Return type:
JSON string in the shape
- get_startLink_cmd(ip_address: str) str
Create the
start_linkcommand payload.- Parameters:
ip_address (str) – Remote ICEBLOCK endpoint address.
- Returns:
Serialized JSON command for
start_link.- Return type:
str
- decode_response(response: Any) dict[str, Any] | None
Decode a JSON response and return its
messageobject.- Parameters:
response (Any) – Raw response text from the device.
- Returns:
The decoded
messagedictionary when parsing succeeds, otherwiseNoneafter error handling.- Return type:
dict[str, Any] | None
- status_ok(response: Any) bool
Check whether a response contains
parameters.status == 'ok'.- Parameters:
response (Any) – Either a decoded response dictionary or raw JSON text.
- Returns:
Truewhen status isok; otherwiseFalse.- Return type:
bool