Skip to content

Configuration File

gtxaspec edited this page Apr 9, 2024 · 20 revisions

Edit the file wz_mini.conf using linux ONLY. Do not edit on Windows unless you use an appropriate editor.

Located at /opt/wz_mini/wz_mini.conf, wz_mini loads the configuration variables when the camera boots. You can change the hostname of the camera, add a path to a script to mount NFS, add ping commands, anything you like.

From the command prompt via ssh or serial console, you may type wz_mini_edit.sh to edit the file directly.


Wireguard

Support is available as a kernel module

ENABLE_WIREGUARD="true"

Use the command wg to setup. See https://www.wireguard.com/quickstart/ for more info.

Some users have asked about tailscale support, I have tested and it works. See the issue #30 for further information.

Example setup:

ENABLE_WIREGUARD="true"
WIREGUARD_IPV4="192.168.2.101/32"
WIREGUARD_PEER_ENDPOINT="x.x.x.x:51820"
WIREGUARD_PEER_PUBLIC_KEY="INSERT_PEER_PUBLIC_KEY_HERE"
WIREGUARD_PEER_ALLOWED_IPS="192.168.2.0/24"
WIREGUARD_PEER_KEEP_ALIVE="25"

To retrieve the public key that you'll need to add the peer to your wireguard endpoint:

  1. Use SSH to log in
  2. wg

Disable automatic firmware updates

DISABLE_FW_UPGRADE="true"

If a remote or app update is initiated, the camera will reboot due to the failure of the update. The firmware update should not proceed again for some time, or at all.

When a firmware update is initiated, due to a bootloader issue (bug?), we intercept the update process and flash it manually. This should now result in a successful update, if it doesn't, please restore the unit's firmware manually using demo_wcv3.bin on the micro sd card.


USB Ethernet Adapter

ENABLE_USB_ETH="true"
ENABLE_USB_ETH_MODULE_AUTODETECT="true"
ENABLE_USB_ETH_MODULE_MANUAL=""

To have the Ethernet NIC be auto-detected and loaded automatically, set the ENABLE_USB_ETH_MODULE_AUTODETECT value to true.

To load a specific USB Ethernet NIC driver, set ENABLE_USB_ETH_MODULE_MANUAL to one of the following: asix, ax88179_178a, cdc_ether, r8152

NOTE: There is a possibility of a conflict between Ethernet NIC adapters that report themselves as PCI ID '0bda:8152'. (Realtek 8152 and CDC Ethernet) Since the 8152 is Realtek's product, that driver will be the one used for products that report that PCI ID. If you happen to have a CDC Ethernet product that uses that specific PCI ID, please set ENABLE_USB_ETH_MODULE_AUTODETECT="false" and set ENABLE_USB_ETH_MODULE_MANUAL="cdc_ether"

The next time you boot your camera, make sure your USB Ethernet Adapter is connected to the camera and ethernet. The camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed, as long as you are using the USB Ethernet Adapter. Note that using USB Ethernet disables the onboard Wi-Fi.

NOTE: The micro USB port on the Cam V2 is power only. You will need to use an Ethernet adapter that uses a full size USB A connector.


Network Interface Bonding

BONDING_ENABLED="false"
BONDING_PRIMARY_INTERFACE="eth0"
BONDING_SECONDARY_INTERFACE="wlan0"
BONDING_LINK_MONITORING_FREQ_MS="100"
BONDING_DOWN_DELAY_MS="5000"
BONDING_UP_DELAY_MS="5000"

Bonding description is best described here: https://wiki.debian.org/Bonding#Configuration_-_Example_2_.28.22Laptop-Mode.22.29:

("Laptop-Mode")

Tie cable and wireless network interfaces (RJ45/WLAN) together to define a single, virtual (i.e. bonding) network interface (e.g. bond0). As long as the network cable is connected, its interface (e.g. eth0) is used for the network traffic. If you pull the RJ45-plug, ifenslave switches over to the wireless interface (e.g. wlan0) transparently, without any loss of network packages. After reconnecting the network cable, ifenslave switches back to eth0 ("failover mode"). From the outside (=network) view it doesn't matter which interface is active. The bonding device presents its own software-defined (i.e. virtual) MAC address, different from the hardware defined MACs of eth0 or wlan0. The dhcp server will use this MAC to assign an ip address to the bond0 device. So the computer has one unique ip address under which it can be identified. Without bonding each interface would have its own ip address. Currenly supported with ethernet adapters and usb-direct mode.

BONDING_PRIMARY_INTERFACE Specifies the interface that should be the primary. Typically "eth0".

BONDING_SECONDARY_INTERFACE Specifies the interface that should be the secondary. Typically "wlan0".

BONDING_LINK_MONITORING_FREQ_MS Specifies the MII link monitoring frequency in milliseconds. This determines how often the link state of each slave is inspected for link failures.

BONDING_DOWN_DELAY_MS Specifies the time, in milliseconds, to wait before disabling a slave after a link failure has been detected. This option is only valid for the miimon link monitor. The downdelay value should be a multiple of the miimon value; if not, it will be rounded down to the nearest multiple.

BONDING_UP_DELAY_MS Specifies the time, in milliseconds, to wait before enabling a slave after a link recovery has been detected. This option is only valid for the miimon link monitor. The updelay value should be a multiple of the miimon value; if not, it will be rounded down to the nearest multiple.


USB Direct

ENABLE_USB_DIRECT="true"

the next time you boot your camera, make sure your USB cable is connected to the router. Remember, the camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed. Note that using USB Direct disables the onboard Wi-Fi. Change the MAC Address if you desire via USB_DIRECT_MAC_ADDR variable.

Connectivity is supported using a direct USB connection only... this means a single cable from the camera, to a supported host (An OpenWRT router, for example) that supports the usb-cdc-ncm specification. (NCM, not ECM) If you have an OpenWrt based router, install the kmod-usb-net-cdc-ncm package. The camera should automatically pull the IP from the router with most configurations. You can also use any modern linux distro to provide internet to the camera, provided it supports CDC_NCM. enjoy!

Note: In my testing, the micro-usb cables included with the various cameras do not pass data, so they will not work. Make sure you have a micro-usb cable that passes data!


Remote Accessories

When USB Direct connectivity is enabled, the camera will be unable to communicate with accessories. To enable remote usb accessory support, enable the following variable and set the IP Address of the host as follows:

Scenario: Spotlight accessory needs to be located away from the camera, yet we desire spotlight control from within the app and camera. Plug the Spotlight into the nearby router running linux. Configure variables as below on camera, and run socat on the router. The app will now detect the spotlight accessory, just as if it was plugged in to the camera directly!

REMOTE_SPOTLIGHT="true"
REMOTE_SPOTLIGHT_HOST="0.0.0.0"

Then, run the following command on the host where the spotlight is attached to:

socat TCP4-LISTEN:9000,reuseaddr,fork /dev/ttyUSB0,raw,echo=0

Change /dev/ttyUSB0 to whatever path your accessory enumerated to if necessary. The camera will now be able to control the usb accessory.


USB Mass Storage Support

ENABLE_USB_STORAGE="true"

If you would like to mount an EXT3/4 filesystem make sure to enable ext4 support:

ENABLE_EXT4="true"

CIFA / Samba

ENABLE_CIFS="true"

iptables

ipv4 and ipv6 available

ENABLE_IPTABLES="true"

NFSv4

ENABLE_NFSv4="true"

Video Settings

You can configure the following settings that will apply to the video streams:

VIDEO_0_MAX_BITRATE=""
VIDEO_0_TARGET_BITRATE=""
VIDEO_0_ENC_PARAMETER=""
VIDEO_0_FPS=""

VIDEO_0 = 1080p stream
VIDEO_1 = 360p stream

  • Higher video bitrates may overload your Wi-Fi connection, so a wired connection is recommended.
  • Setting the FPS is not required unless you want to change the default device settings (20 day/15 night FPS for V3, 15 day/10 night FPS for V2). V3 Supports up to 30FPS.
  • ENC_PARAMETER accepts numbers only:
    T20: 1=CBR, 2=VBR, 3=SMART, 4=FIXQP (Currently only 1, 2, and 3 are working)
    T31: 0=FIXQP, 1=CBR, 2=VBR, 4=CAPPED VBR, 8=CAPPED QUALITY. (Currently only 2, 4, and 8 are working)
  • These settings apply to the video streams displayed in the app, and to RTSP streams, which includes v4l2rtspserver and go2rtc

v4l2rtspserver

(NOTE: Don't enable both v4l2rtspserver and go2rtc. Only one can be enabled at a time.)

v4l2rtspserver supports the two video streams provided by the camera, 1080p/360p (1296p/480p for the DB3 [Door Bell]).

You can choose to enable a single stream of your choice (HI or LOW), or both. Audio is also available. If you do not have RTSP_AUTH_DISABLE="true" MAKE SURE TO SET your login credentials!

NOTES

  • V2 and V3 endpoints are not the same!
RTSP_LOGIN="admin"
RTSP_PASSWORD=""
RTSP_PORT="8554"

RTSP_HI_RES_ENABLED="true"
RTSP_HI_RES_ENABLE_AUDIO="true"

RTSP_LOW_RES_ENABLED="false"
RTSP_LOW_RES_ENABLE_AUDIO="false"

RTSP_AUTH_DISABLE="false"

Single Stream

the singular stream will be located at rtsp://login:password@IP_ADDRESS:8554/unicast

Multiple Streams

multiple streams are located at

  • V3 - rtsp://login:password@IP_ADDRESS:8554/video1_unicast and rtsp://login:password@IP_ADDRESS:8554/video2_unicast
  • V2 - rtsp://login:password@IP_ADDRESS:8554/video6_unicast and rtsp://login:password@IP_ADDRESS:8554/video7_unicast

You may disable authentication by setting RTSP_AUTH_DISABLE="true"

Note: If you don't set the password, the password will be set to the unique MAC address of the camera, in all uppercase, including the colons... for example:. AA:BB:CC:00:11:22. It's typically printed on the camera.

Huge credit to @mnakada for his libcallback library: https://github.com/mnakada/atomcam_tools


go2rtc streaming server

(NOTE: Don't enable both v4l2rtspserver and go2rtc. Only one can be enabled at a time.)

This is the preferred rtsp server.

go2rtc streaming server by @AlexxIT. Thank You!

GO2RTC_SERVER_ENABLED="true"
GO2RTC_HI_RES_ENABLED="true"
GO2RTC_HI_RES_ENABLE_AUDIO="true"
GO2RTC_LOW_RES_ENABLED="true"
GO2RTC_LOW_RES_ENABLE_AUDIO="true"

go2rtc supports:

  • WebRTC
  • HLS
  • RTMP
  • RTSP [frigate supported]
  • MP4 Streaming
  • Web Torrent
  • Password Authentication
  • and more

*Supported audio: libopus & aac

See https://github.com/AlexxIT/go2rtc for details on how to configure. Config file is located at /opt/wz_mini/etc/go2rtc.yml

go2rtc WebUI is located at http://<camera_ip>:1984


mp4_write

ENABLE_MP4_WRITE="true"

Forces the camera to skip writing files to /tmp, and write them directly to your storage medium or network mount, prevents trashing. Normally videos are written to /tmp then moved using mv, which can overload camera and or remote network connections. Useful for NFS/CIFS remote video storage.


USB Video Class (UVC) Web Camera

Use as a WebCam for your PC is supported. I have tested with Windows 10, Linux, and Android TV, and it appears as a Generic HD Camera. Audio is supported. This mode disables all other functionality, and only works as a USB Web Camera for your PC. Experimental. Note that the cables typically included with the camera do not data, use a known working micro-usb cable which supports data.

Supported modes: MJPG,Video 360p/720p/1080p

WEB_CAM_ENABLE="true"
WEB_CAM_BIT_RATE="8000"
WEB_CAM_FPS_RATE="25"

Run a custom script

CUSTOM_SCRIPT_PATH=""

Note: any executable files placed in /opt/wz_mini/etc/rc.local.d will be automatically run at boot time, irregardless of the custom script variable specified in the configuration.


RTMP Streaming

RTMP_STREAM_ENABLED="true"
RTMP_STREAM_FEED="video1_unicast"
RTMP_STREAM_SERVICE="youtube"
RTMP_STREAM_DISABLE_AUDIO="false"
RTMP_STREAM_YOUTUBE_KEY="xxx-xxx-xxx-xxx"
RTMP_STREAM_TWITCH_KEY=""
RTMP_STREAM_FACEBOOK_KEY=""

Live stream DIRECTLY from the camera's local RTSP server to: youtube / twitch / facebook live. Audio must be enabled in the RTSP section of the configuration for this to work.

Edit the ingest URLs and additional parameters in the /opt/wz_mini/bin/rtmp-stream.sh script.


Disable Night Vision FPS Drop

NIGHT_DROP_DISABLE="true"

Stop the camera from dropping the frame rate during nightvision.


WiFi Drivers

Disable only if you know what you are doing.

ENABLE_RTL8189FS_DRIVER="true"
ENABLE_ATBM603X_DRIVER="true"

Enabled by default. These options control the WiFi Drivers. V2/V3 use the 8189fs.ko driver, and certain v3 models and all currently shipping pan v2 models use the atbm603x driver. These are required for operation of wz_mini, and disabling these will lead to a system crash, due to an updated kernel. This change was required to support full iptables and connection tracking operation, since they are not supported on the really outdated factory drivers. My testing shows better stability and performance.


Disable Motor Controls

DISABLE_MOTOR="true"

Disable the movement capability on motorized devices. You will no longer be able to move the device from the mobile app, or command line. Best used to convert a motorized unit to fixed


File System Check/Repair

ENABLE_FSCK_ON_BOOT="true"

run fsck.vfat on boot. This runs fsck.vfat, the FAT disk repair utility on the micro sd card, automatically repairing most issues, including corruption. Increases boot time. During the repair process, the LEDs on the camera will flash RED-off-BLUE-off-PURPLE-off to inform the user the repair program is running. Once the program has completed, the LED will switch to RED, resuming the normal boot process.


Car Driver

ENABLE_CAR_DRIVER="true"

Loads the appropriate driver for the car to function. On devices other than a V2 with the car firmware, the car may be controlled via car_control.sh on the command line. experimental!

car_control.sh defaults to high speed car_control.sh low_speed low speed car_control constant direction is constant, car keeps moving the direction you select without holding down any keys. car_control.sh constant low_speed like above, but in low speed


Local DNS resolver

May fix DNS Flooding

ENABLE_LOCAL_DNS="true"

Enables dnsmasq, a lightweight, local, caching DNS server on the camera. Fixes potential DNS flooding on the local network. Upstream DNS servers may be specified in /opt/wz_mini/etc/resolv.dnsmasq


Web Server

WEB_SERVER_ENABLED="true"
WEB_SERVER_AUTH="true"
WEB_SERVER_LOGIN="admin"
WEB_SERVER_PASSWORD=""

Enables the local webserver, for configuration, car control, or to retreive an image snapshot via a web browser. Available at : http://<Camera IP>/ Thank you @virmaior! Similar to the RTSP default password, if you don't set the password, the password will be set to the unique MAC address of the camera, in all uppercase, including the colons. If you do not want to have an authentication prompt for the local webserver, set WEB_SERVER_AUTH to false.

WEB_SERVER_OPTIONS="cam config car jpeg"

This adds access controls limiting which parts of the web server are exposed.

  • cam = cam.cgi
  • config = config.cgi
  • car = car.sh
  • jpeg = jpeg.cgi

SYSLOG

ENABLE_SYSLOG_SAVE="true"

Save the syslog to the logs/ directory


Cron

ENABLE_CRONTAB="true"

Enable crontab. Located at /opt/wz_mini/etc/cron/root


Self-Hosted / Isolated Mode

ENABLE_SELFHOSTED_MODE="true"

When enabled, the iCamera program will be patched to work nicely in a self-hosted environment. This can be reverted by setting the value to false and rebooting. Intended for advanced users only! Do not enable if you use the Wyze App. Disabled by default.

Normally, the firmware will restart the network interface periodically when it is unable to reach Wyze's servers which results in intermittent network drops. For advanced users that intend to run the Wyze Cam without internet access or on a controlled network, this option will patch the iCamera process to function without the Wyze servers.

Feature supported on:

  • Wyze Cam v3 firmware: 4.36.9.139, 4.61.0.1
  • Wyze Cam v2 firmware: 4.9.8.1002

File Server

ENABLE_FILESERVER="false"

Enable the dufs fileserver, see Transferring Files