Skip to content

Releases: ZanzoCam/zanzocam-core

Remove changes to hotspot flow and remove option to disable hotspot

20 Dec 18:01
4b977b9
Compare
Choose a tag to compare

This release nearly reverts all changes since 1.3.2, with minor modifications.


Built on top of zanzocam 1.3.2

Hashes for zanzocam_1.3.5.zip:

MD5: bbf34eb7471a53865849030721c250e4
SHA256: cb2acc76332555fa23fe5a31a613c9d50429958a18797e00955573d86d34a9d1

New process for the hotspot activation

07 Dec 11:58
Compare
Choose a tag to compare

Remove hotspot changes from 1.3.3, effectively reverting to 1.3.2. Remove hotspot allowed button and changed slightly the procedure to check for network connectivity before shooting a picture. Now having the hotspot active is a reason for zanzocam to standby and retry to connect after 5 minutes.


Built on top of the latest release of legacy RaspberryPi OS. With openvpn.

Hashes for zanzocam_1.3.4.img:

MD5: 31e0880642a4931961557ac2b6df3182
SHA256: 4292efc677133224a088e6b2185ca6d9aef2c90c589b97691eac5b86dd40dac4

Note: the current image is about 2.5GB zipped, so it needed to be split into smaller zip files. To unzip, run zip -s0 zanzocam.zip --out zanzocam_1.3.4.zip to recreate the original single archive. Then you can simply unzip zanzocam_1.3.4.zip.

Make the hotspot script re-run every 10 minutes unless the other devices are connected to the hotspot

08 Oct 18:06
a7fb144
Compare
Choose a tag to compare
Modified autohotspot script
#!/bin/bash
#version 0.961-N/HS

#You may share this script on the condition a reference to RaspberryConnect.com 
#must be included in copies or derivatives of this script. 

#A script to switch between a wifi network and a non internet routed Hotspot
#Works at startup or with a separate timer or manually without a reboot
#Other setup required find out more at
#http://www.raspberryconnect.com

wifidev="wlan0" #device name to use. Default is wlan0.
#use the command: iw dev ,to see wifi interface name 

IFSdef=$IFS
cnt=0
#These four lines capture the wifi networks the RPi is setup to use
wpassid=$(awk '/ssid="/{ print $0 }' /etc/wpa_supplicant/wpa_supplicant.conf | awk -F'ssid=' '{ print $2 }' | sed 's/\r//g'| awk 'BEGIN{ORS=","} {print}' | sed 's/\"/''/g' | sed 's/,$//')
IFS=","
ssids=($wpassid)
IFS=$IFSdef #reset back to defaults


#Note: If you only want to check for certain SSIDs
#Remove the # in in front of ssids=('mySSID1'.... below and put a # in front of all four lines above
# separated by a space, eg ('mySSID1' 'mySSID2')
#ssids=('mySSID1' 'mySSID2' 'mySSID3')

#Enter the Routers Mac Addresses for hidden SSIDs, separated by spaces ie 
#( '11:22:33:44:55:66' 'aa:bb:cc:dd:ee:ff' ) 
mac=()

ssidsmac=("${ssids[@]}" "${mac[@]}") #combines ssid and MAC for checking

createAdHocNetwork()
{
    echo "Creating Hotspot"
    ip link set dev "$wifidev" down
    ip a add 10.0.0.5/24 brd + dev "$wifidev"
    ip link set dev "$wifidev" up
    dhcpcd -k "$wifidev" >/dev/null 2>&1
    systemctl start dnsmasq
    systemctl start hostapd
}

KillHotspot()
{
    echo "Shutting Down Hotspot"
    ip link set dev "$wifidev" down
    systemctl stop hostapd
    systemctl stop dnsmasq
    ip addr flush dev "$wifidev"
    ip link set dev "$wifidev" up
    dhcpcd  -n "$wifidev" >/dev/null 2>&1
}

ChkWifiUp()
{
    echo "Checking WiFi connection ok"
    sleep 20 #give time for connection to be completed to router
    if ! wpa_cli -i "$wifidev" status | grep 'ip_address' >/dev/null 2>&1
    then #Failed to connect to wifi (check your wifi settings, password etc)
        echo 'WiFi failed to connect, falling back to Hotspot.'
        wpa_cli terminate "$wifidev" >/dev/null 2>&1
        createAdHocNetwork
    else
        echo "WiFi connection successful"
        stopTimerIfConnected # Call the function here after successful WiFi connection
    fi
}

stopTimerIfConnected()
{
    if wpa_cli -i "$wifidev" status | grep 'ip_address'
    then
        echo "WiFi connected, stopping autohotspot timer."
        systemctl stop autohotspot.timer
    fi
}

### Added function to check for connected devices
checkForConnectedDevices()
{
    # Check if any device is connected to the hotspot
    connectedDevices=$(iw dev "$wifidev" station dump | grep 'Station')
    if [ -n "$connectedDevices" ]; then
        echo "Device connected to hotspot. Stopping further actions."
        exit 0
    else
        echo "No devices connected to hotspot."
    fi
}

chksys()
{
    #After some system updates hostapd gets masked using Raspbian Buster, and above. This checks and fixes  
    #the issue and also checks dnsmasq is ok so the hotspot can be generated.
    #Check Hostapd is unmasked and disabled
    if systemctl -all list-unit-files hostapd.service | grep "hostapd.service masked" >/dev/null 2>&1 ;then
        systemctl unmask hostapd.service >/dev/null 2>&1
    fi
    if systemctl -all list-unit-files hostapd.service | grep "hostapd.service enabled" >/dev/null 2>&1 ;then
        systemctl disable hostapd.service >/dev/null 2>&1
        systemctl stop hostapd >/dev/null 2>&1
    fi
    #Check dnsmasq is disabled
    if systemctl -all list-unit-files dnsmasq.service | grep "dnsmasq.service masked" >/dev/null 2>&1 ;then
        systemctl unmask dnsmasq >/dev/null 2>&1
    fi
    if systemctl -all list-unit-files dnsmasq.service | grep "dnsmasq.service enabled" >/dev/null 2>&1 ;then
        systemctl disable dnsmasq >/dev/null 2>&1
        systemctl stop dnsmasq >/dev/null 2>&1
    fi
}

FindSSID()
{
    #Check to see what SSID's and MAC addresses are in range
    ssidChk=('NoSSid')
    i=0; j=0
    until [ $i -eq 1 ] #wait for wifi if busy, usb wifi is slower.
    do
        ssidreply=$((iw dev "$wifidev" scan ap-force | egrep "^BSS|SSID:") 2>&1) >/dev/null 2>&1 
        #echo "SSid's in range: " $ssidreply
        printf '%s\n' "${ssidreply[@]}"
        echo "Device Available Check try " $j
        if (($j >= 10)); then #if busy 10 times goto hotspot
                 echo "Device busy or unavailable 10 times, going to Hotspot"
                 ssidreply=""
                 i=1
        elif echo "$ssidreply" | grep "No such device (-19)" >/dev/null 2>&1; then
                echo "No Device Reported, try " $j
                NoDevice
        elif echo "$ssidreply" | grep "Network is down (-100)" >/dev/null 2>&1 ; then
                echo "Network Not available, trying again" $j
                j=$((j + 1))
                sleep 2
        elif echo "$ssidreply" | grep "Read-only file system (-30)" >/dev/null 2>&1 ; then
                echo "Temporary Read only file system, trying again"
                j=$((j + 1))
                sleep 2
        elif echo "$ssidreply" | grep "Invalid exchange (-52)" >/dev/null 2>&1 ; then
                echo "Temporary unavailable, trying again"
                j=$((j + 1))
                sleep 2
        elif echo "$ssidreply" | grep -v "resource busy (-16)"  >/dev/null 2>&1 ; then
                echo "Device Available, checking SSid Results"
                i=1
        else #see if device not busy in 2 seconds
                echo "Device unavailable checking again, try " $j
                j=$((j + 1))
                sleep 2
        fi
    done

    for ssid in "${ssidsmac[@]}"
    do
        if (echo "$ssidreply" | grep -F -- "$ssid") >/dev/null 2>&1
        then
            #Valid SSid found, passing to script
            echo "Valid SSID Detected, assessing WiFi status"
            ssidChk=$ssid
            return 0
        else
            #No Network found, NoSSid issued"
            echo "No SSID found, assessing WiFi status"
            ssidChk='NoSSid'
        fi
    done
}

NoDevice()
{
    #if no wifi device,ie usb wifi removed, activate wifi so when it is
    #reconnected wifi to a router will be available
    echo "No wifi device connected"
    wpa_supplicant -B -i "$wifidev" -c /etc/wpa_supplicant/wpa_supplicant.conf >/dev/null 2>&1
    exit 1
}

chksys

### Added check for connected devices before scanning for SSIDs
if systemctl status hostapd | grep "(running)" >/dev/null 2>&1; then
    checkForConnectedDevices
fi

FindSSID

#Create Hotspot or connect to valid wifi networks
if [ "$ssidChk" != "NoSSid" ] 
then
    if systemctl status hostapd | grep "(running)" >/dev/null 2>&1
    then #hotspot running and ssid in range
        KillHotspot
        echo "Hotspot Deactivated, Bringing Wifi Up"
        wpa_supplicant -B -i "$wifidev" -c /etc/wpa_supplicant/wpa_supplicant.conf >/dev/null 2>&1
        ChkWifiUp
    elif { wpa_cli -i "$wifidev" status | grep 'ip_address'; } >/dev/null 2>&1
    then #Already connected
        echo "WiFi already connected to a network"
        stopTimerIfConnected # Stop timer if already connected
    else #ssid exists and no hotspot running connect to wifi network
        echo "Connecting to the WiFi Network"
        wpa_supplicant -B -i "$wifidev" -c /etc/wpa_supplicant/wpa_supplicant.conf >/dev/null 2>&1
        ChkWifiUp
    fi
else #ssid or MAC address not in range
    if systemctl status hostapd | grep "(running)" >/dev/null 2>&1
    then
        echo "Hotspot already active"
    elif { wpa_cli status | grep "$wifidev"; } >/dev/null 2>&1
    then
        echo "Cleaning WiFi files and Activating Hotspot"
        wpa_cli terminate >/dev/null 2>&1
        ip addr flush "$wifidev"
        ip link set dev "$wifidev" down
        rm -r /var/run/wpa_supplicant >/dev/null 2>&1
        createAdHocNetwork
    else #No SSID, activating Hotspot
        createAdHocNetwork
    fi
fi

The image also has an altered autohotspot.service systemd unit:

[Unit]
Description=Automatically generates a hotspot when a valid SSID is not in range
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/autohotspot

And an additional autohotspot.timer systemd timer:

[Unit]
Description=Timer to automatically check and generate a hotspot every 10 minutes

[Timer]
OnBootSec=5min
OnUnitActiveSec=10min
Unit=autohotspot.service

[Install]
WantedBy=timers.target

Enable everything after modifying them:

sudo systemctl daemon-reload
sudo systemctl enable autohotspot.timer
sudo systemctl start autohotspot.timer

Make the random upload interval configurable

22 Jun 20:14
99b8fe7
Compare
Choose a tag to compare

Changelog:

  • The upper bound of the random waiting time before uploads (to avoid server congestion in weak servers) is now configurable from the Server page of the local web UI.

Built on top of zanzocam 1.3.1

Hashes for zanzocam_1.3.2.zip:

MD5: 23394a97179bfcf7b6378695a0ec1d55
SHA256: 362f3f14dc6176166da880335d7c7c26a402aa29bacaa2cee5e2ab1ee9bda158

Fix `wpa_supplicant.conf` bug

01 Jun 19:04
f731c2b
Compare
Choose a tag to compare

Changelog:

  • Verify the existence of wpa_supplicant.conf before trying to access it.

Built on top of zanzocam 1.3.0.

Hashes for zanzocam_1.3.1.zip:

MD5: aa94857571759fd63faed51b8e187e54
SHA256: 74c5ffd86e218d788afc85719397d9f96e5e4050d5f178a7dd6f663407865627

Local logs browser

04 May 21:03
8d19a5b
Compare
Choose a tag to compare

Changelog:

  • Logs will be stored locally and can be browser through a dedicated page in the local web UI
  • Log upload on the server can be disabled
  • WiFi information is now read directly from wpa_supplicant.conf instead of the temporary network information file
  • Passwordless wifi networks are now supported

Built on top of the latest release of legacy RaspberryPi OS, the buster based version (due to the lack of support for PiCamera on Bullseye). With openvpn.

Hashes for zanzocam_1.3.0.zip:

MD5: 5d601dda954e52b96e077c75e52f2a7a
SHA256: f5cd3afaa814577b8cdcb3722143c18658c66a9616a1dced48e6c1c4a5f4ab7d

Implement retries in case of failure

22 Jan 10:48
9e01862
Compare
Choose a tag to compare

Changelog:

  • After a failed network or camera operation, retry for a configurable amount of times before considering it a real failure.

Image built on top of zanzocam_1.1.0. A sudo apt-get full-upgrade was performed and openvpn was also installed.

Hashes for zanzocam_1.2.0.zip:

MD5: 7cd567e48f0989d1f8db5d8665624d3d
SHA256: fab320df573c337fc78488f3e0c3f16b3b80f992923a256d76a21a79572883f5

Fix issue with text padding

16 Jun 16:41
632b3b0
Compare
Choose a tag to compare

Changelog:

  • After changing the padding_ratio field to simply padding in 1.0, and expecting pixels instead of a percentage, an issue arose regarding the padding of text fields, which was seen changing in height if the text contained descending letters (like q, g, etc). This release fixes this issue.
  • Introduce "Clean Disk" function in the local web ui, to allow users to remove log files, overlays and other temporary files from the disk in case it starts to get full.

Image built on top of zanzocam_1.0.0.

Hashes for zanzocam_1.1.0.zip:

MD5: 16ce81ef4bda136f9a404493313639d2
SHA256: 56ac8c15ecc3298b6cdbe1ca162af8952381adf390f0583f0e6343f7cb482a58

First major release

10 Jun 20:53
7c50fba
Compare
Choose a tag to compare

First major release of zanzocam-core. This is the version that will be first deployed in the first batch of huts.

This version supports FTP and HTTP servers, although the deployed machines will use mostly FTP. Supports only WiFI for their network access. Is based on a vanilla Raspberry Pi OS with minor customization (few extra packages and config files).

All interfaces of version 1.0.0 are in Italian, English translation to come soon.

Changelog:

  • zanzocam is now an isolated Python package, separate from the remote control panel. Overall structure is greatly simplified as a result.
  • The attached zip file now contains only the disk image, no more the remote control panel. Get the remote control panel here.
    • NOTE: Choose a remote control panel package with a release number corresponding to your ZanzoCam image version up to the second number.
  • The image padding is intended to be in pixels, no more as a percentage of the image size.
  • GPU memory slightly reduced to 224MB to save some more memory for the CPU.
  • Add Back buttons to most of the Web UI pages.
  • Add autodocs (https://zanzocam.github.io/zanzocam-core/) and Improved docstrings.
  • Remove "Turn off the control panel" button on the Web UI.
  • Revision of the various defaults.

Known issues:

  • Too large overlays might cause the process to abort due to shortage of RAM. If you observe issues with your ZanzoCam and you're shooting images at 12MP with overlays, try removing the overlays to see if that temporarily fixes the issue, then report it.

Image built on top of zanzocam_0.10.1.

Hashes for zanzocam_1.0.0.zip:

MD5: 8a6a601920154640a67f71ae02dc1813
SHA256: 9b4e04a97194fb4c956805a5ed3683910a9528a4010c27679b25bbf32965bc4b

Fixed HQ camera bug

30 May 15:00
fd22874
Compare
Choose a tag to compare

Changelog:

  • Fixed bug preventing HQ camera to shoot night pictures at a resolution above 6K
  • Fix the defaults on the remote control panel
  • Add a "Turn off the web UI" button in the web UI.