1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-02 12:43:02 +02:00

Fixes "sh: bad number" in detectionOn.sh #1777 (#1813)

* Squashed commit of the following:

commit 0cde105a1b
Author: Aaron Carson <aaron@aaroncarson.co.uk>
Date:   Sun Dec 5 16:25:16 2021 +0000

    Update WyzeCam v1.2 `sha3sum -a 256` (#1791)

commit f1cf7dad8b
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Sun Oct 24 09:57:50 2021 +0100

    Merge beta into master (#1786)

commit d2fa6d7aac
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Sun Oct 24 07:57:17 2021 +0100

    Change Telegram ico (#1785)

commit b6a93e9cf5
Author: Stephan Fuchs <sfuchs@fastmail.com>
Date:   Mon Jun 21 18:50:37 2021 +0800

    Added clarification for LOCATION and DEVICE_NAME (#1747)

commit adbaffb038
Author: Nicholas FitzRoy-Dale <nicholas.github@fitzroydale.org>
Date:   Sat May 22 17:33:17 2021 +0100

    install_cfw: update Wyzecam V2 firmware version (#1735)

commit 62c8990caa
Author: fhl206 <fhl206@gmail.com>
Date:   Mon May 17 03:56:08 2021 +0100

    Update install_cwf_t20l.md (#1734)

commit c33bb63a61
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Tue May 11 15:11:35 2021 +0200

    Update README.md

commit c15370910b
Merge: a4a8bdc 90076db
Author: Julian Tatsch <julian@tatsch.it>
Date:   Tue May 11 06:23:18 2021 +0200

    Merge branch 'master' into beta

commit 90076db303
Author: McNutnut <mcnutnut90@gmail.com>
Date:   Mon May 10 21:19:16 2021 -0700

    Updated cfw for newest wyzev2 (#1729)

commit 1090a1f626
Author: Will Freeman <github@inwr.com>
Date:   Thu Apr 29 09:14:39 2021 -0600

    Root CA updates and more cron fixes (#1726)

    * Fix source of missing cron directories

    At some point, the root crontab was added to the git source, but the
    original script that added them was not updated to reflect.

    * Update root ca and updater

commit 799c2a4b70
Author: Will Freeman <github@inwr.com>
Date:   Tue Apr 27 08:35:00 2021 -0600

    Letsencrypt fix path (#1725)

commit 6bfe58ed54
Author: Will Freeman <github@inwr.com>
Date:   Mon Apr 26 20:20:59 2021 -0600

    Fix missing directory structure on letsencrypt (#1724)

commit 1de5ae1636
Author: maxemoose <maxemoose@users.noreply.github.com>
Date:   Thu Apr 22 17:59:23 2021 +0100

    Fix update w3.css (#1721)

    The previous PR I submitted was supposed to make the footer object stick to the bottom of the page but it did not work. This was because I missed a comma when adding the relevant changes.

    This PR changes one comma in w3.css to a semi-colon, fixing the desired footer behaviour.

commit 0ded51606e
Author: Ian <ian@apocrathia.com>
Date:   Thu Apr 22 10:58:15 2021 -0600

    Typo fix (#1723)

    I know this is stupid but it was annoying me.

commit a4a8bdc6d6
Author: Joey Babcock <joeybab3@users.noreply.github.com>
Date:   Tue Apr 20 20:05:28 2021 -0700

    Fix small typo in OSD save log (#1722)

commit 3935ddfd50
Author: Nazim-ua <38263368+Nazim-ua@users.noreply.github.com>
Date:   Tue Apr 13 22:36:05 2021 +0300

    Fix: waiting for all background jobs to finish before send snapshot (#1720)

commit 116c1ad53d
Author: psallandre <psallandre@gmail.com>
Date:   Tue Mar 23 13:11:43 2021 +0100

    Fix wifi (re)connection when available SSID is not the first one in wpa_supplicant.conf (#1717)

commit 7aa86b916f
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Sun Mar 21 19:06:38 2021 +0000

    Add web server control script (#1714)

commit 90b8a89a4d
Author: maxemoose <maxemoose@users.noreply.github.com>
Date:   Sun Mar 21 12:40:40 2021 +0000

    Update w3.css (#1713)

    Make html, body & w3-auto elements 100% height. Add flex and flex direction to w3-auto. Make the content element grow to fill available space.

commit a163f4456d
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Sun Mar 21 08:09:52 2021 +0000

    SSH Control script (#1711)

commit 55a85cca64
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Fri Mar 19 11:24:16 2021 +0000

    Remove audio and convert to mp4 so videos play in Telegram app (#1709)

commit 00ffa10af5
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Mon Mar 15 18:31:26 2021 +0000

    Add LD_LIBRARY_PATH to .profile (#1704)

    * Add sdcard libs to LD_LIBRARY_PATH

    Add sdcard libs to LD_LIBRARY_PATH

    * Update .profile

    fix typo

    Co-authored-by: jmtatsch <jmtatsch@users.noreply.github.com>

commit f7c4a0ef49
Merge: fbb903d bae6374
Author: Julian Tatsch <julian@tatsch.it>
Date:   Sat Mar 13 20:13:59 2021 +0100

    Merge branch 'master' into beta

commit fbb903d608
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Sat Mar 13 14:43:59 2021 +0000

    Fix changing dropbox folders (#1705)

commit 4a2af3a87e
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Fri Mar 12 13:27:37 2021 +0000

    Add dropbox uploads on motion detection (#1703)

commit bae6374a42
Author: yerlandinata <yudhistira.erlandinata@ui.ac.id>
Date:   Tue Mar 9 02:54:02 2021 +0700

    Fix controlscripts/rtsp (#1701)

    - stopping rtsp will stop its dependents properly

commit 74575379b0
Author: Fietspomp86 <senne_baars@hotmail.com>
Date:   Mon Mar 8 20:52:23 2021 +0100

    Update mqtt-autodiscovery.sh (#1700)

    Replaced value_template with position_template, for Home Assistant 2021.3.x and newer

commit 5ef8548434
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Mon Mar 8 09:26:34 2021 +0000

    Refactor dtectionOn.sh (#1698)

commit 1e393e1bd5
Author: aque0us <barronpdonovan@gmail.com>
Date:   Mon Mar 8 04:25:38 2021 -0500

    Update install_cfw.md (#1673)

commit 8065bd58b5
Author: Julian Tatsch <julian@tatsch.it>
Date:   Mon Mar 8 10:16:34 2021 +0100

    Added nano binary

commit d79a153e99
Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com>
Date:   Sun Mar 7 17:16:03 2021 +0000

    SSH management panel (#1692)

    * SSH management panel - initial commit

    * Add ssh.conf.dist

    * Tweaks

    * Update firmware_mod/www/cgi-bin/ui_system.cgi

    Co-authored-by: fhl206 <fhl206@gmail.com>

    * Add configure SSH pub key to web ui

    * Tweak wording

    * Change logic for SSH paasword

    Co-authored-by: fhl206 <fhl206@gmail.com>

commit 972ba9d5cf
Author: Matthias Pfefferle <pfefferle@users.noreply.github.com>
Date:   Fri Feb 26 05:55:03 2021 +0100

    the bot should only answer to commands that starts with "/" (#1664)

    If a bot is in a group it can be very noisy otherwise.

commit 174b2d56a1
Author: Chris Knight <cdk-github@accessoft.org>
Date:   Thu Feb 25 20:54:24 2021 -0800

    fix #1674 - typo in ui_motion.cgi (#1676)

    Co-authored-by: Chris Knight <cdknight@hotcat.org>

commit 0b6a19ae4e
Author: Chris Knight <cdk-github@accessoft.org>
Date:   Thu Feb 11 20:55:24 2021 -0800

    typo fix (#1685)

commit e5520d0bcd
Author: fhl206 <fhl206@gmail.com>
Date:   Wed Feb 10 02:44:51 2021 +0000

    Update technical.md (#1683)

commit fe18a97e94
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Fri Jan 1 15:24:11 2021 +0100

    Update motion.html

    fix typo

commit 67794f2867
Merge: 5fc16fb 7d2eeba
Author: Julian Tatsch <julian@tatsch.it>
Date:   Sun Dec 27 11:12:08 2020 +0100

    Merge branch 'master' into beta

commit 5fc16fb409
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Sun Dec 27 10:11:57 2020 +0100

    Update ui_motion.cgi

    fix typo

commit ccdfd4d239
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Sun Dec 27 10:09:52 2020 +0100

    Update motion.html

    fix typo

commit 7d2eebaed6
Author: Justin Goette <53531335+jcgoette@users.noreply.github.com>
Date:   Sat Dec 26 04:40:53 2020 -0500

    Update camera.html (#1656)

    * Update camera.html

    Typo

    * Update camera.html

    Typo

commit 69e0126c0b
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Wed Dec 23 22:02:13 2020 +0100

    Update control.js

    Add friendly name for mdns-responder

commit 8eb23eb040
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Wed Dec 23 21:54:20 2020 +0100

    Update motion.html

    fix some grammar & clarify night mode delay

commit 90173ea83f
Author: Julian Tatsch <julian@tatsch.it>
Date:   Wed Dec 23 18:27:12 2020 +0100

    add mDNSResponder binary

commit e7c84ddf59
Author: Greg Thornton <xdissent@me.com>
Date:   Tue Dec 22 10:13:50 2020 -0600

    Network config web ui and fallback wifi hotspot (#1655)

commit 43d73c3c77
Author: Greg Thornton <xdissent@me.com>
Date:   Tue Dec 22 00:48:59 2020 -0600

    Allow custom firmware repositories (#1651)

    * Add repo option to autoupdate.sh

    * Fix repo option in autoupdate.sh

    * Use local repo when checking for updates

    * Use default repo if non given in VERSION file in autoupdates.sh

    * Pass custom repo to web ui and update cgi

    * Add custom firmware update to web ui

    * Fix update messages

    * Fix update start arguments

    * Fix update input labels

    * Add custom upgrade button when on custom firmware

commit 4f304046fa
Author: Greg Thornton <xdissent@me.com>
Date:   Mon Dec 21 06:00:24 2020 -0600

    Mdns responder (#1649)

    * Add mDNSResponder

    * Add mDNSResponder to web ui

    * Fix mDNSResponder pid location

commit 3fa69c9b79
Author: Greg Thornton <xdissent@me.com>
Date:   Mon Dec 21 05:57:23 2020 -0600

    GitHub token for updates (#1650)

    * Add github token option to autoupdate.sh

    * Use github token to check updates

    * Add github token to web ui

    * Use github token in web updates

    * Add github tab in web ui

    * Fix curl in autoupdate.sh

    * Fix github curl auth

commit 74360b8c40
Author: Greg Thornton <xdissent@me.com>
Date:   Mon Dec 21 05:56:32 2020 -0600

    Ignore motion events when night mode is switched on/off (#1648)

    * Ignore motion events if night mode has recently changed.

    * Add night mode motion delay to web ui

    * Change night_delay config to night_mode_event_delay

commit 6a13b282f5
Author: Greg Thornton <xdissent@me.com>
Date:   Mon Dec 21 05:55:30 2020 -0600

    Fix select elements in safari (#1647)

commit 49d1e335cc
Author: drkdoesgit <67248496+drkdoesgit@users.noreply.github.com>
Date:   Mon Dec 21 00:20:46 2020 +0800

    Save snapshots/videos on motion vales are not saved. (#1645)

    * https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/pull/1588

    ###Description:
    Save snapshots/videos on motion vales are not saved.

    ###To Reproduce:
    1. SET **Motion Settings** > **Storage** > **Local Storage** > "Save snapshots on motion" to **Activate**
    2. Reload the configuration.
    3. Changes are not reflected or remains to be **Deactivate**

    ###Changes:
    ui_motion.cgi
    1. Changed the variable `saveSnaphot` to `saveSnapshot`
    2. Added `    echo "saveVideo#:#${save_video}"` for command `get_config`.
    2. Added the the code below for the `save_config` command.
    ```
        if [ -n "${F_saveVideo+x}" ]; then
      F_saveVideo=$(printf '%b' "${F_saveVideo//%/\\x}")
         rewrite_config /system/sdcard/config/motion.conf save_video $F_saveVideo
        echo "Save video set to $F_saveVideo<br/>"
       fi
    ```

    motion.html
    1. Renamed `saveSnaphot` to `saveSnapshot` to reflect the changes done in ui_motion.cgi.

    * Update .gitignore

    remove vsc files

    Co-authored-by: Brian Frianeza <bf@dewise.com>
    Co-authored-by: jmtatsch <jmtatsch@users.noreply.github.com>

commit 50a937cfb7
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Sun Dec 13 10:18:08 2020 +0100

    Update install_cfw.md

    add filename hint for wyzecam v3

commit d43eb62d19
Author: Coby Fleener <coby@users.noreply.github.com>
Date:   Thu Dec 10 14:45:49 2020 -0700

    Update Readme (#1642)

    Minor spelling correction.

commit be4402631a
Author: Ben Russell <ben@benru.co.uk>
Date:   Tue Dec 8 20:58:38 2020 +0000

    Fix differences between Web UI services and MQTT (#1640)

    * Change descriptions of MQTT topics to match Web UI (#1637)

    * Allow MQTT to start/stop the "timelapse" service (#1637)

    * Add manual switch for Night Mode to the sidebar (#1637)

    * Add friendly names to the current list of services (#1637)

    This adds a list of more user-friendly names to the services page. If a
    new service is added in the future this list should be updated, or the
    display name will default to the filename just as it did before.

commit 04edd48499
Merge: 7b88be2 1c92630
Author: Julian Tatsch <julian@tatsch.it>
Date:   Tue Dec 8 19:10:57 2020 +0100

    Merge branch 'beta'

commit 1c92630953
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Tue Dec 8 15:05:52 2020 +0100

    Full master fixes also into beta (#1639)

    * Fixed the timezone: Europe/Amsterdam

    * Fix 'rtsp-h264' still set as an autostart entry when 'rtsp' is now the (#1636)

    service to use

    In 1e2f96612f the services 'rtsp-h264' and
    'rtsp-mjpeg' were combined into a single 'rtsp' service, however an
    entry for 'rtsp-h264' still remained in the autostart folder. This is a
    problem for the user because this entry does not appear in the Web UI
    which means it cannot be easily removed, and also appears as if an RTSP
    server is not running when it is.

    * Added button to the live page that downloads a JPEG screenshot (#1638)

    * Fixed a missing line break and spelling mistake

    * Added button to the live page that downloads a JPEG screenshot

    Co-authored-by: OhMyGuus <info@guus.ninja>
    Co-authored-by: Ben Russell <ben@benru.co.uk>

commit 7b88be20ee
Author: Ben Russell <ben@benru.co.uk>
Date:   Tue Dec 8 14:00:19 2020 +0000

    Added button to the live page that downloads a JPEG screenshot (#1638)

    * Fixed a missing line break and spelling mistake

    * Added button to the live page that downloads a JPEG screenshot

commit 00ae38fb6b
Author: Ben Russell <ben@benru.co.uk>
Date:   Tue Dec 8 10:31:42 2020 +0000

    Fix 'rtsp-h264' still set as an autostart entry when 'rtsp' is now the (#1636)

    service to use

    In 1e2f96612f the services 'rtsp-h264' and
    'rtsp-mjpeg' were combined into a single 'rtsp' service, however an
    entry for 'rtsp-h264' still remained in the autostart folder. This is a
    problem for the user because this entry does not appear in the Web UI
    which means it cannot be easily removed, and also appears as if an RTSP
    server is not running when it is.

commit f299b6cefd
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Sat Nov 14 12:17:04 2020 +0100

    Update osd.conf

    make osd text white by default and slighly smaller

commit b590eef293
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Sat Nov 14 12:14:26 2020 +0100

    Update index.html

    make light blue the default theme

commit ede5abe316
Merge: 02d5523 cc3c060
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Sat Nov 14 11:26:49 2020 +0100

    Merge pull request #1620 from OhMyGuus/Fixes

    Fixed the timezone: Europe/Amsterdam

commit 853a3927f5
Author: Julian Tatsch <julian@tatsch.it>
Date:   Sat Nov 14 11:25:08 2020 +0100

    fix autostart of rtsp

commit 61a02eaec9
Author: Julian Tatsch <julian@tatsch.it>
Date:   Sat Nov 14 11:18:25 2020 +0100

    Remove traces of distinction between rtsp_h264 and rtsp_mjpeg because everything is handled now by rtsp service and both cant run at the same time anyhow.

commit 914b46e78a
Author: Julian Tatsch <julian@tatsch.it>
Date:   Thu Nov 12 08:56:23 2020 +0100

    Fix a typo in camera.cgi so that setconf is called correctly when saving OSD. Thanks @thehijacker

commit cc3c060da5
Author: OhMyGuus <info@guus.ninja>
Date:   Sat Nov 7 01:58:24 2020 +0100

    Fixed the timezone: Europe/Amsterdam

commit 17095b7283
Merge: 74480c8 02d5523
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Fri Nov 6 22:10:57 2020 +0100

    Merge pull request #1618 from EliasKotlyar/master

    Merge the fixes from master to beta

commit 02d5523f7b
Merge: 064aff2 ac7e2ba
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Fri Nov 6 21:28:46 2020 +0100

    Merge pull request #1592 from josephdouce/patch-1

    Update mqtt-control.sh

commit ac7e2ba07d
Merge: 1e71c66 064aff2
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Fri Nov 6 21:28:29 2020 +0100

    Merge branch 'master' into patch-1

commit 064aff2f66
Merge: 2948300 b0d51be
Author: jmtatsch <jmtatsch@users.noreply.github.com>
Date:   Fri Nov 6 21:25:24 2020 +0100

    Merge pull request #1612 from dewi-ny-je/master

    Merge beta and master branches

commit 1e71c66745
Author: joseph douce <josephdouce@gmail.com>
Date:   Thu Oct 1 12:55:55 2020 +0100

    Update mqtt-control.sh

    changed compression to increase processing speed. -S 25k takes much longer then -m 50, reduced processing time from 10s to 2s

* Corrected detection of night mode

Fixes #1777 "Always getting "sh: bad number" in detectionOn.sh"

* Fixes "sh: bad number" in detectionOn.sh #1777

* Fix for #1814

added xterm-256 color
This commit is contained in:
dewi-ny-je
2022-05-15 03:31:13 +02:00
committed by GitHub
parent 0cde105a1b
commit ff72612871
2 changed files with 14 additions and 7 deletions

View File

@@ -9,3 +9,6 @@ PATH=/system/sdcard/bin:$PATH
# Add our custom libraries to path
LD_LIBRARY_PATH=/system/sdcard/lib:$LD_LIBRARY_PATH
# Allow "nano" to run
TERM=xterm-256color

View File

@@ -178,13 +178,17 @@ record_video () {
fi
}
if [ -f /tmp/last-night -a -n "$night_mode_event_delay" -a "$night_mode_event_delay" -gt 0 ]; then
now_ts="$(date +%s)"
night_ts="$(/system/sdcard/bin/busybox stat -c %Y /tmp/last-night)"
dt="$(($now_ts-$night_ts))"
if [ "$dt" -lt "$night_mode_event_delay" ]; then
exit 0
fi
if [ -f /tmp/last-night ]; then
if [ -n "$night_mode_event_delay" ]; then
if [ "$night_mode_event_delay" -gt 0 ]; then
now_ts="$(date +%s)"
night_ts="$(/system/sdcard/bin/busybox stat -c %Y /tmp/last-night)"
dt="$(($now_ts-$night_ts))"
if [ "$dt" -lt "$night_mode_event_delay" ]; then
exit 0
fi
fi
fi
fi
# Turn on the amber led