plesty.lib.solver.iceblock ========================== .. py:module:: plesty.lib.solver.iceblock .. autoapi-nested-parse:: ICEBLOCK JSON operation solver for Plesty devices. Classes ------- .. autoapisummary:: plesty.lib.solver.iceblock.ICEBLOCKSolver Module Contents --------------- .. py:class:: ICEBLOCKSolver Bases: :py:obj:`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. .. py:attribute:: tk :value: 1 .. py:method:: _build_msg(op, parameters=None) Build a protocol message and serialize it as compact JSON. :param op: Operation name sent to the remote device. :param parameters: Optional operation parameters dictionary. :returns: ``{"message": {"transmission_id": [id], "op": op, ...}}`` :rtype: JSON string in the shape .. py:method:: get_startLink_cmd(ip_address: str) -> str Create the ``start_link`` command payload. :param ip_address: Remote ICEBLOCK endpoint address. :returns: Serialized JSON command for ``start_link``. .. py:method:: decode_response(response: Any) -> dict[str, Any] | None Decode a JSON response and return its ``message`` object. :param response: Raw response text from the device. :returns: The decoded ``message`` dictionary when parsing succeeds, otherwise ``None`` after error handling. .. py:method:: status_ok(response: Any) -> bool Check whether a response contains ``parameters.status == 'ok'``. :param response: Either a decoded response dictionary or raw JSON text. :returns: ``True`` when status is ``ok``; otherwise ``False``.