Skip to content
Adam Peace edited this page Feb 22, 2022 · 19 revisions

This guide documents how to set up Wyze Cameras with the Dafang-Hack mod to enable motion alerts, RTSP streams, and enable to use of HomeKit Secure Video (HKSV).

MQTT

  1. Install the Scrypted MQTT Plugin and enable the MQTT Broker.

Dafang-Hacks

Flashing Dafang-Hacks

It should be noted that as of Some of the more recent Wyze Cam firmware releases, you will not be able to flash the firmware without a bit of trickery BEYOND the recommended procedure. I would recommend heading to the Dafang-Hacks repo and pulling a FULL copy from the page. For a quick start for Wyze Cam V2 users, this is the WayBack machine page I used. it will save you some time. For everyone else, you may have to search a bit. Extract the zip and name the new file demo.bin and place it separate from your working area as we will have another file with the same name later.

IF YOU ARE ON THE NEW FIRMWARE: Grab the old firmware unplug the USB cable, remove the card and remove all files on the SD card, place the demo.bin file in the root, insert the card, hold the Setup button and plug in the USB cable and continue to hold the setup button for 10 seconds. Then wait 3-5 minutes. Once done, we are ready to get started.

How to flash. Original source here

  1. Take the micro SD card you wish to use and format it to FAT32 SPECIFICALLY. Other formats won't work, so its suggested you use this. If your SD card is large (larger than 4gb) I would suggest either finding a smaller one, or you COULD partition a small bit of it. This latter method may not work though. You can also just leave it as is but formatted to FAT32. I do this, and it seems to work just fine.
  2. Head over to their GitHub and clone the full repository. You can do it as a .zip file as we will need the whole thing. Be sure to extract it.
  3. Next, I would head to the install guide page and reference Step 1. They will have a CFW binary for YOUR camera. Grab it and extract it. Then name it to demo.bin.
  4. Place the demo.bin file to the root of the SD card. This SD card CANNOT have any file (including the hidden macOS ones). Make sure they are deleted outright, and trash emptied.
  5. Remove the cable from your camera and insert the card.
  6. IMPORTANT: while HOLDING the setup button, insert the USB cable and continue to hold that button for 10 seconds.
  7. Wait 3-5 minutes. Wyze Cam Pan models will move when done, but for static cameras, you will need to wait the full length. At the end of the wait unplug the camera and remove the card.
  8. Next, we need to copy everything from inside the firmware_mod folder on our cloned repo to the root of the SD card. Then we need to duplicate a couple files and rename them.
  9. On the SD card, duplicate config/wpa_supplicant.conf.dist and rename the NEW file wpa_supplicant.conf
  10. (For those not using reserved IP addressed on their router) Take the file at config/staticip.conf.dist, duplicate it, and rename it to staticip.conf
  11. Open wpa_supplicant.conf and give the proper SSID and password for your network. Make sure they are in quotes and spelled EXACTLY. For key_mgmt, ONLY change it if you need too. For everyone else, WPA-PSK (WPA2) is totally fine.
  12. Open the staticip.conf file and make sure you put in the DESIRED IP address and subnet mask. You dont have to make this change if you set the reserved IP on your router. (MAC address is on the camera body). The format is 192.168.x.x netmask 255.255.255.0 as an example
  13. Remove the card, insert it into the camera and power it on. Then, head to your browser and enter the IP address of the camera. The default username is root and password ismart12. It is suggested you change these as anyone can look these up.

Additional issues with flashing can be troubleshooted on their GitHub or looked up on their issues tab.

MQTT

  1. In the Dafang-Hacks web ui of your camera, go to the gear icon located in the top navigation bar then network services.
  2. Enter the ip address of Scrypted. The default server port is 1883. If you didn't set up a user id and password in your MQTT plugin, you can leave those fields blank. Set your Location and Device to whatever you'd like. I used "Home" for location on all my cameras and whatever room the camera is in as the device name, i.e. "Garage".
  • Ensure that MQTT notifications and Motion Detection are enabled, they may not be by default.

Camera Settings

  1. Go to gear icon, camera, video, format. The settings I use which give me reliable streaming are: H264, 1280x720, 299kbps, FixedQp, 15FPS. This should allow you to stream through Scrypted without transcoding (copy).
  • Community reports also indicate H264, 1280x720, 2000kbps, VBR, 15FPS works well.
  1. Go to Audio, change the audio format to MP3. This will further prevent any streaming issues.
  2. Go to the wrench/screwdriver icon, services. Ensure that "MQTT Live Status Updates" control is set to start and autostart is set to on. I believe these are already activated by default.

Passwords

  1. Go to gear icon, system, properties. Set your http root password. (ID should be "root" by default.) This is supposed to set your password protection for dafang's web ui, but I can't remember if I ever have been asked to enter my password. This will be used for the snapshot url later in Scrypted.
  2. Go to gear icon, camera, video, network/security. Set your user id and password. These will be used for your rtsp stream later in Scrypted.

Scrypted

Plugins

  1. In the Scrypted web ui, go to the plugins page and click "Install Plugin". Install the following plugins: mqtt (should already have this), rtsp, rebrebroadcast, and homekit.

MQTT

  1. From the plugins page, open the mqtt plugin, and check "Enable MQTT Broker" in the "Settings" panel under "MQTT Broker". Now back to the "General" tab of "Settings" and type the name of the device into the "Add MQTT Custom Handler" field. Then click the green paper airplane icon to add it. Click on your new device which should now be showing in the "Providing Things" panel.
  2. In the "MQTT Handler" panel, I replaced all of the default code with:
createMotionSensor({
    topic: 'motion',
    when: ({text}) => text === 'ON',
    delay: 10
})
  1. Set your device type to "Sensor".
  2. Within the "Settings" panel, for the "Subscription URL" field enter your mqtt url: mqtt://ip.address.of.pi/Home/Garage/
  3. Within the "Integrations and Extensions" panel, make sure the "Homekit" checkbox is NOT checked. The motion sensor will be integrated with the camera later.

Adding cameras

  1. From the plugins page, open the RTSP Camera Controller plugin and add a new camera. In the "Settings" panel type the name of your camera and click the green paper airplane icon to add it. The new camera should be in the "Provider Things" panel.
  2. In the "Integrations and Extensions" panel, ensure the rebroadcast plugin and homekit checkboxes are checked.
  3. In the "Settings" panel under "General", enter the username and password you used in step 8. Make sure you click the green paper airplane icon after each field is filled to save that particular field.
  4. For snapshot url use: http://root:[email protected]/cgi-bin/currentpic.cgi
  5. For RTSP Stream URL use: rtsp://ip.address.of.camera:8554/unicast This field won't display a green paper airplane icon for saving. Instead click the "Save RTSP Stream URL" button.
  6. Under "Rebroadcasting: Stream 1", "Audio Codec Transcoding", select "MP2/MP3 Audio".
  7. Under "Homekit", "Linked Motion Sensor", select the mqtt motion sensor you created in step 10.
  8. The remaining settings I left as default.
  9. You might need to restart scrypted (in settings) to ensure everything is working.

Homekit

  1. From the plugins page, open the Homekit plugin. In the settings panel, you can see the pairing info needed to add Scrypted to homekit.
  2. In the "Homekit" panel, click console button to view the homekit QR code.

FAQ.

Q. Can Dafang Hacks be installed on a Wyze Cam V3, outdoor, or Pan V2

A. UNSURE. Their documentation isn't exactly clear on this over at Dafang Hacks. You can try it though and see if it works. There are some nuances for V3's though. Doorbells are outright not supported. Outdoor cameras should be treated like a static V2 (not Pan)

Q. Why should I go with Dafang hacks instead of RTSP firmware/Docker-bridge?

A. First, Dafang hacks lets you forward motion events gained on the camera to MQTT. This will mean you do not need to use OpenCV, and therefore, is lighter on resources. The camera already does motion processing, so this is a distinct advantage. Second, Dafang Hacks cameras dont talk to anything other than GitHub occasionally for updates. Wyze can't come through and remove or convert your firmware. If Wyze goes down or out of business, you still can use the camera (the are LAN only). Finally, they are hyper customizable allowing you to get full audio in Scrypted. The Docker bridge project is also very early as well and is therefore less viable at this time.

Q. Can I build the SD card on a Pi?

A. Yes :) if you know how to work with it.

Q. What are the advantage/disadvantages of each?

A. Lets go into this.

Dafang Hacks Pros:

  1. Cloud indépendance. It doesn't collect data, and you get the privacy you want.
  2. On device motion processing forwarded via MQTT (less stressful on your server running Scrypted) for HKSV
  3. The ability to use the MP3 audio spec and get compatible audio for HomeKit
  4. The ability to adjust a LOT of things on the camera. Not just image/audio.
  5. It also runs its own RTSP server, so if you are gonna do the official firmware, might as well do this.
  6. LOTS of notification types, from Telegram to email on top of HomeKit with HKSV.

Cons:

  1. Its tough to install when users are already on latest WYZE firmware
  2. You can't use Wyze devices that depend on the camera (contact sensors)
  3. Doesn't support ALL cameras. Some models use a different chipset, and are thus not supported.

Docker Bridge Pros:

  1. Self contained bridge you can forward to anything using its own RTSP addresses (if you run scrypted or Home Assistant, this is a no brainer)
  2. An official Home Assistant add-on (need a Supervised install or hassOS)
  3. You dont need to do ANY firmware flashing. It runs on the latest stock firmware cameras.

Cons:

  1. The bridge project is new, and breaks down A LOT with the frequent requests Scrypted makes.
  2. Need to use OpenCV for image processing for HKSV which is harder on your Scrypted Server.
  3. Could be made obsolete by WYZE should they not want anyone to do this.
  4. The bridge may do ONLINE only mode, or LAN only mode. Online only can eat bandwidth.
  5. The project doesn't get tons of development at the moment.
  6. Cloud dependent. Wyze gets your data, and you still need them to exist to a certain extent.
  7. Audio needs to be transcoded unless removed from the stream in Scrypted.

OFFICIAL RTSP FIRMWARE Pros:

  1. Made by wyze and only needs to be flashed. After that, they update it, and it's "supported".
  2. Supports the Wyze Cam V3 (officially, not theoretically)
  3. Still lets you integrate it to the Wyze app and use their motion events for NON HomeKit users for notifications.

Cons:

  1. This is a beta, not actively developed firmware from Wyze. They seem not very keen on integrating it. And seeing as they killed off the ability to flash a CFW without a bit more work, it seems they dont want to add it in.
  2. No doorbells. Sorry :(
  3. Wyze may kill this off and move you to stock firmware at ANY time as the project is dead.
  4. Cloud dependent. While you can stream with RTSP, their official firmware doesn't like to be offline for long and will often error out because of it (in my experience)
  5. This firmware is BUGGY. They never fixed it all the way, and many things go wrong.
  6. Audio needs to be transcoded. No way around it unless you remove audio all together.
  7. Not a lot of customization with the Wyze firmware. So you are a bit limited.
  8. OpenCV is REQUIRED for motion processing for use of HomeKit Secure Video which uses more resources.

Q. Which firmware should I use?

A. Depends on platform. I will say Dafang Hacks is always the best, but newer cameras can't work it. You need to pick from the options and review the Pros/Cons stated above. For more information, here are some links to each project.

Dafang Hacks GitHub page Wyze Cam official RTSP firmware Docker-Wyze-Bridge GitHub

Q. 2 way audio?

A. The answer, no. but theoretically yes with defang. Dafang hacks may potentially let you, and does through the browser. But, the issue we have is that the plugin we are using here is a general all purpose RTSP feed plugin. It just doesn't have a way to feed information for 2 way audio. Way back, for the homebridge-dafang plugin, it was rumored that an update would be made to interface it. Basically, someone has to make a dedicated plugin for it and make it work within HomeKits very strict standards for 2 way audio.