Capture info from an ext log file

Hi
I can switch movement detection on one of the cameras controlled by the Motion software
but its not verified .
If set the logging to maximum on Motion it does generate a response in the logfile at
/var/log/motion/motion.log`

[0:cn0] [DBG] [STR] [Aug 22 16:30:51] webu_parseurl: camid: >101< cmd1: >detection< cmd2: >pause< parm1:>< val1:>< parm2:>< val2:><

Can anyone suggest a way of getting “webu_parseurl: camid: >101< cmd1: >detection< cmd2: >pause<” to be seen by HA as an event

Not an event but you can create a file sensor to read the last line of any file:

You can then trigger on the state of this sensor.

There are options in motion.conf to execute a command on motion detection.
You can use it to publish a mqtt message and trigger on it.

# Command to be executed when a motion frame is detected (default: none)
on_motion_detected /usr/bin/mosquitto_pub -h mqtt_broker -t home/tpad/motion -m 'ON'

Hi
Yes I’m aware of those options, when motion is detected
, but what I is to be able to verify a command sent to motion to pause motion detection has been done.
I can send the command to pause or start detection on a camera from lovelace, but I have no idea if the detection pause/start has been actually completed.
All I can find is in the motion.log the line I posted earlier.
I suspect I will have to write a script sorta like

tail -f /var/log/motion/motion.log | grep  webu_parseurl: camid: >101<   

then grab the output from grep and test if cmd2 was pause or start
then set a flag which HA can test.
Its not so simple as grep needs only to respond to the exact string, not its normal behavior
so maybe have to pipe it to SED and cut a section of the string to test

not easy, hence why I asked

That is exactly what the file sensor does. With the added benefit of a value template to interpret it.

Thanks Tom,
I’ll see if I can find a template to adapt and modify for this purpose