Wyze Camera to OH Sitemap/NVR/etc. Hack

I stumbled upon a hacky way to get Wyze camera feeds (video only) into openHAB. It’s an MJPEG stream so it should work with the IPCamera binding as well and I can confirm that it works with NVRs too (I was using Shinobi, looking for something else since they closed down even their community forum resulting in no support for the community edition, not even user to user support so I have to pay $75 a month to ask a question, and they added a nag screen that pops up every week; maybe TinyCam Pro itself can be the replacement).

And the big thing here is that it uses the stock Wyze camera firmware so you don’t have to move to their barely supported RTSP firmware and lose their cloud service and capabilities.

But be forewarned. It’s a hack.

Prerequisites

  • A spare Android phone or tablet or the ability to set up an Android emulator or otherwise run Android apps on your server machine.
  • TinyCam Pro ($4 on the Play store)
  • Static IP address assigned to the phone/tablet
  • One or more Wyze cameras set up and configured using the Wyze app

Limitations

  • 1 FPS
  • No audio
  • You have to keep the phone/tablet always on and running the TinyCam Pro app.

Configure TinyCam

  • Install the app. Add a new “IP camera, NVR/DVR”. If you don’t already have that option at the bottom right, select the “hamburger” menu at the top right and select “Manage Cameras”.
  • First change the “Camera Brand” to Wyze.
  • Change the Camera Name to something meaningful.
  • Change the Camera model if necessary.
  • Enter your Wyze account username and password.
  • If you have more than one camera, tap “Advanced settings” and change the Channel number to the number of the camera you want. Unfortunately I couldn’t figure out how to tell what number each camera is so you will have to use trial and error. I also noticed that when you add a new camera, the numbers might change.
  • Return to the “Live View” and verify the camera stream is working. It will take a few seconds for the feeds to start.
  • Return to the “hamburger menu” and near the bottom turn on “Power safe mode” and “Web server”. Take note of the URL displayed at the bottom.
  • Tap “Settings” and scroll down to “Web server”. Make any changes desired. I recommend changing the admin Username and Password.

You can play around with the rest of the TinyCam settings. It is itself an NVR so you can configure it to save videos on motion, trigger things to happen on motion events, Tasker integration, etc. There is supposed to be a way to set up webhooks to trigger on Motion detection but I couldn’t figure them out. But you could do the same with Tasker to get motion events into openHAB, for example. It can save the videos to a cloud account or an FTP server so it could be a good choice over Shinobi, Zoneminder, or BlueIris if you happen to have an old phone or tablet hanging around. But it’s not going to be able to handle that many streams at the same time.

Putting a Feed on Your Sitemap

The Web server built into TinyCam Pro is not well documented. Luckily I found the following posting on the ActionsTiles forum: https://support.actiontiles.com/communities/12/topics/3441-tinycam-pro-android-app-web-server-stream-rtsp-and-wyze-cam-to-actiontiles. Apparently it’s partially compatible with the Axis camera’s API. https://www.axis.com/files/manuals/HTTP_API_VAPIX_2.pdf, but based on my experiments, only the MJPEG and JPEG endpoints, not the RTSP or ONVIF endpoints.

See that link for the full capabilities the API provides. I’m only going to show how to put the feed on your sitemap. I assume the same MJPEG URL will work for the IP Camera binding.

  • Take note of the URL that was displayed at the bottom of the app in settings after you’ve made all the changes desired to the web server settings.

  • On your sitemap use a Video element with the following URL:

    http<s>://<ipaddress of tablet>:<port>/axis-cgi/mjpg/video.cgi?user=<username>&pwd=<password>&camera=<num>

where https is used if you enabled HTTPS in the app, <ipaddress of tablet> is the IP address or hostname of the machine running TinyCam Pro, <port> is the port of the TinyCam Web server (8083 is the default), <username> is the guest or admin user name and <password> is the corresponding password. Finally, <num> is the camera feed. I believe the feeds are in the order they are listed in the “Manage Cameras” screen.

  • You might need to use the encoding=mjpegfor in the sitemap.
    Video url="http://192.168.1.123:8083/axis-cgi/mjpg/video.cgi?user=foo&pwd=bar&camera=1" encoding=mjpeg
  • I actually recommend using the JPEG end point on your sitemap instead. This will work better through myopenhab.org and require fewer resources in your browser and the myopenhab.org servers.
    Image url="http://192.168.1.123:8083/axis-cgi/jpg/image.cgi?user=foo&pwd=bar&camera=1" refresh="5000"

Conclusions

I’m reasonably satisfied with the results. It seems to keep up with at least three cameras quite well. I can see the feeds when accessing myopenhab.org without overloading the server, and it allows me to keep the stock firmware on the cameras themselves. And there are lots of options for integration with openHAB or other services.

But as you can see it’s somewhat of a hack. You can’t get better than 1 FPS from TinyCam Pro and it requires a separate server running on Android. But, maybe you are like me and have a tablet you can run TinyCam Pro on and use as a camera monitor as well.

1 Like

I found that the syntax for the Image url was incorrect regarding the refresh="5000" part - the sitemap syntax expects no quotes around the time in milliseconds. I imagine the quotes are signifying a string and it expects an integer. Thank you for this “hack” :slight_smile: