Mainsail (Klipper) - themactep/thingino-firmware GitHub Wiki

Background

This process has been tested with Wyze V2 running Thingino build master+0a66547 (2025-05-08), with go2rtc v1.9.9, and Mainsail v2.14.0.

Mainsail provides several options for integration of camera feeds. The primary is Crowsnest, a service typically deployed alongside Mainsail to expose/restream directly-connected (i.e. USB or serial) cameras. Despite theoretical support for use of RTSP streams, testing has not proven Crowsnest able to utilize an RTSP feed from Thingino (or likely any other) cameras for integration.

The second is a series of camera services exposed through the Webcam frontend interface in Mainsail. Some of those (such as MJPG-STREAMER) allow the ingest of an MJPG feed, like that exposed through Thingino. However, performance on this service is extremely poor, and subject to frequent disconnects should no RTSP consumers connect to the camera (causing the camera to go to sleep).

This guide provides direction on setting up the current best option, being integration with the WebRTC (go2rtc) service. This provides acceptable framerates and resolution, alongside a stable feed to the camera.

Prerequisites

  • Thingino flashed to Wyze v2
  • A static IP / DHCP reservation on your router for the camera
  • Text editor that allows for changing the line-endings format. If you are on Windows, use Notepad++ to edit/save files. If you are on macOS, use BBEdit. The two important things either way are that the file extension is proper for each saved file, and that your line endings are set to Unix/LF, as Windows line endings tend to screw up scripts/config files saved for use on Linux. If you're comfortable with CLI, and are using Linux or macOS, just use nano or vim and you should be good 🙂
  • A running Mainsail instance that can reach your camera's IP address.

Instructions

  1. Load go2rtc on the Thingino camera. This largely follows the Thingino guide, but with changes to the go2rtc.yaml file. Full instructions listed below:
#!/bin/sh
/mnt/mmcblk0p1/go2rtc_linux_mipsel -c /mnt/mmcblk0p1/go2rtc.yaml -d
  • Put go2rtc.yaml into root of SD card, with the below contents (make sure to use an editor like Notepad++ (https://notepad-plus-plus.org), and ensure your line endings are set to Unix (LF). Also ensure your filename is saved as a .yaml file, and not something like .yaml.txt. ):
api:
  origin: "*"

streams:
  ch0:
    - rtsp://thingino:[email protected]/ch0#timeout=30
  ch1:
    - rtsp://thingino:[email protected]/ch1#timeout=30

webrtc:
  candidates:
    - stun:8555

(two notes here: 1) I removed the API user/pass. These are already being transmitted in the clear via HTTP, so I see almost no value in adding complexity, and cleartext user/pass is in some ways worse by potentially providing plaintext creds to an attacker sniffing network traffic. If there was an easy way to do HTTPS and migrate creds to headers I'd probably add back in. But I'm fine with not having them in the meantime. 2) I added origin: "*" to the api section. Without it, a request from a host that is not the camera itself (i.e. Mainsail) will be denied. There's certainly a safer way to accomplish this, but I accepted the tradeoff given this whole setup is already not great on security). It should be said, be sure your camera is not reachable outside of your private network!

  • Check that you have the following files in the root of your SD card (it's okay if there are others, as long as you have at least these files):
go2rtc_linux_mipsel
run.sh
go2rtc.yaml
  • Put SD back in camera, and power it back on
  1. Verify that go2rtc is running properly by browsing to: http://[camera IP]:1984/.

  2. Add a new Webcam in Mainsail, with whatever name you choose, and the below configuration:

    Service: WebRTC (go2rtc) URL Stream: http://[camera IP]:1984/stream.html?src=ch0 URL Snapshot: http://thingino:thingino@[camera IP]/image.jpg

  3. Verify upon addition that the camera feed displays properly in Mainsail (it may take a moment for the feed to display).

Troubleshooting

  • make sure you still include your Thingino creds in the URL snapshot. That's not coming from go2rtc. Probably could just use the frame.jpeg URL, but I chose to just use the Thingino one. Just laziness at this point causing me not to change it.
  • You can access go2rtc's web interface at http://[webcam IP]:1984. When there, one super useful thing to keep an eye on is the Log section at the top menu. When you pop open Mainsail, you can look there to see if there are any errors. That's how I was able to identify the CORS configuration issue and add the origin override to the go2rtc config.
  • Should you encounter lag or drops, it may be worth lowering the feed resolution in Thingino. I have noticed occasional drops for some reason, usually it takes much longer than 5min for these drops when it actually gets going. Two things you could try are rebooting your camera, as well as adjusting down your resolution a bit. Make sure you’ve got a good connection between your pi/mainsail system, the cam, and your access point. Ideally things are hardwired but that’s not always that easy to do.