From 7e23ef0764c9ed6d520e6468cfe04d67a0e614e9 Mon Sep 17 00:00:00 2001 From: mrlt8 <67088095+mrlt8@users.noreply.github.com> Date: Sun, 12 Nov 2023 17:26:30 -0800 Subject: [PATCH] set the flood light switch #921 --- app/wyzebridge/wyze_commands.py | 1 + app/wyzecam/tutk/tutk_protocol.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/app/wyzebridge/wyze_commands.py b/app/wyzebridge/wyze_commands.py index 9e35099a..6f637f1f 100644 --- a/app/wyzebridge/wyze_commands.py +++ b/app/wyzebridge/wyze_commands.py @@ -58,6 +58,7 @@ "rtsp": "K10600SetRtspSwitch", "quick_response": "K11635ResponseQuickMessage", "spotlight": "K10646SetSpotlightStatus", + "floodlight": "K12060SetFloodLightSwitch", } CMD_VALUES = { diff --git a/app/wyzecam/tutk/tutk_protocol.py b/app/wyzecam/tutk/tutk_protocol.py index 66b5107e..b011ad2a 100644 --- a/app/wyzecam/tutk/tutk_protocol.py +++ b/app/wyzecam/tutk/tutk_protocol.py @@ -1229,6 +1229,21 @@ def __init__(self): super().__init__(10820) +class K12060SetFloodLightSwitch(TutkWyzeProtocolMessage): + """ + A message used to set the flood light switch. + """ + + def __init__(self, value): + super().__init__(12060) + + assert 1 <= value <= 2, "value must be 1 or 2" + self.value: int = value + + def encode(self) -> bytes: + return encode(self.code, bytes([self.value])) + + def encode(code: int, data: Optional[bytes]) -> bytes: data_len = 0 if data is None else len(data) encoded_msg = bytearray([0] * (16 + data_len))