plesty.lib.solver.iceblock

ICEBLOCK JSON operation solver for Plesty devices.

Classes

ICEBLOCKSolver

Operation solver for the ICEBLOCK JSON message protocol.

Module Contents

class plesty.lib.solver.iceblock.ICEBLOCKSolver

Bases: plesty.lib.solver.OpSolver

Operation solver for the ICEBLOCK JSON message protocol.

The solver builds compact JSON messages with an auto-incrementing transmission_id token 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

Create the start_link command 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 message object.

Parameters:

response (Any) – Raw response text from the device.

Returns:

The decoded message dictionary when parsing succeeds, otherwise None after 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:

True when status is ok; otherwise False.

Return type:

bool