mirror of
https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git
synced 2025-08-31 11:51:52 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -6,7 +6,8 @@
|
||||
firmware_mod/config/lighttpd.user text eol=lf
|
||||
firmware_mod/bin/curl text eol=lf
|
||||
firmware_mod/bin/mosquitto_pub text eol=lf
|
||||
firmware_mod/bin/mosquitto_pub text eol=lf
|
||||
firmware_mod/bin/mosquitto_sub text eol=lf
|
||||
firmware_mod/bin/lighttpd text eol=lf
|
||||
firmware_mod/controlscripts/* text eol=lf
|
||||
firmware_mod/scripts/* text eol=lf
|
||||
firmware_mod/config/autostart/* text eol=lf
|
||||
|
30
.github/ISSUE_TEMPLATE.md
vendored
Normal file
30
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
This is an issue tracking system only.
|
||||
If you have general questions or are a newbie, please ask for help in our [chat channel](https://gitter.im/Xiaomi-Dafang-Hacks).
|
||||
|
||||
To make sure your issue can be resolved as quickly as possible please state your
|
||||
|
||||
* exact camera hardware:
|
||||
* the Xiaomi-Dafang-Hacks commitid (from `git log`) you are experiencing the issue with:
|
||||
|
||||
|
||||
### Description
|
||||
|
||||
Describe what you were trying to achieve.
|
||||
Tell us what happened and what you expected to happen.
|
||||
|
||||
### What did you do to debug the issue
|
||||
|
||||
Tell us what you did to remedy/debug the issue yourself and what you think causes the issue.
|
||||
|
||||
### Evidence
|
||||
|
||||
Please add snippets from the logfiles in:
|
||||
* /system/sdcard/log/startup.log
|
||||
* /var/log/*
|
||||
* dmesg
|
||||
* logcat
|
||||
and/or screenshots you deem relevant.
|
||||
|
||||
### Contribute Back
|
||||
|
||||
If your issue was resolved, please consider contributing back to the project by creating a pull request to improve the code or documentation in order to avoid that this issue arises again for other people.
|
@@ -45,6 +45,8 @@ Start [here](/hacks/technical.md)
|
||||
|
||||
[HomeKit](/integration/homekit/homekit.md)
|
||||
|
||||
[OpenHab](https://community.openhab.org/t/how-to-configure-a-hacked-xiaomi-dafang-to-work-with-openhab/51121)
|
||||
|
||||
[Synology](/integration/synology/synology.md)
|
||||
|
||||
[tinyCam](/integration/tinycam/tinycam.md)
|
||||
|
Binary file not shown.
@@ -19,3 +19,4 @@ publish_mqtt_message=false
|
||||
sendemail=false
|
||||
send_telegram=false
|
||||
save_dir=/system/sdcard/motion/stills
|
||||
save_file_date_pattern="+%d-%m-%Y_%H.%M.%S"
|
||||
|
@@ -32,8 +32,5 @@ MOSQUITTOOPTS=""
|
||||
# Add options for mosquitto_pub like -r for retaining messages
|
||||
MOSQUITTOPUBOPTS=""
|
||||
|
||||
# Add options for curl here e.g --user user:password
|
||||
CURLOPTS=""
|
||||
|
||||
# Send a mqtt statusupdate every n seconds
|
||||
STATUSINTERVAL=30
|
||||
|
53
firmware_mod/controlscripts/telegram-bot
Normal file
53
firmware_mod/controlscripts/telegram-bot
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
######### Bot commands #########
|
||||
# /mem - show memory information
|
||||
# /shot - take a shot
|
||||
# /on - motion detect on
|
||||
# /off - motion detect off
|
||||
|
||||
PIDFILE="/run/telegram-bot.pid"
|
||||
|
||||
if [ ! -f /system/sdcard/config/telegram.conf ]; then
|
||||
echo "You have to configure telegram first. Please see /system/sdcard/config/telegram.conf.dist for further instructions"
|
||||
fi
|
||||
|
||||
status()
|
||||
{
|
||||
pid="$(cat "$PIDFILE" 2>/dev/null)"
|
||||
if [ "$pid" ]; then
|
||||
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
if [ -f $PIDFILE ]; then
|
||||
echo "Bot already running";
|
||||
else
|
||||
echo "Starting bot"
|
||||
/system/sdcard/bin/busybox nohup /system/sdcard/scripts/telegram-bot-daemon.sh >/dev/null 2>&1 &
|
||||
echo "$!" > "$PIDFILE"
|
||||
fi
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
pid="$(cat "$PIDFILE" 2>/dev/null)"
|
||||
if [ "$pid" ]; then
|
||||
kill -9 "$pid"
|
||||
rm "$PIDFILE"
|
||||
echo "Bot stopped"
|
||||
else
|
||||
echo "Could not find a bot to stop."
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
start
|
||||
else
|
||||
case $1 in start|stop|status)
|
||||
$1
|
||||
;;
|
||||
esac
|
||||
fi
|
BIN
firmware_mod/driver/sensor_jxf23.ko
Normal file
BIN
firmware_mod/driver/sensor_jxf23.ko
Normal file
Binary file not shown.
@@ -55,6 +55,22 @@ echo "Bind mounted /system/sdcard/root to /root" >> $LOGPATH
|
||||
mount -o bind /system/sdcard/etc /etc
|
||||
echo "Bind mounted /system/sdcard/etc to /etc" >> $LOGPATH
|
||||
|
||||
## Create a swap file on SD if desired
|
||||
SWAP=false
|
||||
SWAPPATH="/system/sdcard/swapfile"
|
||||
SWAPSIZE=256
|
||||
if [ "$SWAP" = true ]; then
|
||||
if [ ! -f $SWAPPATH ]; then
|
||||
echo "Creating ${SWAPSIZE}MB swap file on SD card" >> $LOGPATH
|
||||
dd if=/dev/zero of=$SWAPPATH bs=1M count=$SWAPSIZE
|
||||
mkswap $SWAPPATH
|
||||
echo "Swap file created in $SWAPPATH" >> $LOGPATH
|
||||
fi
|
||||
echo "Configuring swap file" >> $LOGPATH
|
||||
swapon $SWAPPATH
|
||||
echo "Swap set on file $SWAPPATH" >> $LOGPATH
|
||||
fi
|
||||
|
||||
## Create crontab dir and start crond:
|
||||
if [ ! -d /system/sdcard/config/cron ]; then
|
||||
mkdir -p ${CONFIGPATH}/cron/crontabs
|
||||
@@ -119,6 +135,7 @@ if [ ! -f $CONFIGPATH/ntp_srv.conf ]; then
|
||||
cp $CONFIGPATH/ntp_srv.conf.dist $CONFIGPATH/ntp_srv.conf
|
||||
fi
|
||||
ntp_srv="$(cat "$CONFIGPATH/ntp_srv.conf")"
|
||||
timeout -t 30 sh -c "until ping -c1 \"$ntp_srv\" &>/dev/null; do sleep 3; done";
|
||||
/system/sdcard/bin/busybox ntpd -p "$ntp_srv"
|
||||
|
||||
## Load audio driver module:
|
||||
@@ -159,7 +176,7 @@ insmod /driver/tx-isp.ko isp_clk=100000000
|
||||
if [ $sensor = 'jxf22' ]; then
|
||||
insmod /driver/sensor_jxf22.ko data_interface=2 pwdn_gpio=-1 reset_gpio=18 sensor_gpio_func=0
|
||||
else
|
||||
insmod /driver/sensor_jxf23.ko data_interface=2 pwdn_gpio=-1 reset_gpio=18 sensor_gpio_func=0
|
||||
insmod /system/sdcard/driver/sensor_jxf23.ko data_interface=2 pwdn_gpio=-1 reset_gpio=18 sensor_gpio_func=0
|
||||
fi
|
||||
|
||||
## Start FTP & SSH Server:
|
||||
|
@@ -41,11 +41,11 @@ move(){
|
||||
# Differentiate the coordinates and calculate the number
|
||||
# of steps to reach the specified coordinates.
|
||||
if [[ "$1" = "X" ]];then
|
||||
grep_text="x_steps"
|
||||
grep_text="x"
|
||||
opt="r|l"
|
||||
text="Right|Left"
|
||||
else
|
||||
grep_text="y_steps"
|
||||
grep_text="y"
|
||||
opt="u|d"
|
||||
text="Up|Down"
|
||||
fi
|
||||
|
@@ -40,11 +40,11 @@ rewrite_config(){
|
||||
# Check if the value exists (without comment), if not add it to the file
|
||||
$(grep -v '^[[:space:]]*#' $1 | grep -q $2)
|
||||
ret="$?"
|
||||
if [ "$ret" == "1" ] ; then
|
||||
echo "$2=$3" >> $1
|
||||
else
|
||||
if [ "$ret" == "1" ] ; then
|
||||
echo "$2=$3" >> $1
|
||||
else
|
||||
sed -i -e "/\\s*#.*/!{/""$cfg_key""=/ s/=.*/=""$new_value""/}" "$cfg_path"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Control the blue led
|
||||
@@ -178,9 +178,9 @@ motor(){
|
||||
;;
|
||||
status)
|
||||
if [ "$2" = "horizontal" ]; then
|
||||
echo $(/system/sdcard/bin/motor -d u -s 0 | grep "x:" | awk '{print $2}')
|
||||
/system/sdcard/bin/motor -d u -s 0 | grep "x:" | awk '{print $2}'
|
||||
else
|
||||
echo $(/system/sdcard/bin/motor -d u -s 0 | grep "y:" | awk '{print $2}')
|
||||
/system/sdcard/bin/motor -d u -s 0 | grep "y:" | awk '{print $2}'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -290,27 +290,27 @@ motion_detection(){
|
||||
esac
|
||||
}
|
||||
|
||||
# Control the motion detection mail function
|
||||
motion_send_mail(){
|
||||
case "$1" in
|
||||
on)
|
||||
# Control the motion detection mail function
|
||||
motion_send_mail(){
|
||||
case "$1" in
|
||||
on)
|
||||
rewrite_config /system/sdcard/config/motion.conf sendemail "true"
|
||||
;;
|
||||
off)
|
||||
;;
|
||||
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
|
||||
}
|
||||
;;
|
||||
status)
|
||||
status=`awk '/sendemail/' /system/sdcard/config/motion.conf |cut -f2 -d \=`
|
||||
case $status in
|
||||
false)
|
||||
echo "OFF"
|
||||
;;
|
||||
true)
|
||||
echo "ON"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -340,9 +340,9 @@ motion_tracking(){
|
||||
night_mode(){
|
||||
case "$1" in
|
||||
on)
|
||||
/system/sdcard/bin/setconf -k n -v 1
|
||||
ir_led on
|
||||
ir_cut off
|
||||
/system/sdcard/bin/setconf -k n -v 1
|
||||
;;
|
||||
off)
|
||||
ir_led off
|
||||
@@ -380,6 +380,13 @@ auto_night_mode(){
|
||||
esac
|
||||
}
|
||||
|
||||
# Take a snapshot
|
||||
snapshot(){
|
||||
filename="/tmp/snapshot.jpg"
|
||||
/system/sdcard/bin/getimage > "$filename" &
|
||||
sleep 1
|
||||
}
|
||||
|
||||
# Update axis
|
||||
update_axis(){
|
||||
source /system/sdcard/config/osd.conf > /dev/null 2>/dev/null
|
||||
@@ -388,3 +395,13 @@ update_axis(){
|
||||
OSD="${OSD} ${AXIS}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Reboot the System
|
||||
reboot_system() {
|
||||
/sbin/reboot
|
||||
}
|
||||
|
||||
# Re-Mount the SD Card
|
||||
remount_sdcard() {
|
||||
mount -o remount,rw /system/sdcard
|
||||
}
|
||||
|
@@ -11,14 +11,17 @@ fi
|
||||
|
||||
# Save a snapshot
|
||||
if [ "$save_snapshot" = true ] ; then
|
||||
filename=$(date +%d-%m-%Y_%H.%M.%S).jpg
|
||||
pattern="${save_file_date_pattern:-+%d-%m-%Y_%H.%M.%S}"
|
||||
filename=$(date $pattern).jpg
|
||||
if [ ! -d "$save_dir" ]; then
|
||||
mkdir -p "$save_dir"
|
||||
fi
|
||||
# Limit the number of snapshots
|
||||
if [ "$(ls "$save_dir" | wc -l)" -ge "$max_snapshots" ]; then
|
||||
rm -f "$save_dir/$(ls -l "$save_dir" | awk 'NR==2{print $9}')"
|
||||
fi
|
||||
{
|
||||
# Limit the number of snapshots
|
||||
if [ "$(ls "$save_dir" | wc -l)" -ge "$max_snapshots" ]; then
|
||||
rm -f "$save_dir/$(ls -ltr "$save_dir" | awk 'NR==2{print $9}')"
|
||||
fi
|
||||
} &
|
||||
/system/sdcard/bin/getimage > "$save_dir/$filename" &
|
||||
fi
|
||||
|
||||
@@ -42,16 +45,16 @@ if [ "$send_telegram" = true ]; then
|
||||
if [ "$save_snapshot" = true ] ; then
|
||||
/system/sdcard/bin/telegram p "$save_dir/$filename"
|
||||
else
|
||||
/system/sdcard/bin/getimage > "telegram_image.jpg"
|
||||
+ /system/sdcard/bin/telegram p "telegram_image.jpg"
|
||||
+ rm "telegram_image.jpg"
|
||||
/system/sdcard/bin/getimage > "/tmp/telegram_image.jpg"
|
||||
/system/sdcard/bin/telegram p "/tmp/telegram_image.jpg"
|
||||
rm "/tmp/telegram_image.jpg"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run any user scripts.
|
||||
for i in /system/sdcard/config/userscripts/motiondetection/*; do
|
||||
if [ -x "$i" ]; then
|
||||
echo "Running: $i on"
|
||||
$i on
|
||||
echo "Running: $i on $save_dir/$filename"
|
||||
$i on "$save_dir/$filename" &
|
||||
fi
|
||||
done
|
||||
|
@@ -92,8 +92,7 @@ backtoOrigin() {
|
||||
#################### Start ###
|
||||
|
||||
# If no argument that's mean the camera need to return to its original position
|
||||
# the 5th arguments is '&'
|
||||
if [ $# -ne 5 ]
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
backtoOrigin
|
||||
return 0;
|
||||
|
@@ -3,43 +3,49 @@
|
||||
. /system/sdcard/config/mqtt.conf
|
||||
. /system/sdcard/scripts/common_functions.sh
|
||||
|
||||
MAC=$(cat /sys/class/net/wlan0/address)
|
||||
MAC_SIMPLE=$(cat /sys/class/net/wlan0/address | tr -d :)
|
||||
MANUFACTURER="Xiaomi"
|
||||
MODEL="Dafang"
|
||||
VER="Dafang Hacks"
|
||||
|
||||
# Motion sensor
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/binary_sensor/$DEVICE_NAME/motion/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion sensor\", \"icon\": \"mdi:run\", \"state_topic\": \"$TOPIC/motion\", \"device_class\": \"motion\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/binary_sensor/$DEVICE_NAME/motion/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion sensor\", \"unique_id\": \"$MAC_SIMPLE-motion-sensor\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:run\", \"state_topic\": \"$TOPIC/motion\", \"device_class\": \"motion\"}"
|
||||
|
||||
# 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\"}"
|
||||
/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\", \"unique_id\": \"$MAC_SIMPLE-motion-detection\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"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\"}"
|
||||
/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\", \"unique_id\": \"$MAC_SIMPLE-motion-send-mail\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"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\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/camera/$DEVICE_NAME/motion_snapshot/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion snapshot\", \"unique_id\": \"$MAC_SIMPLE-motion-snapshot\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"topic\": \"$TOPIC/motion/snapshot\"}"
|
||||
|
||||
# Motion tracking on/off switch
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_tracking/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion tracking\", \"icon\": \"mdi:run\", \"state_topic\": \"$TOPIC/motion/tracking\", \"command_topic\": \"$TOPIC/motion/tracking/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_tracking/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME motion tracking\", \"unique_id\": \"$MAC_SIMPLE-motion-tracking\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:run\", \"state_topic\": \"$TOPIC/motion/tracking\", \"command_topic\": \"$TOPIC/motion/tracking/set\"}"
|
||||
|
||||
# LEDs
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/blue_led/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME blue led\", \"icon\": \"mdi:led-on\", \"state_topic\": \"$TOPIC/leds/blue\", \"command_topic\": \"$TOPIC/leds/blue/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/yellow_led/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME yellow led\", \"icon\": \"mdi:led-on\", \"state_topic\": \"$TOPIC/leds/yellow\", \"command_topic\": \"$TOPIC/leds/yellow/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/ir_led/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME ir led\", \"icon\": \"mdi:led-on\", \"state_topic\": \"$TOPIC/leds/ir\", \"command_topic\": \"$TOPIC/leds/ir/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/blue_led/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME blue led\", \"unique_id\": \"$MAC_SIMPLE-blue-led\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:led-on\", \"state_topic\": \"$TOPIC/leds/blue\", \"command_topic\": \"$TOPIC/leds/blue/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/yellow_led/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME yellow led\", \"unique_id\": \"$MAC_SIMPLE-yellow-led\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:led-on\", \"state_topic\": \"$TOPIC/leds/yellow\", \"command_topic\": \"$TOPIC/leds/yellow/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/ir_led/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME ir led\", \"unique_id\": \"$MAC_SIMPLE-ir-led\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:led-on\", \"state_topic\": \"$TOPIC/leds/ir\", \"command_topic\": \"$TOPIC/leds/ir/set\"}"
|
||||
|
||||
# IR Filter
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/ir_cut/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME ir filter\", \"icon\": \"mdi:image-filter-black-white\", \"state_topic\": \"$TOPIC/ir_cut\", \"command_topic\": \"$TOPIC/ir_cut/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/ir_cut/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME ir filter\", \"unique_id\": \"$MAC_SIMPLE-ir-filter\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:image-filter-black-white\", \"state_topic\": \"$TOPIC/ir_cut\", \"command_topic\": \"$TOPIC/ir_cut/set\"}"
|
||||
|
||||
# Light Sensor
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/sensor/$DEVICE_NAME/ldr/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME light sensor\", \"icon\": \"mdi:brightness-5\", \"unit_of_measurement\": \"%\", \"state_topic\": \"$TOPIC/brightness\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/sensor/$DEVICE_NAME/ldr/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME light sensor\", \"unique_id\": \"$MAC_SIMPLE-light-sensor\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:brightness-5\", \"unit_of_measurement\": \"%\", \"state_topic\": \"$TOPIC/brightness\"}"
|
||||
|
||||
# Night mode
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/night_mode/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME night mode\", \"icon\": \"mdi:weather-night\", \"state_topic\": \"$TOPIC/night_mode\", \"command_topic\": \"$TOPIC/night_mode/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/night_mode/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME night mode\", \"unique_id\": \"$MAC_SIMPLE-night-mode\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:weather-night\", \"state_topic\": \"$TOPIC/night_mode\", \"command_topic\": \"$TOPIC/night_mode/set\"}"
|
||||
|
||||
# Night mode automatic
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/auto_night_mode/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME night mode auto\", \"icon\": \"mdi:weather-night\", \"state_topic\": \"$TOPIC/night_mode/auto\", \"command_topic\": \"$TOPIC/night_mode/auto/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/auto_night_mode/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME night mode auto\", \"unique_id\": \"$MAC_SIMPLE-night-mode-auto\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:weather-night\", \"state_topic\": \"$TOPIC/night_mode/auto\", \"command_topic\": \"$TOPIC/night_mode/auto/set\"}"
|
||||
|
||||
# RTSP Server
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/rtsp_h264_server/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME h264 rtsp server\", \"icon\": \"mdi:cctv\", \"state_topic\": \"$TOPIC/rtsp_h264_server\", \"command_topic\": \"$TOPIC/rtsp_h264_server/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/rtsp_mjpeg_server/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME mjpeg rtsp server\", \"icon\": \"mdi:cctv\", \"state_topic\": \"$TOPIC/rtsp_mjpeg_server\", \"command_topic\": \"$TOPIC/rtsp_mjpeg_server/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/rtsp_h264_server/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME h264 rtsp server\", \"unique_id\": \"$MAC_SIMPLE-h264-rtsp-server\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:cctv\", \"state_topic\": \"$TOPIC/rtsp_h264_server\", \"command_topic\": \"$TOPIC/rtsp_h264_server/set\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/rtsp_mjpeg_server/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME mjpeg rtsp server\", \"unique_id\": \"$MAC_SIMPLE-mjpeg-rtsp-server\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"icon\": \"mdi:cctv\", \"state_topic\": \"$TOPIC/rtsp_mjpeg_server\", \"command_topic\": \"$TOPIC/rtsp_mjpeg_server/set\"}"
|
||||
|
||||
|
||||
# Motor up/down/left/right
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/cover/$DEVICE_NAME/motor_up_down/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME move up/down\", \"state_topic\": \"$TOPIC/motors/vertical\", \"command_topic\": \"$TOPIC/motors/vertical/set\", \"payload_close\": \"down\", \"payload_open\": \"up\", \"optimistic\": \"false\", \"value_template\": \"{{ ((value|int)/7.3)|round }}\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/cover/$DEVICE_NAME/motor_left_right/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME move left/right\", \"state_topic\": \"$TOPIC/motors/horizontal\", \"command_topic\": \"$TOPIC/motors/horizontal/set\", \"payload_close\": \"right\", \"payload_open\": \"left\", \"optimistic\": \"false\", \"value_template\": \"{{ ((value|int)/27)|round }}\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/cover/$DEVICE_NAME/motor_up_down/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME move up/down\", \"unique_id\": \"$MAC_SIMPLE-move-up-down\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"state_topic\": \"$TOPIC/motors/vertical\", \"command_topic\": \"$TOPIC/motors/vertical/set\", \"payload_close\": \"down\", \"payload_open\": \"up\", \"optimistic\": \"false\", \"value_template\": \"{{ ((value|int)/7.3)|round }}\"}"
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$AUTODISCOVERY_PREFIX/cover/$DEVICE_NAME/motor_left_right/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME move left/right\", \"unique_id\": \"$MAC_SIMPLE-move-left-right\", \"device\": {\"identifiers\": \"$MAC_SIMPLE\", \"connections\": [[\"mac\", \"$MAC\"]], \"manufacturer\": \"$MANUFACTURER\", \"model\": \"$MODEL\", \"name\": \"$MANUFACTURER $MODEL\", \"sw_version\": \"$VER\"}, \"state_topic\": \"$TOPIC/motors/horizontal\", \"command_topic\": \"$TOPIC/motors/horizontal/set\", \"payload_close\": \"right\", \"payload_open\": \"left\", \"optimistic\": \"false\", \"value_template\": \"{{ ((value|int)/27)|round }}\"}"
|
||||
|
@@ -6,7 +6,7 @@
|
||||
killall mosquitto_sub 2> /dev/null
|
||||
killall mosquitto_sub.bin 2> /dev/null
|
||||
|
||||
/system/sdcard/bin/mosquitto_sub.bin -v -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/# | while read -r line ; do
|
||||
/system/sdcard/bin/mosquitto_sub.bin -v -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/# ${MOSQUITTOOPTS} | while read -r line ; do
|
||||
case $line in
|
||||
"${TOPIC}/set help")
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/help ${MOSQUITTOOPTS} -m "possible commands: configured topic + Yellow_LED/set on/off, configured topic + Blue_LED/set on/off, configured topic + set with the following commands: status, $(grep \)$ /system/sdcard/www/cgi-bin/action.cgi | grep -v '[=*]' | sed -e "s/ //g" | grep -v -E '(osd|setldr|settz|showlog)' | sed -e "s/)//g")"
|
||||
@@ -182,6 +182,10 @@ killall mosquitto_sub.bin 2> /dev/null
|
||||
motor down
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/vertical ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motor status vertical)"
|
||||
;;
|
||||
"${TOPIC}/motors/vertical/set calibrate")
|
||||
motor vcalibrate # calibrate with endstops
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/vertical ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motor status vertical)"
|
||||
;;
|
||||
"${TOPIC}/motors/horizontal/set left")
|
||||
motor left
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/horizontal ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motor status horizontal)"
|
||||
@@ -190,11 +194,32 @@ killall mosquitto_sub.bin 2> /dev/null
|
||||
motor right
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/horizontal ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motor status horizontal)"
|
||||
;;
|
||||
"${TOPIC}/motors/horizontal/set calibrate")
|
||||
motor hcalibrate # calibrate with endstops
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors/horizontal ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motor status horizontal)"
|
||||
;;
|
||||
"${TOPIC}/motors/set calibrate")
|
||||
motor calibrate # calibrate without endstops
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/motors ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "$(motor status horizontal)"
|
||||
;;
|
||||
"${TOPIC}/remount_sdcard/set ON")
|
||||
remount_sdcard
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/remount_sdcard ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "Remounting the SD Card"
|
||||
;;
|
||||
|
||||
"${TOPIC}/reboot/set ON")
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/reboot ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -m "Rebooting the System"
|
||||
reboot_system
|
||||
;;
|
||||
"${TOPIC}/snapshot/set ON")
|
||||
snapshot
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/snapshot ${MOSQUITTOOPTS} ${MOSQUITTOPUBOPTS} -f "$filename"
|
||||
;;
|
||||
|
||||
"${TOPIC}/set "*)
|
||||
COMMAND=$(echo "$line" | awk '{print $2}')
|
||||
#echo "$COMMAND"
|
||||
/system/sdcard/bin/curl -k -m 2 ${CURLOPTS} -s https://127.0.0.1/cgi-bin/action.cgi\?cmd="${COMMAND}" -o /dev/null 2>/dev/null
|
||||
F_cmd="${COMMAND}" /system/sdcard/www/cgi-bin/action.cgi -o /dev/null 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}/${COMMAND}" ${MOSQUITTOOPTS} -m "OK (this means: action.cgi invoke with parameter ${COMMAND}, nothing more, nothing less)"
|
||||
else
|
||||
|
78
firmware_mod/scripts/telegram-bot-daemon.sh
Executable file
78
firmware_mod/scripts/telegram-bot-daemon.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
|
||||
CURL="/system/sdcard/bin/curl"
|
||||
LASTUPDATEFILE="/tmp/last_update_id"
|
||||
TELEGRAM="/system/sdcard/bin/telegram"
|
||||
JQ="/system/sdcard/bin/jq"
|
||||
|
||||
. /system/sdcard/config/telegram.conf
|
||||
[ -z $apiToken ] && echo "api token not configured yet" && exit 1
|
||||
[ -z $userChatId ] && echo "chat id not configured yet" && exit 1
|
||||
|
||||
sendShot() {
|
||||
/system/sdcard/bin/getimage > "/tmp/telegram_image.jpg" &&\
|
||||
$TELEGRAM p "/tmp/telegram_image.jpg"
|
||||
rm "/tmp/telegram_image.jpg"
|
||||
}
|
||||
|
||||
sendMem() {
|
||||
$TELEGRAM m $(free -k | awk '/^Mem/ {print "Mem: used "$3" free "$4} /^Swap/ {print "Swap: used "$3}')
|
||||
}
|
||||
|
||||
detectionOn() {
|
||||
. /system/sdcard/scripts/common_functions.sh
|
||||
motion_detection on && $TELEGRAM m "Motion detection started"
|
||||
}
|
||||
|
||||
detectionOff() {
|
||||
. /system/sdcard/scripts/common_functions.sh
|
||||
motion_detection off && $TELEGRAM m "Motion detection stopped"
|
||||
}
|
||||
|
||||
respond() {
|
||||
case $1 in
|
||||
/mem) sendMem;;
|
||||
/shot) sendShot;;
|
||||
/on) detectionOn;;
|
||||
/off) detectionOff;;
|
||||
*) $TELEGRAM m "I can't respond to '$1' command"
|
||||
esac
|
||||
}
|
||||
|
||||
readNext() {
|
||||
lastUpdateId=$(cat $LASTUPDATEFILE || echo "0")
|
||||
json=$($CURL -s -X GET "https://api.telegram.org/bot$apiToken/getUpdates?offset=$lastUpdateId&limit=1&allowed_updates=message")
|
||||
echo $json
|
||||
}
|
||||
|
||||
markAsRead() {
|
||||
nextId=$(($1 + 1))
|
||||
echo "$nextId" > $LASTUPDATEFILE
|
||||
}
|
||||
|
||||
main() {
|
||||
json=$(readNext)
|
||||
|
||||
[ "$(echo "$json" | $JQ -r '.ok')" != "true" ] && return 1
|
||||
|
||||
chatId=$(echo "$json" | $JQ -r '.result[0].message.chat.id // ""')
|
||||
[ -z "$chatId" ] && return 0 # no new messages
|
||||
|
||||
cmd=$(echo "$json" | $JQ -r '.result[0].message.text // ""')
|
||||
updateId=$(echo "$json" | $JQ -r '.result[0].update_id // ""')
|
||||
|
||||
if [ "$chatId" != "$userChatId" ]; then
|
||||
username=$(echo "$json" | $JQ -r '.result[0].message.from.username // ""')
|
||||
firstName=$(echo "$json" | $JQ -r '.result[0].message.from.first_name // ""')
|
||||
$TELEGRAM m "Received message from not authrized chat: $chatId\nUser: $username($firstName)\nMessage: $cmd"
|
||||
else
|
||||
respond $cmd
|
||||
fi;
|
||||
|
||||
markAsRead $updateId
|
||||
}
|
||||
|
||||
while true; do
|
||||
main >/dev/null 2>&1
|
||||
[ $? -gt 0 ] && exit 1
|
||||
done;
|
@@ -1,16 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /system/sdcard/www/cgi-bin/func.cgi
|
||||
. /system/sdcard/scripts/common_functions.sh
|
||||
|
||||
export LD_LIBRARY_PATH=/system/lib
|
||||
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
|
||||
|
||||
echo "Content-type: text/html"
|
||||
echo "Pragma: no-cache"
|
||||
echo "Cache-Control: max-age=0, no-store, no-cache"
|
||||
echo ""
|
||||
|
||||
source ./func.cgi
|
||||
source /system/sdcard/scripts/common_functions.sh
|
||||
|
||||
export LD_LIBRARY_PATH=/system/lib
|
||||
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
|
||||
|
||||
if [ -n "$F_cmd" ]; then
|
||||
if [ -z "$F_val" ]; then
|
||||
F_val=100
|
||||
@@ -447,6 +447,28 @@ if [ -n "$F_cmd" ]; then
|
||||
echo "Motion Configuration done"
|
||||
return
|
||||
;;
|
||||
autonight_sw)
|
||||
if [ ! -f /system/sdcard/config/autonight.conf ]; then
|
||||
echo "-S" > /system/sdcard/config/autonight.conf
|
||||
fi
|
||||
current_setting=$(sed 's/-S *//g' /system/sdcard/config/autonight.conf)
|
||||
echo "-S" $current_setting > /system/sdcard/config/autonight.conf
|
||||
;;
|
||||
autonight_hw)
|
||||
if [ -f /system/sdcard/config/autonight.conf ]; then
|
||||
sed -i 's/-S *//g' /system/sdcard/config/autonight.conf
|
||||
fi
|
||||
;;
|
||||
get_sw_night_config)
|
||||
cat /system/sdcard/config/autonight.conf
|
||||
exit
|
||||
;;
|
||||
save_sw_night_config)
|
||||
#This also enables software mode
|
||||
night_mode_conf=$(echo "${F_val}"| sed "s/+/ /g" | sed "s/%2C/,/g")
|
||||
echo $night_mode_conf > /system/sdcard/config/autonight.conf
|
||||
echo Saved $night_mode_conf
|
||||
;;
|
||||
offDebug)
|
||||
/system/sdcard/controlscripts/debug-on-osd stop
|
||||
|
||||
|
4
firmware_mod/www/cgi-bin/getispinfo.cgi
Normal file
4
firmware_mod/www/cgi-bin/getispinfo.cgi
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat /proc/jz/isp/isp_info
|
||||
|
9
firmware_mod/www/cgi-bin/state.cgi
Normal file → Executable file
9
firmware_mod/www/cgi-bin/state.cgi
Normal file → Executable file
@@ -40,7 +40,14 @@ if [ -n "$F_cmd" ]; then
|
||||
auto_night_detection)
|
||||
echo $(auto_night_mode status)
|
||||
;;
|
||||
|
||||
auto_night_detection_mode)
|
||||
if [ -f /system/sdcard/config/autonight.conf ];
|
||||
then night_mode=$(cat /system/sdcard/config/autonight.conf);
|
||||
else
|
||||
night_mode="HW";
|
||||
fi
|
||||
echo $night_mode
|
||||
;;
|
||||
mqtt_status)
|
||||
if [ -f /run/mqtt-status.pid ];
|
||||
then mqtt_status="ON";
|
||||
|
@@ -195,6 +195,10 @@ cat << EOF
|
||||
<div class="column">
|
||||
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=auto_night_mode_start')">On</button>
|
||||
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=auto_night_mode_stop')">Off</button>
|
||||
<input class="is-checkradio" id="night_config_hw" type="radio" name="night_config" $(if [ "$(grep -q -e "-S" /system/sdcard/config/autonight.conf; echo $?)" != 0 ]; then echo "checked"; fi) onClick="call('cgi-bin/action.cgi?cmd=autonight_hw')" >
|
||||
<label for="night_config_hw">HW</label>
|
||||
<input class="is-checkradio" id="night_config_sw" type="radio" name="night_config" $(if [ "$(grep -q -e "-S" /system/sdcard/config/autonight.conf; echo $?)" == 0 ]; then echo "checked"; fi) onClick="call('cgi-bin/action.cgi?cmd=autonight_sw')">
|
||||
<label for="night_config_sw">SW</label>
|
||||
</div>
|
||||
<div class="column">
|
||||
<form id="formldr" action="cgi-bin/action.cgi?cmd=setldravg" method="post">
|
||||
|
54
firmware_mod/www/css/sw_night.css
Normal file
54
firmware_mod/www/css/sw_night.css
Normal file
@@ -0,0 +1,54 @@
|
||||
input{
|
||||
text-align: center;
|
||||
font-family: monospace;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
.code_text{
|
||||
font-family: monospace;
|
||||
font-size: large;
|
||||
}
|
||||
.wait{
|
||||
font-family: monospace;
|
||||
font-size: large;
|
||||
background-color: #89fcfd;
|
||||
}
|
||||
.mode{
|
||||
font-family: monospace;
|
||||
font-size: large;
|
||||
background-color:#ffe944;
|
||||
box-shadow: 4px 4px 10px black;
|
||||
text-shadow: 1px 1px 1px black;
|
||||
}
|
||||
|
||||
.save_button{
|
||||
color: white;
|
||||
background-color: red;
|
||||
display: block;
|
||||
border:5
|
||||
font-size: 18px;
|
||||
width:20%;
|
||||
font-weight: bold;
|
||||
}
|
||||
input:disabled{
|
||||
font-family: monospace;
|
||||
font-size: large;
|
||||
}
|
||||
.jitter{
|
||||
background-color: #89fcfd;
|
||||
}
|
||||
.eq1{
|
||||
background-color: #89fcfd;
|
||||
}
|
||||
.eq2{
|
||||
background-color: #bad5dc;
|
||||
}
|
||||
.eq2_1{
|
||||
background-color: #98b8cf;
|
||||
}
|
||||
.eq3{
|
||||
background-color: #bad5dc;
|
||||
}
|
||||
.eq3_1{
|
||||
background-color: #98b8cf;
|
||||
}
|
@@ -19,6 +19,9 @@
|
||||
<script src="scripts/jquery.imgareaselect.pack.js" type="text/javascript"></script>
|
||||
<link href="css/imgareaselect-animated.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/smoothie/1.34.0/smoothie.js"></script>
|
||||
<link href="css/sw_night.css" rel="stylesheet">
|
||||
|
||||
<style id="custom_css">
|
||||
body {
|
||||
display: flex;
|
||||
@@ -184,6 +187,7 @@
|
||||
<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="sw_night" class="navbar-item onpage" href="javascript: void(0)" data-target="sw_night_configure.html">SW night configuration</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
|
490
firmware_mod/www/sw_night_configure.html
Normal file
490
firmware_mod/www/sw_night_configure.html
Normal file
@@ -0,0 +1,490 @@
|
||||
<h1 class="is-size-4">SW auto night setting</h1>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/smoothie/1.34.0/smoothie.js"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var cur_exposure=-1;
|
||||
var cur_iridix=-1;
|
||||
var cur_wb=-1;
|
||||
var cur_day=true;
|
||||
var eq2_count = 0;
|
||||
var eq3_count = 0;
|
||||
var fake = false;
|
||||
|
||||
|
||||
var exposure = new TimeSeries();
|
||||
var wb = new TimeSeries();
|
||||
var wb_rg = new TimeSeries();
|
||||
var wb_bg = new TimeSeries();
|
||||
var iridix = new TimeSeries();
|
||||
var gain = new TimeSeries();
|
||||
|
||||
function readIspInfo(){
|
||||
if(fake){
|
||||
$.get("getispinfo.html", function(data, status)
|
||||
{
|
||||
parseIspInfo(data);
|
||||
});
|
||||
}else{
|
||||
$.get("/cgi-bin/getIspInfo.cgi", function(data, status)
|
||||
{
|
||||
parseIspInfo(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
function parseIspInfo(data){
|
||||
var lines = data.split('\n');
|
||||
var d = new Date().getTime();
|
||||
for(var i = 0;i < lines.length;i++){
|
||||
for(var k=0; k<keys.length; k++){
|
||||
if(lines[i].startsWith(String(keys[k]))){
|
||||
var val = lines[i].split(":");
|
||||
serieses[k].append(d, val[1]);
|
||||
if(String(keys[k]).search('exposure') >= 0){
|
||||
cur_exposure = val[1];
|
||||
}else if(String(keys[k]).search('WB Temperature') >= 0){
|
||||
cur_wb = val[1];
|
||||
}else if(String(keys[k]).search('Iridix') >= 0){
|
||||
cur_iridix = val[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
update_values();
|
||||
}
|
||||
timeFormatter = function (date) {
|
||||
return date.getMinutes() * 60 + date.getSeconds();
|
||||
};
|
||||
|
||||
var serieses = [];
|
||||
var keys = [];
|
||||
var ids= [];
|
||||
var charts = [];
|
||||
|
||||
var timer;
|
||||
var running;
|
||||
|
||||
function getParams(){
|
||||
var canvases = $('#canvas_table canvas');
|
||||
var divs = $('#canvas_table div');
|
||||
var tds = $('#canvas_table td');
|
||||
for(var i=0; i<canvases.length; i++){
|
||||
var id = canvases[i].id;
|
||||
var key = divs[i].innerText;
|
||||
var width = tds[i*2+1].clientWidth;
|
||||
canvases[i].width = width;
|
||||
serieses[i] = new TimeSeries();
|
||||
keys[i] = key;
|
||||
ids[i] = id;
|
||||
}
|
||||
}
|
||||
|
||||
function startGraph(){
|
||||
for(var i=0; i<ids.length; i++){
|
||||
//charts[i] = new SmoothieChart({timestampFormatter: timeFormatter,nonRealtimeData: false,millisPerPixel:32,interpolation:'step',labels:{fontSize:10},limitFPS:15});
|
||||
var opt = {millisPerPixel:32,interpolation:'step',scaleSmoothing:1,labels:{fontSize:13},tooltip:true,limitFPS:15,horizontalLines:[{color:'#ffffff',lineWidth:1,value:0},{color:'#880000',lineWidth:2,value:3333},{color:'#880000',lineWidth:2,value:-3333}]};
|
||||
charts[i] = new SmoothieChart(opt);
|
||||
charts[i].addTimeSeries(serieses[i], { strokeStyle: 'rgba(0, 255, 0, 1)', fillStyle: 'rgba(0, 255, 0, 0.2)', lineWidth: 2 });
|
||||
charts[i].streamTo(document.getElementById(String(ids[i])));
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$.get("/cgi-bin/action.cgi?cmd=get_sw_night_config", function(data, status)
|
||||
{
|
||||
var list = data.split('-');
|
||||
var valid=false;
|
||||
var j = $("#jitter_percent").val();
|
||||
var w = $("#sec_wait").val();
|
||||
var e11 = $("#eq1_user_exposure").val();
|
||||
var e21 = $("#eq2_user_exposure").val();
|
||||
var e22 = $("#eq2_user_iridix").val();
|
||||
var e23 = $("#eq2_count").val();
|
||||
var e31 = $("#eq3_user_wb").val();
|
||||
var e32 = $("#eq3_user_iridix").val();
|
||||
var e33 = $("#eq3_count").val();;
|
||||
|
||||
for(var i=0; i<list.length; i++){
|
||||
switch (list[i][0]){
|
||||
case 'S':
|
||||
valid = true;
|
||||
break;
|
||||
case 'j':
|
||||
j = parseInt(list[i].substring(1)) || j;
|
||||
break;
|
||||
case 'w':
|
||||
w = parseInt(list[i].substring(1)) || w;
|
||||
break;
|
||||
case '1':
|
||||
e11 = parseInt(list[i].substring(1)) || e11;
|
||||
break;
|
||||
case '2':
|
||||
var p = list[i].split(' ');
|
||||
var p2 = p[1].split(',');
|
||||
e21 = parseInt(p2[0]) || e21;
|
||||
e22 = parseInt(p2[1]) || e22;
|
||||
e23 = parseInt(p2[2]) || e23;
|
||||
break;
|
||||
case '3':
|
||||
var p = list[i].split(' ');
|
||||
var p2 = p[1].split(',');
|
||||
e31 = parseInt(p2[0]) || e31;
|
||||
e32 = parseInt(p2[1]) || e32;
|
||||
e33 = parseInt(p2[2]) || e33;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$("#jitter_percent").val(j);
|
||||
$("#sec_wait").val(w);
|
||||
$("#eq1_user_exposure").val(e11);
|
||||
if(e21 == 0){
|
||||
$('#eq2').prop('checked', false);
|
||||
}else{
|
||||
$("#eq2_user_exposure").val(e21);
|
||||
$("#eq2_user_iridix").val(e22);
|
||||
$("#eq2_count").val(e23);
|
||||
}
|
||||
if(e31 == 0){
|
||||
$('#eq3').prop('checked', false);
|
||||
}else{
|
||||
$("#eq3_user_wb").val(e31);
|
||||
$("#eq3_user_iridix").val(e32);
|
||||
$("#eq3_count").val(e33);
|
||||
}
|
||||
night_mode(false);
|
||||
getParams();
|
||||
startGraph();
|
||||
readIspInfo();
|
||||
timer = setInterval(readIspInfo, 1000);
|
||||
running = true;
|
||||
});
|
||||
});
|
||||
function sw_night_config_pageDone()
|
||||
{
|
||||
clearInterval(timer);
|
||||
}
|
||||
|
||||
|
||||
$('#play').click(function (event) {
|
||||
/*if(running){
|
||||
clearInterval(timer);
|
||||
running = false;
|
||||
$('#play').html("Play");
|
||||
for(var i=0; i<charts.length; i++){
|
||||
charts[i].stop();
|
||||
}
|
||||
}else{
|
||||
timer = setInterval(readIspInfo, 1000);
|
||||
running = true;
|
||||
$('#play').html("Pause");
|
||||
for(var i=0; i<charts.length; i++){
|
||||
charts[i].start();
|
||||
}
|
||||
}*/
|
||||
});
|
||||
function ir_led(val){
|
||||
var cmd = (val) ? "cgi-bin/action.cgi?cmd=ir_led_on" : "cgi-bin/action.cgi?cmd=ir_led_off";
|
||||
$.get(cmd, function(data, status){});
|
||||
}
|
||||
function ir_cut(val){
|
||||
var cmd = (val) ? "cgi-bin/action.cgi?cmd=ir_cut_on" : "cgi-bin/action.cgi?cmd=ir_cut_off";
|
||||
$.get(cmd, function(data, status){});
|
||||
}
|
||||
|
||||
function night_mode(val){
|
||||
var cmd = 'cgi-bin/action.cgi?cmd=toggle-rtsp-nightvision-' + ((val) ? "on" : "off");
|
||||
if(!fake) ir_led(true);
|
||||
if(val){
|
||||
if(!fake) $.get(cmd, function(data, status){});
|
||||
if(!fake) ir_cut(!val);
|
||||
}else{
|
||||
if(!fake) ir_cut(!val);
|
||||
if(!fake) $.get(cmd, function(data, status){});
|
||||
}
|
||||
cur_day = !val;
|
||||
$('#cur_mode')[0].innerText = (cur_day) ? "Day mode" : "Night mode";
|
||||
$('#cur_mode').css( "color", (cur_day) ? "black" : "white" );
|
||||
$('#cur_mode').css( "background-color", (cur_day) ? "white" : "black" );
|
||||
$(".eq2").css( "box-shadow", "" );
|
||||
$(".eq3").css( "box-shadow", "" );
|
||||
mode_switch_wait_count = parseInt($("#sec_wait")[0].value);
|
||||
}
|
||||
|
||||
function update_commandline()
|
||||
{
|
||||
var cmdline = "-S -j " + $("#jitter_percent")[0].value + " -w " + $("#sec_wait")[0].value;
|
||||
cmdline += " -1 " + $("#eq1_user_exposure")[0].value;
|
||||
cmdline += " -2 ";
|
||||
cmdline += $("#eq2")[0].checked ? ($("#eq2_user_exposure")[0].value + "," + ($("#eq2_1")[0].checked ? $("#eq2_user_iridix")[0].value : "9999") + "," + $("#eq2_count")[0].value) : "0,0,1";
|
||||
cmdline += " -3 ";
|
||||
cmdline += $("#eq3")[0].checked ? ($("#eq3_user_wb")[0].value + "," + ($("#eq3_1")[0].checked ? $("#eq3_user_iridix")[0].value : "0") + "," + $("#eq3_count")[0].value) : "0,0,1";
|
||||
|
||||
$("#command_line")[0].value = cmdline;
|
||||
}
|
||||
|
||||
var last_exposure = 0;
|
||||
var mode_switch_wait_count=0;
|
||||
var sec=0;
|
||||
function update_values(){
|
||||
var eq1_pass=false, eq2_pass=false, eq3_pass=false, eq2_1_pass=false, eq3_1_pass=false;
|
||||
var jitter_percent;
|
||||
|
||||
try{
|
||||
jitter_percent = parseInt($("#jitter_percent")[0].value);
|
||||
}catch(e){
|
||||
return sw_night_config_pageDone();
|
||||
}
|
||||
|
||||
update_commandline();
|
||||
|
||||
$('#exposure_eq1')[0].value = cur_exposure;
|
||||
$('#exposure_eq2')[0].value = cur_exposure;
|
||||
$('#iridix_eq2')[0].value = cur_iridix;
|
||||
$('#iridix_eq3')[0].value = cur_iridix;
|
||||
$('#wb_eq3')[0].value = cur_wb;
|
||||
sec++;
|
||||
sec = sec % 60;
|
||||
$('#sec')[0].innerText = sec;
|
||||
|
||||
if( (Math.abs(cur_exposure - last_exposure)/cur_exposure)*100 >= jitter_percent ){
|
||||
last_exposure = cur_exposure;
|
||||
$(".jitter").css( "font-weigth", "bold" );
|
||||
$(".jitter").css( "background-color", "#ff9292" );
|
||||
$(".jitter").css( "box-shadow", "8px 6px 13px #f5194b" );
|
||||
eq2_count = 0;
|
||||
eq3_count = 0;
|
||||
$('#count_eq2')[0].value = eq2_count;
|
||||
$('#count_eq3')[0].value = eq3_count;
|
||||
return;
|
||||
}
|
||||
$(".jitter").css( "font-weigth", "normal" );
|
||||
$(".jitter").css( "background-color", "#89fcfd" );
|
||||
$(".jitter").css( "box-shadow", "" );
|
||||
last_exposure = cur_exposure;
|
||||
if(cur_exposure > parseInt($("#eq1_user_exposure")[0].value)){
|
||||
$("#exposure_eq1").css('color', "green");
|
||||
eq1_pass = true;
|
||||
}else{
|
||||
$("#exposure_eq1").css('color', "red");
|
||||
}
|
||||
if(cur_exposure < parseInt($("#eq2_user_exposure")[0].value)){
|
||||
$("#exposure_eq2").css('color', "green");
|
||||
eq2_pass=true;
|
||||
}else{
|
||||
$("#exposure_eq2").css('color', "red");
|
||||
}
|
||||
if(cur_iridix < parseInt($("#eq2_user_iridix")[0].value)){
|
||||
eq2_1_pass = true;
|
||||
$("#iridix_eq2").css('color', "green");
|
||||
}else{
|
||||
$("#iridix_eq2").css('color', "red");
|
||||
}
|
||||
if(cur_wb < parseInt($("#eq3_user_wb")[0].value)){
|
||||
$("#wb_eq3").css('color', "green");
|
||||
eq3_pass=true;
|
||||
}else{
|
||||
$("#wb_eq3").css('color', "red");
|
||||
}
|
||||
if(cur_iridix > parseInt($("#eq3_user_iridix")[0].value)){
|
||||
eq3_1_pass = true;
|
||||
$("#iridix_eq3").css('color', "green");
|
||||
}else{
|
||||
$("#iridix_eq3").css('color', "red");
|
||||
}
|
||||
|
||||
var eq2_enabled = $("#eq2")[0].checked;
|
||||
var eq2_1_enabled = $("#eq2_1")[0].checked;
|
||||
var eq3_enabled = $("#eq3")[0].checked;
|
||||
var eq3_1_enabled = $("#eq3_1")[0].checked;
|
||||
|
||||
if(mode_switch_wait_count){
|
||||
mode_switch_wait_count--;
|
||||
$(".wait").css( "box-shadow", "8px 6px 13px #f5194b" );
|
||||
}else{
|
||||
$(".wait").css( "box-shadow", "" );
|
||||
if(cur_day == true){
|
||||
if(eq1_pass){
|
||||
night_mode(true);
|
||||
eq2_count = 0;
|
||||
eq3_count = 0;
|
||||
}
|
||||
}else{
|
||||
if(eq2_enabled && eq2_pass && ((eq2_1_enabled && eq2_1_pass) || (eq2_1_enabled == false)) ){
|
||||
$(".eq2").css( "box-shadow", "8px 6px 13px #f5194b" );
|
||||
eq2_count++;
|
||||
if(eq2_count > parseInt($("#eq2_count")[0].value)){
|
||||
night_mode(false);
|
||||
}
|
||||
}else{
|
||||
$(".eq2").css( "box-shadow", "" );
|
||||
eq2_count = 0;
|
||||
}
|
||||
if(eq3_enabled && eq3_pass && ((eq3_1_enabled && eq3_1_pass) || (eq3_1_enabled == false)) ){
|
||||
$(".eq3").css( "box-shadow", "8px 6px 13px #f5194b" );
|
||||
eq3_count++;
|
||||
if(eq3_count > parseInt($("#eq3_count")[0].value )){
|
||||
night_mode(false);
|
||||
}
|
||||
}else{
|
||||
$(".eq3").css( "box-shadow", "" );
|
||||
eq3_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#count_eq2')[0].value = eq2_count;
|
||||
$('#count_eq3')[0].value = eq3_count;
|
||||
|
||||
}
|
||||
function eq_click(name){
|
||||
update_commandline();
|
||||
if($("#"+name)[0].checked){
|
||||
$("."+name).css( "opacity", "1.0" );
|
||||
//$("."+name+"_1").css( "opacity", "1.0" );
|
||||
$("#"+name+"_1")[0].disabled = false;
|
||||
eq_1_click(name);
|
||||
}else{
|
||||
$("."+name).css( "opacity", "0.7" );
|
||||
$("."+name+"_1").css( "opacity", "0.7" );
|
||||
$("#"+name+"_1")[0].disabled = true;
|
||||
}
|
||||
}
|
||||
function eq_1_click(name){
|
||||
update_commandline();
|
||||
if($("#"+name+"_1")[0].checked){
|
||||
$("."+name+"_1").css( "opacity", "1.0" );
|
||||
}else{
|
||||
$("."+name+"_1").css( "opacity", "0.7" );
|
||||
}
|
||||
}
|
||||
$('#swNightForm').submit(function (event) {
|
||||
debugger;
|
||||
var b = $('#sw_night_submit');
|
||||
b.toggleClass('is-loading');
|
||||
b.prop('disabled', !b.prop('disabled'));
|
||||
|
||||
var formData = {
|
||||
'val' : $("#command_line").val()
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $('#swNightForm').attr('action'),
|
||||
data: formData,
|
||||
dataType: 'html',
|
||||
encode: true
|
||||
}).done(function (res) {
|
||||
b.toggleClass('is-loading');
|
||||
b.prop('disabled', !b.prop('disabled'));
|
||||
showResult(res);
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
</script>
|
||||
|
||||
Please stop autonight detection service if its running.
|
||||
|
||||
<form id="swNightForm" action="cgi-bin/action.cgi?cmd=save_sw_night_config" method="post">
|
||||
<!--button id='play' type="button">Pause</button-->
|
||||
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td><table border="1" class='mode'>
|
||||
<tr><td><label>Current mode</label></td><td><label id='cur_mode'>Day mode</label></td></tr>
|
||||
<tr><td><label>Seconds</label></td><td><label id='sec'>0</label></td></tr>
|
||||
</table></td>
|
||||
<td><table class='mode'>
|
||||
<tr><td>Commandline to use:</td>
|
||||
<td><input type="text" id="command_line" disabled=true value="-S" size="60" style="text-align:left;"></td></tr>
|
||||
<tr><td colspan="2"><input style="display: block; text-align: center; margin: auto;" class='button is-primary' id="sw_night_submit" type="submit" value="Save"></button></td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<td><table border="1" id="t_jitter" style="margin: 0px;" class='jitter'>
|
||||
<tr><td class='code_text'>If expousre changes by more than </td>
|
||||
<td class='code_text'><input type="text" id="jitter_percent" value=3 size="3"> %, ignore</td></tr>
|
||||
</table></td>
|
||||
|
||||
<br>
|
||||
<table border="1" id="t_wait" style="margin: 0px;" class='wait'>
|
||||
<tr><td class='code_text'>Wait </td>
|
||||
<td class='code_text'><input type="text" id="sec_wait" value=3 size="3"> sec after changing mode</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table border="1" id="t_eq1" style="margin: 0px;" class='eq1'>
|
||||
<tr><td class='code_text'>If <br></td>
|
||||
<td><table border='0'>
|
||||
<tr><td> <input type="text" class='code_text' id="exposure_eq1" disabled=true value=90000 size="8"> </td></tr>
|
||||
<tr><td allign='center' class='code_text'>exposure >   </td></tr>
|
||||
</table></td>
|
||||
<td><input type="text" id="eq1_user_exposure" value=1200000 size="8"></td>
|
||||
<td allign='center' class='code_text'>enable night mode </td>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table border="1" id="t_eq2" style="margin: 0px;" class='eq2'>
|
||||
<tr><td rowspan='2'><input type="checkbox" checked=true id="eq2" onclick='eq_click("eq2")'></td><td class='code_text'> If <br></td>
|
||||
<td><table border='0'>
|
||||
<tr><td> <input type="text" id="exposure_eq2" disabled=true value=90000 size="8"> </td></tr>
|
||||
<tr><td class='code_text' allign='center'>exposure <   </td></tr>
|
||||
</table></td>
|
||||
<td><input type="text" id="eq2_user_exposure" value=930000 size="8"></td>
|
||||
<td><table border='0' class='eq2_1'><tr>
|
||||
<tr><td><input type="checkbox" checked=true id="eq2_1"onclick='eq_1_click("eq2")'></td><td class='code_text'> and </td>
|
||||
<td><table border='0'>
|
||||
<tr><td> <input type="text" id="iridix_eq2" disabled=true value=10 size="3"> </td></tr>
|
||||
<tr border='1' ><td allign='center' class='code_text'>Iridix <   </td></tr>
|
||||
</td></table>
|
||||
<td><input type="text" id="eq2_user_iridix" value=14 size="3"></td>
|
||||
<td><td class='code_text'>   then increcement count</td>
|
||||
</tr></table></td>
|
||||
</td></tr>
|
||||
<tr><td colspan="3"></td>
|
||||
<td><table>
|
||||
<tr><td><input type="text" id="count_eq2" disabled=true value=0 size="2"></td></tr>
|
||||
<tr><td class='code_text'>if count > <input type="text" id="eq2_count" value=10 size="3" class='code_text'> switch to day mode </tr>
|
||||
</table></td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<table border="1" id="t_eq3" style="margin: 0px;" class='eq3'>
|
||||
<tr><td rowspan='2'><input type="checkbox" checked=true id="eq3" onclick='eq_click("eq3")'></td><td class='code_text'> If <br></td>
|
||||
<td><table border='0'>
|
||||
<tr><td class='code_text'> <input type="text" id="wb_eq3" disabled=true value=2800 size="5"> </td></tr>
|
||||
<tr><td allign='center' class='code_text'>WhiteBalance temp <  </td></tr>
|
||||
</table></td>
|
||||
<td class='code_text'><input type="text" id="eq3_user_wb" value=3000 size="5"></td>
|
||||
<td><table border='0' class='eq3_1'><tr>
|
||||
<tr><td><input type="checkbox" checked=true id="eq3_1" onclick='eq_1_click("eq3")'></td><td class='code_text'> and </td>
|
||||
<td><table border='0'>
|
||||
<tr><td class='code_text'> <input type="text" id="iridix_eq3" disabled=true value=10 size="3"> </td></tr>
|
||||
<tr><td allign='center' class='code_text'>Iridix >  </td></tr>
|
||||
</td></table>
|
||||
<td class='code_text'><input type="text" id="eq3_user_iridix" value=17 size="3"></td>
|
||||
<td class='code_text'>   then increcement count</td>
|
||||
</tr></table></td>
|
||||
</td></tr>
|
||||
<tr><td colspan="3"></td>
|
||||
<td><table>
|
||||
<tr><td><input type="text" id="count_eq3" disabled=true value=0 size="2"></td></tr>
|
||||
<tr><td class='code_text'>if count > <input type="text" id="eq3_count" value=8 size="3" class='code_text'> switch to day mode </tr>
|
||||
</table></td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</form>
|
||||
|
||||
<table border="1" width="100%" id="canvas_table" style="margin: 0px;">
|
||||
<tr> <td width="10%"><div>ISP exposure log2 id</div></td> <td><canvas id="exp_chart" height="150"></canvas></td> </tr>
|
||||
<tr> <td><div>ISP WB Temperature</div></td> <td><canvas id="wb_chart" height="150"></canvas></td> </tr>
|
||||
<tr> <td><div>ISP Iridix strength</div></td> <td><canvas id="iridix_chart" height="150"></canvas></td> </tr>
|
||||
</table>
|
BIN
firmware_original/dafang/5.6.2.106/backupa.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/backupa.bin
Executable file
Binary file not shown.
BIN
firmware_original/dafang/5.6.2.106/backupd.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/backupd.bin
Executable file
Binary file not shown.
1
firmware_original/dafang/5.6.2.106/backupk.bin
Executable file
1
firmware_original/dafang/5.6.2.106/backupk.bin
Executable file
File diff suppressed because one or more lines are too long
BIN
firmware_original/dafang/5.6.2.106/config.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/config.bin
Executable file
Binary file not shown.
BIN
firmware_original/dafang/5.6.2.106/driver.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/driver.bin
Executable file
Binary file not shown.
1
firmware_original/dafang/5.6.2.106/flag.bin
Executable file
1
firmware_original/dafang/5.6.2.106/flag.bin
Executable file
File diff suppressed because one or more lines are too long
BIN
firmware_original/dafang/5.6.2.106/kernel.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/kernel.bin
Executable file
Binary file not shown.
BIN
firmware_original/dafang/5.6.2.106/para.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/para.bin
Executable file
Binary file not shown.
BIN
firmware_original/dafang/5.6.2.106/rootfs.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/rootfs.bin
Executable file
Binary file not shown.
BIN
firmware_original/dafang/5.6.2.106/uboot.bin
Executable file
BIN
firmware_original/dafang/5.6.2.106/uboot.bin
Executable file
Binary file not shown.
@@ -21,7 +21,7 @@ Yes, you can. However there is no need to revert it back. If your SD-Card does n
|
||||
### Is it possible to run the CFW without a microsd?
|
||||
No that's not possible. It can be done, but there will be a lot of trouble in doing this.
|
||||
|
||||
## Can i have FULLHD?
|
||||
## Can i have FullHD?
|
||||
|
||||
Yes, you can flash a custom bootloader to achieve this.
|
||||
|
||||
@@ -49,4 +49,8 @@ Recording Audio:
|
||||
```
|
||||
- Curl
|
||||
- MQTT
|
||||
- Anything other that you can compile yourself. There is a toolchain avaible.
|
||||
- Anything other that you can compile yourself. There is a toolchain available.
|
||||
|
||||
What if my scripts in config/userscripts/motiondetection are not executed or mqtt/telegram messages/emails are not sent on motion?
|
||||
|
||||
Your camera probably runs out of memory when processing the motion event. Try to [enable some swap memory](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/230f4d3cf306d7842287e9e5002d806513c4b2b8/firmware_mod/run.sh#L59).
|
||||
|
@@ -1,92 +1,89 @@
|
||||
# Flashing an Open-Source U-Boot
|
||||
# Flashing an open source U-Boot bootloader
|
||||
|
||||
## What benefits does this open source bootloader have?
|
||||
|
||||
1. You can use H264 FullHD Streaming (1920x1080)(128MB devices only)
|
||||
2. You can boot your own kernel/rootfs/whatever from MicroSD
|
||||
1. You can use H264 FullHD streaming (1920x1080)(on 128MB devices only)
|
||||
2. You can boot your own kernel/rootfs from MicroSD
|
||||
3. You can change your kernel boot-parameters (uEnv.txt)
|
||||
4. You can flash your NAND using this bootloader
|
||||
5. It should work on nearly all T20 based devices.
|
||||
5. It should work on most T20 based devices.
|
||||
6. The parameters could be changed through fw_printenv
|
||||
7. It is completely open source - Check the source here: https://github.com/Dafang-Hacks/uboot
|
||||
|
||||
7. It is completely [open source](https://github.com/Dafang-Hacks/uboot)
|
||||
|
||||
## What are the disadvantages?
|
||||
You can brick your device, if you flash the wrong u-boot. I am not taking any responsibility for that!
|
||||
If you flash the wrong u-boot, you can brick your device. I am not taking any responsibility for that!
|
||||
|
||||
## Requirements:
|
||||
|
||||
1. Find out how much RAM your device have by running following command via SSH:
|
||||
1. Determine how much RAM your device has by running following command via SSH:
|
||||
```$bash
|
||||
[root@DafangHacks:~]# cat /proc/cmdline
|
||||
cat /proc/cmdline
|
||||
```
|
||||
|
||||
|
||||
You will get an output similar to that:
|
||||
You should get an output like this:
|
||||
|
||||
```$bash
|
||||
console=ttyS1,115200n8 mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000 init=/linuxrc root=/dev/mmcblk0p2 rootwait rootfstype=ext4 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)
|
||||
```
|
||||
|
||||
Count together the values from each "mem"-section:
|
||||
Sum up the values from each "mem"-section:
|
||||
|
||||
mem = 104M
|
||||
mem + ispmem +rmem = 104M + 8M +16M = 128M
|
||||
|
||||
rmem = 16M
|
||||
i.e. you have a device with 128 Mb RAM.
|
||||
|
||||
ispmem = 8M
|
||||
|
||||
-> Together 128M -> You have a 128Mb Ram Device
|
||||
|
||||
## Flashing U-Boot:
|
||||
## Flashing the U-Boot bootloader:
|
||||
|
||||
1. Login via SSH
|
||||
2. Get one of the following Files according to your amount of Ram & your device:
|
||||
https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader
|
||||
|
||||
3. Put the File to your microsd
|
||||
4. **Verify the MD5 Hash of the file!! Do not skip this step, or you may brick your cam!**
|
||||
3. Run following command
|
||||
2. Get the correct [bootloader](https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader) for your device and RAM size.
|
||||
3. Put the bootloader file on your microsd
|
||||
4. **Verify the MD5 hash of the file!! Do not skip this step or you may brick your camera!**
|
||||
3. Run the following commands
|
||||
|
||||
```bash
|
||||
flash_eraseall /dev/mtd0
|
||||
dd if=<filename.bin> of=/dev/mtd0
|
||||
```
|
||||
```bash
|
||||
dd if=dafang_128mb_v1.bin of=/dev/mtd0
|
||||
```
|
||||
Don't do anything stupid inbetween.
|
||||
If you crash your camera, you end up without a working bootloader.
|
||||
|
||||
## Verify that the U-Boot-Loader works correctly
|
||||
1. Get an uEnv.bootfromnand.txt file from *__* this repository.
|
||||
2. Rename the uEnv.bootfromnand.txt to uEnv.txt
|
||||
3. Reboot your camera
|
||||
|
||||
## Verifying the U-Boot-Loader
|
||||
1. Get a uEnv.bootfromnand.txt file from*__* this repository.
|
||||
1. Rename the uEnv.bootfromnand.txt to uEnv.txt
|
||||
2. Boot your camera
|
||||
|
||||
The bootloader is configured to enable the blue-led if it takes the configuration from the uEnv.txt as soon as it boots up.
|
||||
The bootloader is configured to enable the blue led if it has found a valid uEnv.txt during boot up.
|
||||
Take a look at your LED when it first turns on.
|
||||
|
||||
If it turns yellow -> The normal configuration is being taken
|
||||
If the led turns yellow -> The default configuration is used.
|
||||
|
||||
If it turns blue -> Custom Configuration from uEnv.txt is being taken.
|
||||
If the led turns blue -> The custom configuration from uEnv.txt is used.
|
||||
|
||||
If its not turning blue despite that you have a uEnv.txt on your microsd - try to format it as FAT16 and try again
|
||||
If the led is not turning blue despite having an uEnv.txt on your microsd - try to format the sdcard as FAT16 and try again.
|
||||
|
||||
|
||||
## Turning on FULLHD(128Mb Devices only):
|
||||
## Enable FullHD (on 128 Mb devices only):
|
||||
|
||||
Open up the uEnv.txt file and change the "boot-line" from
|
||||
Open the uEnv.txt file
|
||||
|
||||
mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000
|
||||
```$bash
|
||||
vi /system/sdcard/uEnv.txt
|
||||
```
|
||||
and change the "boot-line" from:
|
||||
|
||||
to
|
||||
`mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000`
|
||||
|
||||
mem=87M@0x0 ispmem=9M@0x5700000 rmem=32M@0x6000000
|
||||
|
||||
|
||||
Check if its being applied using the following command:
|
||||
to:
|
||||
|
||||
[root@DafangHacks:~]# cat /proc/cmdline
|
||||
`mem=87M@0x0 ispmem=9M@0x5700000 rmem=32M@0x6000000`
|
||||
|
||||
Reboot and check if the bootline has been applied properly using the following command:
|
||||
|
||||
```$bash
|
||||
cat /proc/cmdline
|
||||
```
|
||||
|
||||
## My camera doesn't boot/I have failed flashing the bootloader - what now?
|
||||
You will need to desolder your chip, reflash it and solder it back.
|
||||
Here is information about how to do it:
|
||||
https://github.com/Dafang-Hacks/spiflasher
|
||||
## My camera doesn't boot/I have failed to flash the bootloader. What can I do now?
|
||||
You will need to desolder your bootrom, [reflash it](https://github.com/Dafang-Hacks/spiflasher) and solder it back.
|
||||
|
@@ -11,7 +11,7 @@
|
||||
Sannce & clones | [Start here](/hacks/install_sannce.md)
|
||||
Other Ingenic T10/T20 Device | [Start here](/hacks/newdevices.md)
|
||||
|
||||
2. Format your microSD to FAT32. NTFS, EXFAT etc. won't work.
|
||||
2. Format your microSD to FAT32. NTFS, EXFAT etc. won't work. Try to use smaller older SD cards like 512 MB or create just a single primary 512 MB partition on it for maximum success rate.
|
||||
3. Copy the CFW-Binary from step 1 to the formatted microSD card and rename it to "demo.bin". There must not be other files on the microSD! This is really important and it won't work if there are any other files on there.
|
||||
4. Remove the power cable from the camera and plug the microSD card into the camera
|
||||
5. Hold down the setup button on the camera while
|
||||
@@ -76,7 +76,7 @@ Remove the "run.sh" file from the microSD card.
|
||||
|
||||
## Community Tips
|
||||
|
||||
1. Use microSD cards smaller than 1GB such as 512MB and overwrite the same cards to minimize variations.
|
||||
1. Use microSD cards smaller than 1 GB such as 512 MB and overwrite the same cards to minimize variations. Formatting only the first 512 MB has also worked for some people.
|
||||
2. If the bootloader step is not working, double check the microSD card again for files or folders created by the stock firmware. (Sometimes if your timing is off with the setup press the camera will create a time stamp related folder that needs to be deleted before trying again).
|
||||
3. Make a note of the MAC for the camera and if possible set up DHCP to assign a specific IP address that can be monitored visually in DHCP logs.
|
||||
4. Start with fewer entries in your wpa_supplicant.conf to isolate WiFi issues.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
### On the Home Assistant side
|
||||
|
||||
First let's set up your camera stream. Make sure the rtsp-h264 service in the [service control panel](http://dafang/cgi-bin/scripts.cgi) is running and you can connect to [it](rtsp://dafang:8554/unicast) via e.g. vlc player.
|
||||
First let's set up your camera stream. Make sure the rtsp-h264 service in the [service control panel](http://dafang/cgi-bin/scripts.cgi) is running and you can connect to it via a media player (like VLC) using the address `rtsp://dafang:8554/unicast`.
|
||||
|
||||

|
||||
|
||||
|
@@ -1,17 +1,121 @@
|
||||
{
|
||||
"platform":"Camera-ffmpeg",
|
||||
"cameras":[
|
||||
{
|
||||
"name":"Camera Name",
|
||||
"videoConfig":{
|
||||
"source":"-rtsp_transport tcp -i rtsp://dafang.local/unicast",
|
||||
"stillImageSource":"-rtsp_transport tcp -i rtsp://dafang.local/unicast -vframes 1 -r 1",
|
||||
"maxStreams":5,
|
||||
"maxWidth":1280,
|
||||
"maxHeight":720,
|
||||
"maxFPS":25,
|
||||
"vcodec":"h264_omx"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"platforms": [
|
||||
{
|
||||
"platform": "Dafang",
|
||||
"mqtt": {
|
||||
"port": 1883,
|
||||
"host": "localhost"
|
||||
},
|
||||
"cameras": [{
|
||||
"cameraName": "My Dafang",
|
||||
"cameraRTSPStreamUrl": "rtsp://DAFANG_IP:8554/unicast",
|
||||
"mqttTopic": "myhome/dafang/#",
|
||||
"disableStream": false,
|
||||
"folder": "/root/Recordings/",
|
||||
"segmentLength": 60,
|
||||
"maxDirSize": 2048,
|
||||
"checkStorageSizeInterval": 300,
|
||||
"accessories": [
|
||||
{
|
||||
"name": "Living Room Motion Sensor",
|
||||
"type": "motionSensor",
|
||||
"threshold": 300000
|
||||
},
|
||||
{
|
||||
"name": "Living Room Auto Motion Tracking Switch",
|
||||
"type": "autoMotionTrackingSwitch"
|
||||
},
|
||||
{
|
||||
"name": "Living Room Night Vision Sensor",
|
||||
"type": "nightVisionSensor",
|
||||
"threshold": 0
|
||||
},
|
||||
{
|
||||
"name": "Living Room Night Vision Switch",
|
||||
"type": "nightVisionSwitch"
|
||||
},
|
||||
{
|
||||
"name": "Living Room Auto Night Vision Switch",
|
||||
"type": "autoNightVisionSwitch"
|
||||
},
|
||||
{
|
||||
"name": "Horizontal Left",
|
||||
"type": "moveCamera",
|
||||
"axis": "horizontal",
|
||||
"direction": "left"
|
||||
},
|
||||
{
|
||||
"name": "Horizontal Right",
|
||||
"type": "moveCamera",
|
||||
"axis": "horizontal",
|
||||
"direction": "right"
|
||||
},
|
||||
{
|
||||
"name": "Vertical Up",
|
||||
"type": "moveCamera",
|
||||
"axis": "vertical",
|
||||
"direction": "up"
|
||||
},
|
||||
{
|
||||
"name": "Vertical Down",
|
||||
"type": "moveCamera",
|
||||
"axis": "vertical",
|
||||
"direction": "down"
|
||||
},
|
||||
{
|
||||
"name": "Record Video",
|
||||
"type": "recordVideo"
|
||||
},
|
||||
{
|
||||
"name": "Record Audio",
|
||||
"type": "recordAudio"
|
||||
},
|
||||
{
|
||||
"name": "Capture Image",
|
||||
"type": "captureImage"
|
||||
},
|
||||
{
|
||||
"name": "RPi Storage Sensor",
|
||||
"type": "storageSensor"
|
||||
},
|
||||
{
|
||||
"name": "Clear Storage Switch",
|
||||
"type": "clearStorage"
|
||||
},
|
||||
{
|
||||
"name": "Reset Streaming",
|
||||
"type": "resetFFMPEG"
|
||||
},
|
||||
{
|
||||
"name": "Motion Detection Switch",
|
||||
"type": "motionDetection"
|
||||
},
|
||||
{
|
||||
"name": "RTSPSwitch",
|
||||
"type": "rtspSwitch"
|
||||
},
|
||||
{
|
||||
"name": "MJPEG Switch",
|
||||
"type": "mjpegSwitch"
|
||||
},
|
||||
{
|
||||
"name": "Recalibrate Switch",
|
||||
"type": "recalibrateSwitch"
|
||||
},
|
||||
{
|
||||
"name": "Restart Switch",
|
||||
"type": "restartSwitch"
|
||||
},
|
||||
{
|
||||
"name": "ReMount Switch",
|
||||
"type": "remountSwitch"
|
||||
},
|
||||
{
|
||||
"name": "Camera Brightness",
|
||||
"type": "brightness"
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -1,6 +1,23 @@
|
||||
## Integration in HomeKit
|
||||
|
||||
HomeKit integration is possible via the [ Homebridge ffmpeg plugin](https://github.com/KhaosT/homebridge-camera-ffmpeg).
|
||||
## Using Homebridge-Dafang Plugin (Supports Additional Switches & Features)
|
||||
|
||||
HomeKit integration is possible via the [ Homebridge Dafang Plugin](https://github.com/sahilchaddha/homebridge-dafang).
|
||||
|
||||
### Installation
|
||||
|
||||
1. Install ffmpeg on your computer
|
||||
2. Install the plugin using: `npm install -g homebridge-dafang`
|
||||
3. Edit [config.json](config.json) and add your camera.
|
||||
4. Run Homebridge
|
||||
5. Add extra camera accessories in Home app. The setup code is the same as in homebridge.
|
||||
|
||||
### Detailed Installation
|
||||
|
||||
1. [ Installation Guide ](https://github.com/sahilchaddha/homebridge-dafang#readme)
|
||||
2. [ MQTT & Camera Setup ](https://github.com/sahilchaddha/homebridge-dafang/blob/master/Setup_MQTT.md)
|
||||
|
||||
## Using Homebridge-camera-ffmpeg (Only Camera Stream)
|
||||
|
||||
### Installation
|
||||
|
||||
|
Reference in New Issue
Block a user