Skip to content

Commit 21863f8

Browse files
committed
webhookにalarm_video/alarm_pictureの送信を追加
1 parent 4fecf24 commit 21863f8

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

atomcam_configs/overlay_rootfs/scripts/rm.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ STORAGE_CIFS=$(awk -F "=" '/STORAGE_CIFS *=/ {print $2}' $HACK_INI)
1717
STORAGE_CIFSSERVER=$(awk -F "=" '/STORAGE_CIFSSERVER *=/ {gsub(/\/$/, "", $2); print $2}' $HACK_INI)
1818
STORAGE_CIFSUSER=$(awk -F "=" '/STORAGE_CIFSUSER *=/ {print $2}' $HACK_INI)
1919
STORAGE_CIFSPASSWD=$(awk -F "=" '/STORAGE_CIFSPASSWD *=/ {print $2}' $HACK_INI)
20+
WEBHOOK=$(awk -F "=" '/WEBHOOK *=/ {print $2}' $HACK_INI)
2021
WEBHOOK_URL=$(awk -F "=" '/WEBHOOK_URL *=/ {print $2}' $HACK_INI)
2122
WEBHOOK_ALERM_PICT=$(awk -F "=" '/WEBHOOK_ALERM_PICT *=/ {print $2}' $HACK_INI)
2223
WEBHOOK_ALERM_VIDEO=$(awk -F "=" '/WEBHOOK_ALERM_VIDEO *=/ {print $2}' $HACK_INI)
@@ -78,10 +79,10 @@ fi
7879

7980
if [ "$WEBHOOK" = "on" ] && [ "$WEBHOOK_URL" != "" ]; then
8081
if [ "$WEBHOOK_ALERM_PICT" = "on" ] && [ "$FILE" = "/tmp/alarm.jpg" ]; then
81-
LD_LIBRARY_PATH=/tmp/system/lib:/usr/lib /tmp/system/lib/ld.so.1 /tmp/system/bin/curl -X POST -F "image=@$FILE;type=image/jpeg" $WEBHOOK_URL
82+
LD_LIBRARY_PATH=/tmp/system/lib:/usr/lib /tmp/system/lib/ld.so.1 /tmp/system/bin/curl -X POST -F "image=@$FILE" -F"type=image/jpeg" $WEBHOOK_URL
8283
fi
8384
if [ "$WEBHOOK_ALERM_VIDEO" = "on" ] && [ "$FILE" = "/tmp/alarm_record.mp4" ]; then
84-
LD_LIBRARY_PATH=/tmp/system/lib:/usr/lib /tmp/system/lib/ld.so.1 /tmp/system/bin/curl -X POST -F "video=@$FILE;type=video/mp4" $WEBHOOK_URL
85+
LD_LIBRARY_PATH=/tmp/system/lib:/usr/lib /tmp/system/lib/ld.so.1 /tmp/system/bin/curl -X POST -F "video=@$FILE" -F "type=video/mp4" $WEBHOOK_URL
8586
fi
8687
fi
8788

atomcam_configs/overlay_rootfs/scripts/webhook.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
HACK_INI=/media/mmc/hack.ini
4-
tail -F /tmp/log/atom.log | awk '
4+
tail -F /tmp/log/atom.log | TZ=JST-9 awk '
55
BEGIN {
66
FS = "=";
77
while(getline < HACK_INI) {
@@ -37,6 +37,12 @@ BEGIN {
3737
/time_lapse_stop_job/ {
3838
if(ENV["WEBHOOK_TIMELAPSE_FINISH"] == "on") Post("timelapseFinish");
3939
}
40+
/__NTP Set SysTime To/ {
41+
gsub(/^.*__NTP Set SysTime To /, "");
42+
gsub(/__.*$/, "000");
43+
print strftime("Reboot Time : %Y/%m/%d %H:%M:%S") >> "/media/mmc/atomhack.log";
44+
fflush("/media/mmc/atomhack.log");
45+
}
4046
4147
function Post(event, data) {
4248
if(data == "") {

atomcam_configs/web/source/vue/Setting.vue

+30-2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,20 @@
229229
</ElCol>
230230
</ElRow>
231231

232+
<ElRow v-if="config.WEBHOOK === 'on'">
233+
<ElCol :offset="2" :span="7">
234+
<ElTooltip :tabindex="-1" placement="top" content="Alarm発生時に録画ファイルを転送します" effect="light" :open-delay="500">
235+
<h4>動体検知録画転送</h4>
236+
</ElTooltip>
237+
</ElCol>
238+
<ElCol :span="4">
239+
<ElSwitch v-model="config.WEBHOOK_ALERM_VIDEO" active-value="on" inactive-value="off" />
240+
</ElCol>
241+
<ElCol v-if="config.WEBHOOK_ALERM_VIDEO === 'on'" :span="4">
242+
mime: video/mp4
243+
</ElCol>
244+
</ElRow>
245+
232246
<ElRow v-if="config.WEBHOOK === 'on'">
233247
<ElCol :offset="2" :span="7">
234248
<ElTooltip :tabindex="-1" placement="top" content="Alarm発生時に静止画保存を通知します" effect="light" :open-delay="500">
@@ -243,6 +257,20 @@
243257
</ElCol>
244258
</ElRow>
245259

260+
<ElRow v-if="config.WEBHOOK === 'on'">
261+
<ElCol :offset="2" :span="7">
262+
<ElTooltip :tabindex="-1" placement="top" content="Alarm発生時に静止画ファイルを転送します" effect="light" :open-delay="500">
263+
<h4>動体検知静止画転送</h4>
264+
</ElTooltip>
265+
</ElCol>
266+
<ElCol :span="4">
267+
<ElSwitch v-model="config.WEBHOOK_ALERM_PICT" active-value="on" inactive-value="off" />
268+
</ElCol>
269+
<ElCol v-if="config.WEBHOOK_ALERM_PICT === 'on'" :span="4">
270+
mime: image/jpeg
271+
</ElCol>
272+
</ElRow>
273+
246274
<ElRow v-if="config.WEBHOOK === 'on'">
247275
<ElCol :offset="2" :span="7">
248276
<ElTooltip :tabindex="-1" placement="top" content="録画保存を通知します" effect="light" :open-delay="500">
@@ -404,7 +432,9 @@
404432
WEBHOOK_ALARM_EVENT: 'off',
405433
WEBHOOK_ALARM_INFO: 'off',
406434
WEBHOOK_ALARM_VIDEO_FINISH: 'off',
435+
WEBHOOK_ALERM_VIDEO: 'off',
407436
WEBHOOK_ALARM_PICT_FINISH: 'off',
437+
WEBHOOK_ALERM_PICT: 'off',
408438
WEBHOOK_RECORD_EVENT: 'off',
409439
WEBHOOK_TIMELAPSE_EVENT: 'off',
410440
WEBHOOK_TIMELAPSE_FINISH: 'off',
@@ -590,8 +620,6 @@
590620
}
591621
},
592622
async Exec(cmd) {
593-
// eslint-disable-next-line no-console
594-
console.log('Exec ', cmd);
595623
await axios.post('./cgi-bin/exec.cgi', { exec: `${cmd}` }).catch(err => {
596624
// eslint-disable-next-line no-console
597625
console.log(err);

0 commit comments

Comments
 (0)