Skip to content

Add PTZ cruise support to SmartCam PanTilt #1766

Description

@juherr

Some Tapo PTZ cameras support an automatic cruise mode in addition to manual pan/tilt movements.

On a Tapo C200, cruise can run:

  • horizontally
  • vertically
  • and be stopped explicitly

python-kasa already exposes PTZ controls through the SmartCam PanTilt module, so cruise support seems to fit naturally there.

I could not find an existing issue or PR specifically covering cruise / patrol support.

Protocol

Known Tapo commands:

Horizontal cruise:

{"do":{"motor":{"cruise":{"coord":"x"}}}}

Vertical cruise:

{"do":{"motor":{"cruise":{"coord":"y"}}}}

Stop cruise:

{"do":{"motor":{"cruise_stop":{}}}}

Existing implementations use the same commands:

Possible API

For example:

await pantilt.start_cruise(CruiseAxis.HORIZONTAL)
await pantilt.start_cruise(CruiseAxis.VERTICAL)
await pantilt.stop_cruise()

with:

class CruiseAxis(StrEnum):
    HORIZONTAL = "x"
    VERTICAL = "y"

The exact API naming is open for discussion, but keeping cruise would match the underlying Tapo protocol and existing implementations.

It could also expose action features such as:

  • ptz_cruise_horizontal
  • ptz_cruise_vertical
  • ptz_cruise_stop

Device available for testing

I can test this on a physical C200:

  • Hardware: 1.0
  • Firmware: 1.3.17 Build 260112 Rel.54862n(4555)
  • ptz component version: 1

The device is already covered by the fixture added in #1760.

Open question

The C200 advertises PTZ/motor capabilities but does not appear to explicitly advertise cruise support.

It would be useful to determine whether cruise:

  1. is available on all compatible PTZ devices,
  2. can be detected through another capability/query,
  3. or should initially be exposed for PTZ devices and let unsupported devices return the protocol error.

I would prefer avoiding a model-specific whitelist.

Cruise is also a persistent motor mode, so manual pan / tilt / move commands may fail while it is active. I would avoid stopping cruise implicitly unless that behavior is intentional.

Tests

If accepted, I can provide:

  • unit tests for horizontal / vertical / stop payloads,
  • physical tests on the C200,
  • a test for interaction with manual PTZ movement while cruise is active.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions