Skip to content

tutk_protocol.py Commands

K10000ConnectRequest

The "connect request" sent by a client to a camera when the client first connects. This command initiates the handshake that authenticates the client to the camera.

The expected response to this command is 10001, in which the camera provides a set of 16 random bytes for the client to sign with the 'enr' of the camera.

K10002ConnectAuth

The "challenge response" sent by a client to a camera as part of the authentication handshake when the client first connects. This command is deprecated, and is replaced by K10008ConnectUserAuth on newer devices. We need to continue supporting this for older firmwares, however.

The expected response to this command is 10003, in which the camera provides a json object with the result of the authentication exchange (and if successful, a bunch of device information).

Methods

__init__(self, challenge_response, mac, open_video=True, open_audio=True) special

Constructs a new K10002ConnectAuth message

Parameters:

Name Type Description Default
challenge_response bytes

the xxtea-encrypted response to the challenge bytes recieved as part of message 10001.

required
mac str

the mac address of the camera

required
open_video bool

True if we wish to start streaming video after authentication is successful.

True
open_audio bool

True if we wish to start streaming audio after authentication is successful.

True
Source code in wyzecam/tutk/tutk_protocol.py
def __init__(
    self,
    challenge_response: bytes,
    mac: str,
    open_video: bool = True,
    open_audio: bool = True,
) -> None:
    """
    Constructs a new K10002ConnectAuth message

    :param challenge_response: the xxtea-encrypted response to the challenge bytes
                               recieved as part of message 10001.
    :param mac: the mac address of the camera
    :param open_video: True if we wish to start streaming video after authentication is successful.
    :param open_audio: True if we wish to start streaming audio after authentication is successful.
    """
    super().__init__(10002)

    assert (
        len(challenge_response) == 16
    ), "expected challenge response to be 16 bytes long"

    if len(mac) < 4:
        mac = mac + "1234"

    self.challenge_response = challenge_response
    self.username = mac
    self.open_video = open_video
    self.open_audio = open_audio

K10008ConnectUserAuth

The "challenge response" sent by a client to a camera as part of the authentication handshake when the client first connects. This command is a newer version of K10008ConnectUserAuth, and it sends the 'open_user_id' as part of the authentication response.

The expected response to this command is 10009, in which the camera provides a json object with the result of the authentication exchange (and if successful, a bunch of device information).

Methods

__init__(self, challenge_response, phone_id, open_userid, open_video=True, open_audio=True) special

Constructs a new K10008ConnectAuth message

Parameters:

Name Type Description Default
challenge_response bytes

the xxtea-encrypted response to the challenge bytes recieved as part of message 10001.

required
phone_id str

the phone id of the client

required
open_userid str

the open_user_id associated with the user authenticating.

required
open_video bool

True if we wish to start streaming video after authentication is successful.

True
open_audio bool

True if we wish to start streaming audio after authentication is successful.

True
Source code in wyzecam/tutk/tutk_protocol.py
def __init__(
    self,
    challenge_response: bytes,
    phone_id: str,
    open_userid: str,
    open_video: bool = True,
    open_audio: bool = True,
) -> None:
    """
    Constructs a new K10008ConnectAuth message

    :param challenge_response: the xxtea-encrypted response to the challenge bytes
                               recieved as part of message 10001.
    :param phone_id: the phone id of the client
    :param open_userid: the open_user_id associated with the user authenticating.
    :param open_video: True if we wish to start streaming video after authentication is successful.
    :param open_audio: True if we wish to start streaming audio after authentication is successful.
    """
    super().__init__(10008)

    assert (
        len(challenge_response) == 16
    ), "expected challenge response to be 16 bytes long"

    if len(phone_id) < 4:
        phone_id = phone_id + "1234"

    self.challenge_response = challenge_response
    self.username = phone_id
    self.open_userid = open_userid
    self.open_video = open_video
    self.open_audio = open_audio

K10010ControlChannel

A command used frequently by the mobile app to configure settings on the camera.

Not terribly well understood.

K10020CheckCameraInfo

A command used to read the current settings of the camera.

Not terribly well understood.

K10056SetResolvingBit

A message used to set the resolution and bitrate of the camera.

This is sent automatically after the authentication handshake completes successfully.

Methods

__init__(self, frame_size=0, bitrate=120) special

Construct a K10056SetResolvingBit message, with a given frame size and bitrate.

Possible frame sizes are:

  • tutk.FRAME_SIZE_1080P: 1080P, or 1920 x 1080
  • tutk.FRAME_SIZE_360P: 360P, or 640 x 360

Possible bit rates are:

  • tutk.BITRATE_360P: the bitrate chosen when selecting '360P' in the app; 30 KB/s
  • tutk.BITRATE_SD: the bitrate chosen when selecting 'SD' in the app; 60 KB/s
  • tutk.BITRATE_HD: the bitrate chosen when selecting 'HD' in the app; 120 KB/s
  • tutk.BITRATE_SUPER_HD: an even higher bitrate than ever asked for by the app; 150 KB/s
  • tutk.BITRATE_SUPER_SUPER_HD: an even higher bitrate than ever asked for by the app; 240 KB/s

Parameters:

Name Type Description Default
frame_size

the dimensions of the video to stream.

0
bitrate

the bit rate, in KB/s to target in the h264/h265 encoder.

120
Source code in wyzecam/tutk/tutk_protocol.py
def __init__(
    self, frame_size=tutk.FRAME_SIZE_1080P, bitrate=tutk.BITRATE_HD
):
    """
    Construct a K10056SetResolvingBit message, with a given frame size and bitrate.

    Possible frame sizes are:

     - `tutk.FRAME_SIZE_1080P`: 1080P, or 1920 x 1080
     - `tutk.FRAME_SIZE_360P`: 360P, or 640 x 360

    Possible bit rates are:

     - `tutk.BITRATE_360P`: the bitrate chosen when selecting '360P' in the app; 30 KB/s
     - `tutk.BITRATE_SD`: the bitrate chosen when selecting 'SD' in the app; 60 KB/s
     - `tutk.BITRATE_HD`: the bitrate chosen when selecting 'HD' in the app; 120 KB/s
     - `tutk.BITRATE_SUPER_HD`: an even higher bitrate than ever asked for by the app; 150 KB/s
     - `tutk.BITRATE_SUPER_SUPER_HD`: an even higher bitrate than ever asked for by the app; 240 KB/s

    :param frame_size: the dimensions of the video to stream.
    :param bitrate: the bit rate, in KB/s to target in the h264/h265 encoder.
    """
    super().__init__(10056)
    self.frame_size = frame_size
    self.bitrate = bitrate

K10620CheckNight

A message used to check the night mode settings of the camera.

Not terribly well understood.

K10640GetSpotlightStatus

A message used to check the spotlight settings of the camera.

Not terribly well understood.