Oct 8, 2020

Integrating the Wyze Cam v2 with Home Assistant (including motion detection)

Disclosure: This post contains affiliate links. If you click through and make a purchase, I’ll earn a commission, at no additional cost to you. Read my full disclosure here.

The Wyze Cam v2 is a very popular security camera in the Home Assistant community. It can broadcast video in 1080p Full-HD quality, it has night vision using four infrared LEDs, and 2-way audio. Despite boasting impressive specs, the Wyze Cam v2 can be bought for just $20 (MSRP). And the company seems like one deserving of support. Wyze got plaudits from the community when they responded to webcams selling out during the pandemic when by developing and releasing a Webcam Firmware for their cameras.

One area where some might criticize Wyze is their implementation of RTSP. Instead of baking it into the firmware, you have to download and flash a beta release to your camera. While the RTSP only gets updated infrequently, you could say that it is an acceptable solution, as many security cameras don’t support RTSP at all.

Table of Contents

Why RTSP matters

The Real Time Streaming Protocol (RTSP) is a network control protocol designed for use in entertainment and communications systems. Using RTSP, you can display your camera’s video stream on any supported platform. And it just so happens that Home Assistant supports RTSP.

Wyze Cam V2
  • Full HD (1080p) livestreaming
  • Night vision lets you see up to 30’ in absolute darkness using 4 infrared (IR) LEDs
  • Works with Alexa and Google Assistant (US only)

While researching the topic, I couldn't help but become overwhelmed with nostalgia when I read that RealNetworks, who built the RealPlayer, and Netscape were involved in the development of RTPS. Today, RTSP is still kicking because of how easy it is to implement. Better solutions, such as the standards defined by the Open Network Video Interface Forum, would be available.

Currently, the only way of integrating your Wyze Cam v2 with Home Assistant is by flashing the beta firmware and enabling RTSP.

How to prepare your Wyze Cam v2

Detailed instructions on how to flash the RTSP firmware are available on the Wyze website. All you need is your Wyze Cam v2 and a microSD card. Once your camera is ready and RTSP has been enabled, you can get started with the integration.

On the subject of microSD cards: If you are planning to continuously record footage with your Wyze Cam v2, make sure you get a card which is rated for endurance. You will quickly burn through cheaper options because microSD cards do wear out quickly when they are frequently being written to.

If you want this integration to keep working without any hiccups, you will want to assign a static IP address to each and every camera you have. If you don’t do that, the Wyze Cam v2’s IP might change after a certain amount of time or during a reboot and the integration will stop working.

Enabling motion detection in Home Assistant

The following discovery was made by Reddit user /u/ChiefBroady. As detailed in their post, you will have to set up a binary_sensor using the platform ffmpeg_motion for each Wyze Cam v2. Copy the code down below and change the username, password, and IP address as well as the sensor’s name.

binary_sensor:
  - platform: ffmpeg_motion
    input: -rtsp_transport http -i rtsp://USER:PASSWORD@IP-ADDRESS/live
    name: CAMERA_MOTION
    extra_arguments: -pred 1 -q:v 2
    changes: 10
    reset: 10

The extra arguments in the code define the quality of your stream. The changes argument defines how many details between two frames need to change to detect it as a motion event. If the motion detection is too sensitive, you might want to increase that number (it goes from 0-100). Finally, reset defines the time to reset the state after no new motion is detected.

Adding Wyze Cam v2 video stream to Home Assistant

You will probably also want to see the camera’s video stream in your Home Assistant dashboard. Why else would you use a security camera capable of RTSP streaming? To accomplish that, you can simply add a camera using the ffmpeg platform. Here you will once again have to adjust the camera’s name and the username, password, and IP address.

camera:
  - platform: ffmpeg
    name: CAMERA_NAME
    input: -rtsp_transport http -i rtsp://USER:PASSWORD@IP-ADDRESS/live
    extra_arguments: -pred 1 -q:v 2

2 thoughts on “Integrating the Wyze Cam v2 with Home Assistant (including motion detection)”

    • Hi. This will only give you a video stream and won’t enable any controls. To be able to turn it off from HA you would need a smart plug or another workaround.

      Reply

Leave a comment