Custom component - Tapo: Cameras Control - to add Tapo cameras into Home Assistant
Copy contents of custom_components/tapo_control/ to custom_components/tapo_control/ in your Home Assistant config folder.
Installation using HACS
HACS is a community store for Home Assistant. You can install HACS and then install Tapo: Camera Control from the HACS store.
Following target TCP ports must be open in firewall for the camera to access your Tapo Camera from Home Assistant:
- 443 - HTTPS for control of the camera (services)
- 554 - RTSP to fetch video stream from the camera
- 2020 - ONVIF to track detected movement via a binary sensor
Add cameras via Integrations (search for Tapo) in Home Assistant UI.
Cameras are also automatically discovered when they are (re)connected to WIFI.
To add multiple cameras, add integration multiple times.
This custom component creates:
- tapo_control.* services to control a camera
- 2 camera entities, one for HD and one for SD stream
- 1 binary sensor for motion after the motion is detected for the first time
Use these services in following service calls.
Pan and tilt camera.
You are also able to use presets and set distance the ptz should travel.
- entity_id Required: Entity to adjust
- tilt Optional: Tilt direction. Allowed values: UP, DOWN
- pan Optional: Pan direction. Allowed values: RIGHT, LEFT
- preset Optional: PTZ preset ID or a Name. See possible presets in entity attributes.
- distance Optional: Distance coefficient. Sets how much PTZ should be executed in one request. Allowed values: floating point numbers, 0 to 1
Sets privacy mode.
If privacy mode is turned on, camera does not record anything and does not respond to anything other than turning off privacy mode.
- entity_id Required: Entity to set privacy mode for
- privacy_mode Required: Sets privacy mode for camera. Possible values: on, off
Sets alarm mode.
If camera detects motion, it will sound an alarm, blink the LED or both.
- entity_id Required: Entity to set alarm mode for
- alarm_mode Required: Sets alarm mode for camera. Possible values: on, off
- sound Optional: Sets whether the alarm should use sound on motion detected. Possible values: on, off
- light Optional: Sets whether the alarm should use light on motion detected. Possible values: on, off
Sets LED mode.
When on, LED is turned on when camera is on.
When off, LED is always off.
- entity_id Required: Entity to set LED mode for
- led_mode Required: Sets LED mode for camera. Possible values: on, off
Formats SD card of a camera
- entity_id Required: Entity to format
Sets motion detection mode.
Ability to set “high”, “normal” or “low”.
These turn on motion detection and set sensitivity to corresponding values in the app.
Also ability to set to “off”, this turns off motion detection completely.
Turning motion detection off does not affect settings for recordings so you do not need to re-set those unless you open the settings through the Tapo app.
Notice: If you use motion detection triggered recording and you turn off motion recording, it will no longer record!
- entity_id Required: Entity to set motion detection mode for
- motion_detection_mode Required: Sets motion detection mode for camera. Possible values: high, normal, low, off
Warning: This mode is not available in Tapo app and we do not know why. Use at your own risk and please report any success or failures in Home Assistant: Community Forum.
Sets auto track mode.
With this mode, camera will be adjusting ptz to track whatever moving object it sees.
Motion detection setting does not affect this mode.
- entity_id Required: Entity to set auto track mode for
- auto_track_mode Required: Sets auto track mode for camera. Possible values: on, off
Reboots the camera
- entity_id Required: Entity to reboot
Saves the current PTZ position to a preset
- entity_id Required: Entity to save the preset for
- name Required: Name of the preset. Cannot be empty or a number
Deletes a preset
- entity_id Required: Entity to delete the preset for
- preset Required: PTZ preset ID or a Name. See possible presets in entity attributes
Sets day or night mode
- entity_id Required: Entity to set day/night mode for
- day_night_mode Required: Sets day/night mode for camera. Possible values: on, off, auto
Troubleshooting | FAQ
Binary sensor for motion doesn't show up or work
Motion sensor is added only after a motion is detected for the first time.
- Make sure the camera has motion detection turned on
- Make sure the camera has privacy mode turned off
- Make sure the camera can see you and your movement
- Try walking in front of the camera
- If above didn’t work, restart the camera and try again
Also make sure that:
- binary sensor is not disabled via entity, check .storage/core.entity_registry for disabled entities, look for “disabled_by”: “user” on platform “tapo_control”. If it is, remove the whole entity or change to “disabled_by”: null, and restart HASS.
- binary sensor is enabled in tapo integration options
- onvif port 2020 on camera is opened
Big delay in camera stream
This is a known issue of Home Assistant.
There is an ability to disable usage of Home Assistant Stream component for the camera, which might lower the delay very significantly at cost of higher CPU usage.
You can choose to disable stream component when adding the camera, or via Options when camera has already been added. This change requires a restart of Home Assistant.
There might be some disadvantages to doing this, like losing option to control playback and a higher CPU usage.
Results depend on your hardware and future Home Assistant updates.
If you disable stream and your hardware is not up to the task, you will get artifacts, bigger delay and freezes.
If you wish, try it out and see what works best for you.
No audio in camera stream
Supported audio codecs in Home Assistant are “aac”, “ac3” and “mp3”.
Tapo Cameras use PCM ALAW (alaw) which is not supported.
Users reported full functionality with following Tapo Cameras:
The integration should work with any other Tapo Cameras.
If you had success with some other model, please report it via a new issue.
Have a comment or a suggestion?
Join discussion on Discord.
- Dale Pavey from NCC Group for the initial research on the Tapo C200
- likaci and his github repository for the research on the Mercury camera on which tapo is based
- Tim Zhang for additional research for Mercury camera on his github repository
- Gábor Szabados for doing research and gathering all the information above in Home Assistant Community forum
- Davide Depau for additional research of the cameras and work on pytapo library
This integration is using python module Pytapo which is an unofficial module for achieving interoperability with Tapo cameras.
Author is in no way affiliated with Tp-Link or Tapo.
All the api requests used within the pytapo library are available and published on the internet (examples linked above) and the pytapo module is purely just a wrapper around those https requests.
Author does not guarantee functionality of this integration and is not responsible for any damage.
All product names, trademarks and registered trademarks in this repository, are property of their respective owners.