From b4691408b1c300aa90ba5ac911f58b349aeb4a7e Mon Sep 17 00:00:00 2001 From: yabeenico <> Date: Sun, 26 May 2024 23:42:35 +0900 Subject: [PATCH] add terminalUUID to payload for P105 error -1012 (#21) --- PyP100/PyP100.py | 3 ++- PyP100/auth_protocol.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/PyP100/PyP100.py b/PyP100/PyP100.py index 84133ba..1aa8bc9 100644 --- a/PyP100/PyP100.py +++ b/PyP100/PyP100.py @@ -86,7 +86,8 @@ def get_status(self) -> bool: return self._get_device_info()["device_on"] def set_status(self, status: bool): - return self._set_device_info({"device_on": status}) + mac = self._get_device_info()["mac"] + return self._set_device_info({"device_on": status, "terminalUUID": mac}) def turnOn(self): return self.set_status(True) diff --git a/PyP100/auth_protocol.py b/PyP100/auth_protocol.py index 383acf1..66b7312 100644 --- a/PyP100/auth_protocol.py +++ b/PyP100/auth_protocol.py @@ -51,6 +51,10 @@ def _request(self, method: str, params: dict = None): self.Initialize() payload = {"method": method} if params: + # P105 requires terminalUUID in payload + if "terminalUUID" in params.keys(): + payload["terminalUUID"] = params["terminalUUID"] + del params["terminalUUID"] payload["params"] = params log.debug(f"Request: {payload}") # Encrypt payload and execute call