Send Motion-user mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/motion-user
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Motion-user digest..."
Today's Topics:
1. disabling a camera with a time parameter (Richard Bown)
2. Re: disabling a camera with a time parameter (MrDave)
3. Re: disabling a camera with a time parameter (Richard Bown)
4. Re: Motion crashing regularly (Dougie Nisbet)
----------------------------------------------------------------------
Message: 1
Date: Mon, 23 Oct 2023 16:26:06 +0100
From: Richard Bown <[email protected]>
To: Motion discussion list <[email protected]>
Subject: [Motion-user] disabling a camera with a time parameter
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
Hi
just 8 cams on my system, one really needs to be disabled during the
day,
At the moment I'm sending a script in homeassistant
lounge_cam:
command_on: 'lwp-request
http://localhost:7770/101/detection/start'
command_off: 'lwp-request
http://localhost:7770/101/detection/pause'
sorry for the line wrapping, it doesn't always work as verification is
a pig to get to work, So far I have failed ,
I have logging set to 8 and I have tried to use grep to find the
response to the lwp-request.
If it was only just using it for a few hours at night, I could use
crontab , but it also needs to be on if we are out or away from home.
with 8 cameras and on log level 8 there is a lot being added to the
logfile.
Am I missing a simple way of doing this ???
--
--?
?Best wishes ?
?Richard Bown
?
------------------------------
Message: 2
Date: Mon, 23 Oct 2023 09:54:47 -0600
From: MrDave <[email protected]>
To: [email protected]
Subject: Re: [Motion-user] disabling a camera with a time parameter
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
What I've seen is that people use a bash script that pings their phone.?
If the ping returns then disable the camera(s), if not, then turn the
camera(s) on.? Then use a crontab to run the script at some sort of
frequent interval.
MrDave
On 10/23/2023 9:26 AM, Richard Bown wrote:
> Hi
> just 8 cams on my system, one really needs to be disabled during the
> day,
> At the moment I'm sending a script in homeassistant
>
> lounge_cam:
> command_on: 'lwp-request
> http://localhost:7770/101/detection/start'
> command_off: 'lwp-request
> http://localhost:7770/101/detection/pause'
>
> sorry for the line wrapping, it doesn't always work as verification is
> a pig to get to work, So far I have failed ,
> I have logging set to 8 and I have tried to use grep to find the
> response to the lwp-request.
> If it was only just using it for a few hours at night, I could use
> crontab , but it also needs to be on if we are out or away from home.
> with 8 cameras and on log level 8 there is a lot being added to the
> logfile.
> Am I missing a simple way of doing this ???
>
------------------------------
Message: 3
Date: Mon, 23 Oct 2023 17:34:41 +0100
From: Richard Bown <[email protected]>
To: [email protected]
Subject: Re: [Motion-user] disabling a camera with a time parameter
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
Hi,?
I'm dong something similar to that, by tracking both my phone and my
wifes, and if both are out or we have set a state switch we are away,
the the lwp-request http....../pause is sent
and if either of us are in the
lwp-request http......../start is sent
and also at a time in the evening the lwp-request ..../start is sent
and the opposite in the morning
the problem is its a blind command and doesn't always get actioned by
motion, or gets lost
from the logfile there is
> [0:cn0] [DBG] [STR] [Oct 23 17:19:42] webu_parseurl: Sent url:
> /101/detection/pause
> [0:cn0] [DBG] [STR] [Oct 23 17:19:42] webu_parseurl: Decoded url:
> /101/detection/pause
> [0:cn0] [DBG] [STR] [Oct 23 17:19:42] webu_parseurl: camid: >101<
> cmd1: >detection< cmd2: >pause< parm1:>< val1:>< parm2:>< val2:><
> [0:wu0] [INF] [ALL] [Oct 23 17:19:42] webu_answer_ctrl: Connection
> from: 127.0.0.1
>
I've tried running tail -f motion.log | grep Decoded url > a file
but haven't succeeded in setting a flag that can be read by another
application/program like homeassistant
this sorta works
tail -f /var/log/motion/motion.log | grep Decoded
[0:cn0] [DBG] [STR] [Oct 23 17:28:40] webu_parseurl: Decoded url:
/101/detection/pause
[0:cn0] [DBG] [STR] [Oct 23 17:28:41] webu_parseurl: Decoded url:
/101/detection/pause
But I haven't succeeded in writing the output of grep to a file
On Mon, 2023-10-23 at 09:54 -0600, MrDave wrote:
> What I've seen is that people use a bash script that pings their
> phone.?
> If the ping returns then disable the camera(s), if not, then turn the
> camera(s) on.? Then use a crontab to run the script at some sort of
> frequent interval.
>
> MrDave
> On 10/23/2023 9:26 AM, Richard Bown wrote:
> > Hi
> > just 8 cams on my system, one really needs to be disabled during
> > the
> > day,
> > At the moment I'm sending a script in homeassistant
> >
> > lounge_cam:
> > ???????? command_on: 'lwp-request
> > http://localhost:7770/101/detection/start'
> > ???????? command_off: 'lwp-request
> > http://localhost:7770/101/detection/pause'
> >
> > sorry for the line wrapping, it doesn't always work as verification
> > is
> > a pig to get to work,? So far I have failed ,
> > I have logging set to 8 and I have tried to use grep to find the
> > response to the lwp-request.
> > If it was only just using it for a few hours at night, I could use
> > crontab , but it also needs to be on if we are out or away from
> > home.
> > with 8 cameras and on log level 8 there is a lot being added to the
> > logfile.
> > Am I missing a simple way of doing this ???
> >
>
>
>
> _______________________________________________
> Motion-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/motion-user
> https://motion-project.github.io/
>
> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
------------------------------
Message: 4
Date: Mon, 23 Oct 2023 20:26:24 +0100
From: Dougie Nisbet <[email protected]>
To: [email protected]
Subject: Re: [Motion-user] Motion crashing regularly
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
On 23/10/2023 10:42, Ian Smith wrote:
>
>
> Once more, I suspect the issue I am facing is by my doing something
> wrong, but any assistance would be appreciated.
>
> I run Motion on Ubuntu 20.04, with multiple cameras, of which one is a
> USB camera (which may not be relevant).
>
> I run logging - at level 9 (all).
>
> On a regular basis, the software crashes. Ideally, I would like to
> understand why, and eliminate the problem - if that isn't possible, I
> would like it to automatically restart on crashing, but I don't know
> how to do that, so any help would be appreciated.
>
> The log provides the following as an example - in the seconds leading
> up to the crash:-
>
> [0:motion] [ERR] [ALL] [Oct 23 10:13:39] motion_watchdog: Thread 7
> - Watchdog timeout. Trying to do a graceful restart
> [0:motion] [ERR] [ALL] [Oct 23 10:13:49] motion_watchdog: Thread 7
> - Watchdog timeout did NOT restart, killing it!
>
When I've had these type of messages it's been due to either hardware
problems or overloading the (usually) rpi - i.e. Two USB webcams on one
rpi. Funnily enough I've just had it recently and it was a faulty camera
module. It took me a while to diagnose because the camera and cable
looked fine, and I swapped them both, and they still failed. Only when I
swapped them with the module on a working rpi that I noticed.
As for automatically restarting motion if it crashes, I found some old
code that I used to run every few minutes from cron, that allowed me to
kill and restart motion remotely using a dropbox file. (I used to start
motion when it wasn't running, now I rely on system startup and a daily
restart via cron. It seems to work better for me.)
I used to use something along the lines of:
wf1=/home/dougie/tmp/$(basename -- $0)_1.$$
if ps -C motion > $wf1 2>&1
then
?? ?ps -C motion > /tmp/.motion.is.running
else
?? ?cat $wf1 | mail -s "INFO: Starting motion - $(basename --
$0)[$LINENO] [PID $$] - " -r "<sys-$(hostname)@katsura.uk>"
[email protected]
?? ?nohup motion > /home/dougie/logs/motion.log 2>&1 &
fi
Depending on your version of Linux/bash perhaps something like 'pgrep'
in a script might work better than the way I've done it, using ps -C. If
I'm trying to do something like this nowadays I'd look at using
something like pkill and pgrep to check and restart motion. I always run
motion as myself and not as user 'motion' btw.
(I saw another question about disabling motion using a time parameter -
this doesn't do that but I find the 'rclone' command with dropbox pretty
useful. If you use dropbox of course :-) Here's the code I use.)
wf1=/home/dougie/tmp/$(basename -- $0)_1.$$
#
#??? Check Dropbox to see if motion should be stopped
#
if rclone cat remote:etc/stop-motion-running.txt | grep -q ^yes
then
?? ?if ps -C motion > /dev/null 2>&1
?? ?then
?? ???? cat $wf1 | mail -s "INFO: Stopping motion - $(basename --
$0)[$LINENO] [PID $$] - " -r "<sys-$(hostname)@katsura.uk>"
[email protected]
?? ???? rm /tmp/.motion.is.running >> $wf1 2>&1
?? ???? pkill -u dougie motion
?? ???? sleep 10
?? ???? pkill -9 -u dougie motion
?? ?fi
fi
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
------------------------------
Subject: Digest Footer
_______________________________________________
Motion-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/motion-user
------------------------------
End of Motion-user Digest, Vol 206, Issue 3
*******************************************