From ff726128711279f7020756f098dde8abbdc47094 Mon Sep 17 00:00:00 2001 From: dewi-ny-je <2866139+dewi-ny-je@users.noreply.github.com> Date: Sun, 15 May 2022 03:31:13 +0200 Subject: [PATCH] Fixes "sh: bad number" in detectionOn.sh #1777 (#1813) * Squashed commit of the following: commit 0cde105a1ba438d2dbd045db5acece119019dc40 Author: Aaron Carson Date: Sun Dec 5 16:25:16 2021 +0000 Update WyzeCam v1.2 `sha3sum -a 256` (#1791) commit f1cf7dad8b818cda9b64d4b139ae1398a63924e6 Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com> Date: Sun Oct 24 09:57:50 2021 +0100 Merge beta into master (#1786) commit d2fa6d7aacf222265f50bfe89ecb60a184332f7f Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com> Date: Sun Oct 24 07:57:17 2021 +0100 Change Telegram ico (#1785) commit b6a93e9cf5130251f596e66aabfe0d34c43a0828 Author: Stephan Fuchs Date: Mon Jun 21 18:50:37 2021 +0800 Added clarification for LOCATION and DEVICE_NAME (#1747) commit adbaffb038b9f2641695952c111becd266eaf603 Author: Nicholas FitzRoy-Dale Date: Sat May 22 17:33:17 2021 +0100 install_cfw: update Wyzecam V2 firmware version (#1735) commit 62c8990caa12e7439b4b42689ec995ac9e9c6cc1 Author: fhl206 Date: Mon May 17 03:56:08 2021 +0100 Update install_cwf_t20l.md (#1734) commit c33bb63a61d068e42418dbca0ff95e84113dc10a Author: jmtatsch Date: Tue May 11 15:11:35 2021 +0200 Update README.md commit c15370910b0e7d51b4bd18511b10e5f758fb6861 Merge: a4a8bdc 90076db Author: Julian Tatsch Date: Tue May 11 06:23:18 2021 +0200 Merge branch 'master' into beta commit 90076db30317d66f5f065da2972f8756c3c2d5ec Author: McNutnut Date: Mon May 10 21:19:16 2021 -0700 Updated cfw for newest wyzev2 (#1729) commit 1090a1f62611c49fb4e177b124ef8cd7f683d03e Author: Will Freeman 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 799c2a4b702cbab6cf9a5fefef76d93eaf857f71 Author: Will Freeman Date: Tue Apr 27 08:35:00 2021 -0600 Letsencrypt fix path (#1725) commit 6bfe58ed54bcb06bc47d247234923ff6f646d44b Author: Will Freeman Date: Mon Apr 26 20:20:59 2021 -0600 Fix missing directory structure on letsencrypt (#1724) commit 1de5ae163686d1db19109a33d5fdda9242542813 Author: maxemoose 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 0ded51606e1a57f555b52ad325e5e3da46e23c19 Author: Ian Date: Thu Apr 22 10:58:15 2021 -0600 Typo fix (#1723) I know this is stupid but it was annoying me. commit a4a8bdc6d648e9b68de27ff193a2ca8f120cd8bd Author: Joey Babcock Date: Tue Apr 20 20:05:28 2021 -0700 Fix small typo in OSD save log (#1722) commit 3935ddfd50ceff4017c1edfd0428de05eb0acc35 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 116c1ad53d04933ac91842d981d17015555a584f Author: psallandre 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 7aa86b916f31ff6b9c7057f7c90201b4171f45db Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com> Date: Sun Mar 21 19:06:38 2021 +0000 Add web server control script (#1714) commit 90b8a89a4d966add42d14f835eb9b57303295ee9 Author: maxemoose 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 a163f4456d4f803f2a53673cae208cbc5cfbf490 Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com> Date: Sun Mar 21 08:09:52 2021 +0000 SSH Control script (#1711) commit 55a85cca648329113ede1c22d49a269b987aef72 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 00ffa10af5e4201885a0c1e14ef7ebc597f3c901 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 commit f7c4a0ef49d911e56da79cf29448c5dead34da8e Merge: fbb903d bae6374 Author: Julian Tatsch Date: Sat Mar 13 20:13:59 2021 +0100 Merge branch 'master' into beta commit fbb903d60863b1fdcdd76bfe6723033e85803f46 Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com> Date: Sat Mar 13 14:43:59 2021 +0000 Fix changing dropbox folders (#1705) commit 4a2af3a87e9b70c4c26312add022ffacd773c15a 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 bae6374a422b7492cb1980a4e960979d4f3ac75e Author: yerlandinata Date: Tue Mar 9 02:54:02 2021 +0700 Fix controlscripts/rtsp (#1701) - stopping rtsp will stop its dependents properly commit 74575379b06298184631d6dd40da544dbc83f17b Author: Fietspomp86 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 5ef8548434e07c2ac0e6212da51acb865f3dcac6 Author: timstanley1985 <6829542+timstanley1985@users.noreply.github.com> Date: Mon Mar 8 09:26:34 2021 +0000 Refactor dtectionOn.sh (#1698) commit 1e393e1bd535b7b8d99e19323ba57b825be86de2 Author: aque0us Date: Mon Mar 8 04:25:38 2021 -0500 Update install_cfw.md (#1673) commit 8065bd58b57170aebe4951c42f742e0fa834a6c6 Author: Julian Tatsch Date: Mon Mar 8 10:16:34 2021 +0100 Added nano binary commit d79a153e99e2fde699bb207db971a33c4567c644 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 * Add configure SSH pub key to web ui * Tweak wording * Change logic for SSH paasword Co-authored-by: fhl206 commit 972ba9d5cfcc48c1f8863f9c6f8001bdc99284be Author: Matthias Pfefferle 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 174b2d56a18379a225fee51a1510b7aea1ff1e3a Author: Chris Knight Date: Thu Feb 25 20:54:24 2021 -0800 fix #1674 - typo in ui_motion.cgi (#1676) Co-authored-by: Chris Knight commit 0b6a19ae4ed25dfeb63d975883fc1974144ff2f7 Author: Chris Knight Date: Thu Feb 11 20:55:24 2021 -0800 typo fix (#1685) commit e5520d0bcd045194e0b617563ea1372f4363a374 Author: fhl206 Date: Wed Feb 10 02:44:51 2021 +0000 Update technical.md (#1683) commit fe18a97e94ef33f554fef674d7355eabf26e10e7 Author: jmtatsch Date: Fri Jan 1 15:24:11 2021 +0100 Update motion.html fix typo commit 67794f28670a855acfec10bf3b9f82e0ed48c02f Merge: 5fc16fb 7d2eeba Author: Julian Tatsch Date: Sun Dec 27 11:12:08 2020 +0100 Merge branch 'master' into beta commit 5fc16fb4090bc0efb48eb3bf7daed48d54644f47 Author: jmtatsch Date: Sun Dec 27 10:11:57 2020 +0100 Update ui_motion.cgi fix typo commit ccdfd4d239fc869be6aaff90bc1a1bb07c7c10f7 Author: jmtatsch Date: Sun Dec 27 10:09:52 2020 +0100 Update motion.html fix typo commit 7d2eebaed6b991a84e66bfdba807da8edcee105d 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 69e0126c0b84db3c5aa831ccb22130c54a0033b2 Author: jmtatsch Date: Wed Dec 23 22:02:13 2020 +0100 Update control.js Add friendly name for mdns-responder commit 8eb23eb04023d3f1ffcde72cbe0cbeeca18f8c88 Author: jmtatsch Date: Wed Dec 23 21:54:20 2020 +0100 Update motion.html fix some grammar & clarify night mode delay commit 90173ea83fa012de6a8d451c5723c719030f2f4a Author: Julian Tatsch Date: Wed Dec 23 18:27:12 2020 +0100 add mDNSResponder binary commit e7c84ddf59101d650562ef1cfc4bec64ccae6dd2 Author: Greg Thornton Date: Tue Dec 22 10:13:50 2020 -0600 Network config web ui and fallback wifi hotspot (#1655) commit 43d73c3c772b6ffd36e59023bc7238cbf117974f Author: Greg Thornton 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 4f304046fa53c64a888236adafc93639ab842851 Author: Greg Thornton Date: Mon Dec 21 06:00:24 2020 -0600 Mdns responder (#1649) * Add mDNSResponder * Add mDNSResponder to web ui * Fix mDNSResponder pid location commit 3fa69c9b79b3c5406df198cc03844f851c5aa8cc Author: Greg Thornton 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 74360b8c40d0893d8840d6fd4bdfdbfec815cbb2 Author: Greg Thornton 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 6a13b282f57c4c57399419527b6eb555912133bf Author: Greg Thornton Date: Mon Dec 21 05:55:30 2020 -0600 Fix select elements in safari (#1647) commit 49d1e335cc300038653eec138f27c12653ed36f0 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
" 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 Co-authored-by: jmtatsch commit 50a937cfb7bea25c553569919608df1a375ed2c8 Author: jmtatsch Date: Sun Dec 13 10:18:08 2020 +0100 Update install_cfw.md add filename hint for wyzecam v3 commit d43eb62d195aa50dfcbc724233a129ebf49fb3ed Author: Coby Fleener Date: Thu Dec 10 14:45:49 2020 -0700 Update Readme (#1642) Minor spelling correction. commit be4402631a343700e1429237b551a0cea401f966 Author: Ben Russell 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 04edd484993defee2d17c224f1bca69e43dd2912 Merge: 7b88be2 1c92630 Author: Julian Tatsch Date: Tue Dec 8 19:10:57 2020 +0100 Merge branch 'beta' commit 1c92630953a749b0dd8a608732df553a891089c3 Author: jmtatsch 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 1e2f96612f4ad7852697609669d72532aea2a314 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 Co-authored-by: Ben Russell commit 7b88be20ee2247a96aa816cb28d81018c0f259c1 Author: Ben Russell 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 00ae38fb6b277d7a2a09190edfde1f66e619eb5a Author: Ben Russell 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 1e2f96612f4ad7852697609669d72532aea2a314 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 f299b6cefd0e03d36024cd52828f41b58648bda9 Author: jmtatsch Date: Sat Nov 14 12:17:04 2020 +0100 Update osd.conf make osd text white by default and slighly smaller commit b590eef2933b3a165866f602902ec67393eb022d Author: jmtatsch Date: Sat Nov 14 12:14:26 2020 +0100 Update index.html make light blue the default theme commit ede5abe316308c38a4562135387f32ab2d12895b Merge: 02d5523 cc3c060 Author: jmtatsch Date: Sat Nov 14 11:26:49 2020 +0100 Merge pull request #1620 from OhMyGuus/Fixes Fixed the timezone: Europe/Amsterdam commit 853a3927f5a83a6f3288e74fd7e01f89782309da Author: Julian Tatsch Date: Sat Nov 14 11:25:08 2020 +0100 fix autostart of rtsp commit 61a02eaec941b8f2193855b05709754252ce444c Author: Julian Tatsch 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 914b46e78a199a80d51ed50c75b049b6d006f883 Author: Julian Tatsch 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 cc3c060da548416f7fd42a097d9da6cdc4cc6203 Author: OhMyGuus Date: Sat Nov 7 01:58:24 2020 +0100 Fixed the timezone: Europe/Amsterdam commit 17095b728399d96e9a672974624cc40efe650678 Merge: 74480c8 02d5523 Author: jmtatsch Date: Fri Nov 6 22:10:57 2020 +0100 Merge pull request #1618 from EliasKotlyar/master Merge the fixes from master to beta commit 02d5523f7befa12b07eedade3b3351438b9f28f5 Merge: 064aff2 ac7e2ba Author: jmtatsch Date: Fri Nov 6 21:28:46 2020 +0100 Merge pull request #1592 from josephdouce/patch-1 Update mqtt-control.sh commit ac7e2ba07d0609d023756a3d6a3b7ca2d67614c2 Merge: 1e71c66 064aff2 Author: jmtatsch Date: Fri Nov 6 21:28:29 2020 +0100 Merge branch 'master' into patch-1 commit 064aff2f66c42b4980e1f49e59dec10e4bd05064 Merge: 2948300 b0d51be Author: jmtatsch Date: Fri Nov 6 21:25:24 2020 +0100 Merge pull request #1612 from dewi-ny-je/master Merge beta and master branches commit 1e71c6674524f9538609dd0a152c946aa2be97d2 Author: joseph douce 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 --- firmware_mod/root/.profile | 3 +++ firmware_mod/scripts/detectionOn.sh | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/firmware_mod/root/.profile b/firmware_mod/root/.profile index ba302f7..936eead 100644 --- a/firmware_mod/root/.profile +++ b/firmware_mod/root/.profile @@ -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 diff --git a/firmware_mod/scripts/detectionOn.sh b/firmware_mod/scripts/detectionOn.sh index e8e9f97..e8ed817 100644 --- a/firmware_mod/scripts/detectionOn.sh +++ b/firmware_mod/scripts/detectionOn.sh @@ -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