mirror of
https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git
synced 2025-09-02 20:52:41 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -290,6 +290,30 @@ motion_detection(){
|
||||
esac
|
||||
}
|
||||
|
||||
# Control the motion detection mail function
|
||||
motion_send_mail(){
|
||||
case "$1" in
|
||||
on)
|
||||
rewrite_config /system/sdcard/config/motion.conf sendemail "true"
|
||||
;;
|
||||
off)
|
||||
rewrite_config /system/sdcard/config/motion.conf sendemail "false"
|
||||
;;
|
||||
status)
|
||||
status=`awk '/sendemail/' /system/sdcard/config/motion.conf |cut -f2 -d \=`
|
||||
case $status in
|
||||
false)
|
||||
echo "OFF"
|
||||
;;
|
||||
true)
|
||||
echo "ON"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Control the motion tracking function
|
||||
motion_tracking(){
|
||||
case "$1" in
|
||||
|
@@ -9,6 +9,9 @@
|
||||
# Motion detection on/off switch
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_detection/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion detection\", \"icon\": \"mdi:run\", \"state_topic\": \"$TOPIC/motion/detection\", \"command_topic\": \"$TOPIC/motion/detection/set\"}"
|
||||
|
||||
# Motion send mail alert on/off switch
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_send_mail/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion send mail\", \"icon\": \"mdi:run\", \"state_topic\": \"$TOPIC/motion/send_mail\", \"command_topic\": \"$TOPIC/motion/send_mail/set\"}"
|
||||
|
||||
# Motion detection snapshots
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/camera/$DEVICE_NAME/motion_snapshot/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion snapshot\", \"topic\": \"$TOPIC/motion/snapshot\"}"
|
||||
|
||||
|
@@ -146,6 +146,20 @@ killall mosquitto_sub.bin 2> /dev/null
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/detection ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motion_detection status)"
|
||||
;;
|
||||
|
||||
"${TOPIC}/motion/send_mail")
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/send_mail ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motion_send_mail status)"
|
||||
;;
|
||||
|
||||
"${TOPIC}/motion/send_mail/set ON")
|
||||
motion_send_mail on
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/send_mail ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motion_send_mail status)"
|
||||
;;
|
||||
|
||||
"${TOPIC}/motion/send_mail/set OFF")
|
||||
motion_send_mail off
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/send_mail ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motion_send_mail status)"
|
||||
;;
|
||||
|
||||
"${TOPIC}/motion/tracking")
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/tracking ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motion_tracking status)"
|
||||
;;
|
||||
|
@@ -18,6 +18,7 @@ do
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/night_mode ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(night_mode status)"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/night_mode/auto ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(auto_night_mode status)"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/detection ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(motion_detection status)"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/send_mail ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(motion_send_mail status)"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motion/tracking ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(motion_tracking status)"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/vertical ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(motor status vertical)"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/horizontal ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "$(motor status horizontal)"
|
||||
|
@@ -108,6 +108,12 @@ if [ -n "$F_cmd" ]; then
|
||||
fi
|
||||
;;
|
||||
|
||||
hostname)
|
||||
echo $(hostname);
|
||||
;;
|
||||
version)
|
||||
echo $(cat /system/sdcard/.lastCommitDate);
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported command '$F_cmd'"
|
||||
;;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset=utf-8 />
|
||||
<title>DafangHacks</title>
|
||||
<title>Dafang Hacks</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- CSS Framework -->
|
||||
@@ -168,7 +168,7 @@
|
||||
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href=".">Dafang Hacks</a>
|
||||
<a class="navbar-item" href="." id="title">Dafang Hacks</a>
|
||||
<a id="navbar_burger" role="button" class="navbar-burger" data-target="nav_menu" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
@@ -184,13 +184,24 @@
|
||||
<a id="status" class="navbar-item onpage" href="javascript: void(0)" data-target="cgi-bin/status.cgi">Settings</a>
|
||||
<a id="scripts" class="navbar-item onpage" href="javascript: void(0)" data-target="cgi-bin/scripts.cgi">Services</a>
|
||||
<a id="configmotion" class="navbar-item onpage" href="javascript: void(0)" data-target="configmotion.html">Motion Detection</a>
|
||||
<a id="network" class="navbar-item onpage" href="javascript: void(0)" data-target="cgi-bin/network.cgi">Network Information</a>
|
||||
<a id="logs" class="navbar-item onpage" href="javascript: void(0)" data-target="logs.html">Logs</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<span class="navbar-link">System</span>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
<a id="update" class="navbar-item onpage" href="javascript: void(0)" data-target="update.html">Update</a>
|
||||
<a class="navbar-item prompt" href="javascript: void(0)" data-message="Are you sure you wish to reboot?" data-target="cgi-bin/action.cgi?cmd=reboot">Reboot</a>
|
||||
<a class="navbar-item prompt" href="javascript: void(0)" data-message="Are you sure you wish to shutdown?" data-target="cgi-bin/action.cgi?cmd=shutdown">Shutdown</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<span class="navbar-link">Informations</span>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
<a id="network" class="navbar-item onpage" href="javascript: void(0)" data-target="cgi-bin/network.cgi">Network Information</a>
|
||||
<a id="logs" class="navbar-item onpage" href="javascript: void(0)" data-target="logs.html">Logs</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- right menu -->
|
||||
<div class="navbar-end">
|
||||
@@ -335,7 +346,7 @@
|
||||
<p>
|
||||
<a href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks" target="_blank">
|
||||
<strong>Dafang Hacks</strong>
|
||||
</a> v0.0.1.
|
||||
</a> Version: <em id="version">VERSION</em>
|
||||
<a href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues" target="_blank">Issues?</a>
|
||||
</p>
|
||||
<div class="dropdown is-hoverable">
|
||||
|
@@ -53,7 +53,14 @@ function showResult(txt) {
|
||||
$(document).ready(function () {
|
||||
|
||||
setTheme(getThemeChoice());
|
||||
|
||||
|
||||
// Set title page and menu with hostname
|
||||
$.get("cgi-bin/state.cgi", {cmd: "hostname"}, function(title){document.title = title;document.getElementById("title").innerHTML = title;});
|
||||
|
||||
|
||||
// Set git version to bottim page
|
||||
$.get("cgi-bin/state.cgi", {cmd: "version"}, function(version){document.getElementById("version").innerHTML = version;});
|
||||
|
||||
// Load link into #content
|
||||
$('.onpage').click(function () {
|
||||
var e = $(this);
|
||||
@@ -151,7 +158,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
// Make liveview self refresh
|
||||
$("#liveview").attr("onload", "scheduleRefreshLiveImage(4000);");
|
||||
$("#liveview").attr("onload", "scheduleRefreshLiveImage(1000);");
|
||||
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user