Skip to content

Camera Commands

mrlt8 edited this page Jul 22, 2024 · 19 revisions

Important

WebUI and stream authentication will be enabled by default to prevent unintentional access.

Please see the Authentication page for more information.

This is a work in progress and feedback would be appreciated

Send basic command to the camera over MQTT or the WebUI's REST API.

Can be disabled with DISABLE_CONTROL=True.

TOPICS

GET SET Topic Description Payload
x x state Local stream state of the camera. start/stop/enable/disable
x x power Power switch state of the camera. Sent via Wyze Cloud API (run_action). on/off/restart
x motion Returns current motion status. MOTION_API must be enabled. -
x motion_ts Returns the timestamp of the last motion. MOTION_API must be enabled. -
x update_snapshot Update the snapshot from the rtsp stream - /img/cam-name.jpg on WebUI. -
x take_photo Take a photo on the camera's SD card. -
x x status_light LED status light. on/off or 1/2
x x night_vision Night vision. on/off/auto or 1/2/3
x x irled IR/LED: 1/On = 850nm long range IR, 2/Off = 940 nmm close range IR. on/off or 1/2
x time_zone Set time zone on camera using the Area/Location format. str
x x camera_time Get or set time on camera used for video frames (NOT timestamp). -
x x night_switch Condition for auto night vision: 1/on = Dusk, 2/off = Dark. on/off or 1/2
x x alarm Alarm/siren. on/off or 1/2
x start_boa Start boa HTTP server. older firmware only. -
x x pan_cruise Pan scan/cruise. Automatically scan an area and pause at waypoints. on/off or 1/2
x cruise_point Go to pan scan cruise point/waypoint by ID. 1-4 int
x x cruise_points List of cruise/waypoints points for pan scan. payload MUST be json. See cruise_points
x x ptz_position Vertical/horizontal angle. See ptz_position
x rotary_degree Rotate camera by degree. See rotary_degree
x rotary_action Rotate camera until stop. See rotary_action
x x motion_tracking Camera Pans to follow detected motion. on/off or 1/2
x x motion_tagging Motion Tagging (green box around motion). on/off or 1/2
x x rtsp Native rtsp server. Requires RTSP firmware. on/off or 1/2
x reset_rotation Reset rotation. -
x x fps Change FPS. Mostly seems to adjust shutter speed. int
x x bitrate Change bitrate/quality of stream. int
x x hor_flip Flip the video horizontally. int
x x ver_flip Flip the video vertically. int
x x osd_timestamp Toggle timestamp on video. on/off or 1/2
x x osd_logo Toggle wyze logo on video. on/off or 1/2
x quick_response Doorbell quick response. 1-3 int
x battery Returns battery power level from the Web API. -
x battery_usage Returns json with battery usage times. -
x camera_info Returns json with camera parameters 1-60. -
x param_info Returns json values by key from camera_info. (multiple)* 1-124/155 depending on firmware
x accessories Return accessory information in json format. -
x spotlight Toggle the spotlight accessory (WYZEC3L). on/off or 1/2

PAYLOAD

The payload value for both REST and MQTT can be one of the following types:

  • string: on, off, auto, true, false, a single integer value, or multiple comma-separated integer values. For example, 0,-90 or 1,2,50.
  • integer: Single value. Typically 1 for on, 2 for off, 3 for auto.
  • json: If multiple key-value pairs are set, they will be passed directly to tutk_protocol (e.g., {"horizontal":-90, "vertical":0}). However, if only one key-value pair is set, the API will use the value without the key (e.g., {"anything":"auto"}).

*To pass multiple values, use a comma-separated string. For example, if you want to rotate left you could use the string value "-90,0".

Pan/Tilt

ptz_position

This topic will move the camera to a specific angle.

Custom Payload Values

This topic supports two parameters:

  • vertical (Positive values only): Degrees of the angle. Can be 0-180.
  • horizontal (Positive values only): Degrees of the angle. Can be 0-350.

JSON Payload Example:

{"vertical":20,"horizontal":150} 

String Payload Example:

note: vertical value must be first

"20,150"

rotary_degree

This topic will move the camera by the specified value.

Predefined Payload Values

  • left
  • right
  • up
  • down

Custom Payload Values

This topic supports three parameters:

  • horizontal: positive values pan right, negative values pan left.
  • vertical: positive values tilt up, negative values tilt down.
  • speed (optional): Value can be 1-9. Defaults to 5.

JSON Payload Example:

# Pan left:
{"horizontal":-90, "vertical":0} 

# Pan right fast:
{"horizontal":90, "vertical":0, "speed":9} 

String Payload Example:

# Pan left:
-90,0 

# Pan right fast:
90,0,9 

rotary_action

This topic will move the camera towards the specified direction until it stops.

Custom Payload Values

This topic supports three parameters:

  • horizontal: Value can be 0-2. 1 = pan left, 2 = pan right.
  • vertical: Value can be 0-2. 1 = tilt up, 2 = tilt down.
  • speed (optional): Value can be 1-9. Defaults to 5.

JSON Payload Example:

# Pan left:
{"horizontal":1, "vertical":0} 

# Pan right fast:
{"horizontal":2, "vertical":0, "speed":9} 

String Payload Example:

# Pan left:
1,0 

# Pan right fast:
2,0,9 

cruise_points

This topic will set the individual cruise points/waypoints for pan scan.

  • Payload MUST be json.

  • Payload should contain a list of waypoints.

Each waypoint supports three parameters:

  • vertical: Degrees of the angle. Can be 0-40.
  • horizontal: Degrees of the angle. Can be 0-350.
  • time: seconds to wait. can be 10-255. Defaults to 10.

JSON Payload Example:

[
  {"vertical":20,"horizontal":50,"time":20},
  {"vertical":20,"horizontal":150} // Will pause for the default time if not set.
]

With default wait time for all points:

{"wait_time":"15","points":[
  {"vertical": "10", "horizontal": "50"},
  {"vertical": "10", "horizontal": "150"},
  {"vertical": "10", "horizontal": "250"}
]}

REST API

  • GET Value

    REQUEST:

    GET http://<localhost>:5000/api/<cam_name>/<command_topic>

    RESPONSE:

    json

  • SET Value

    REQUEST:

    • GET http://<localhost>:5000/api/<cam_name>/<command_topic>/<payload>

    • GET http://<localhost>:5000/api/<cam_name>/<command_topic>?<key>=<payload>

    • POST/PUT http://<localhost>:5000/api/<cam_name>/<command_topic>

      Data for PUT/POST requests can be sent as:

      • --data <payload>

      • --header 'Content-Type: application/json' --data '{"<key>":"<payload>"}'

      • --header 'Content-Type: application/x-www-form-urlencoded' --data <key>=<payload>

    RESPONSE:

    json

MQTT

  • GET Value

    PUBLISH TOPIC:

    wyzebridge/<cam_name>/<command_topic>/get 
    

    PAYLOAD: NOT Required

    RESPONSE TOPIC:

    wyzebridge/<cam_name>/<command_topic>
    
  • SET Value

    PUBLISH TOPIC:

    wyzebridge/<cam_name>/<command_topic>/set
    

    PAYLOAD: Required

    RESPONSE TOPIC:

    wyzebridge/<cam_name>/<command_topic>