motioneye icon indicating copy to clipboard operation
motioneye copied to clipboard

Why no "on_event_stop" action?

Open Puzzlr opened this issue 10 years ago • 7 comments

I noticed that under "Motion Notification" you can add a command to be executed. However this is only added to the "on_event_start" directive in de thread-?.conf file. Luckily, if you manually add a "stop" command to "on_event_stop" directive it does not get overwritten.

I use the start / stop commands to flip a virtual motion detection device in Domoticz (a home automation system) whenever motion decides a motion event either starts or stops, so I can use my IP camera as a motiondetector as well.

Why no seperate options to add a mail / webhook / command option on event start and stop?

Puzzlr avatar Feb 20 '16 12:02 Puzzlr

I'd also like on_event_stop action. And it's even been here https://github.com/ccrisan/motioneye/issues/56

ukasiu avatar Feb 20 '16 16:02 ukasiu

Mmmm, I just now discovered that my thread-1.conf did get overwritten erasing my added /usr/bin/curl -s "http://Domoticz_IP:port/json.htm?type=command&param=switchlight&idx=32&switchcmd=Off". The motion sensor now only receives "On" commands, rendering it rather useless. This behavior of motioneye seems to restrict the original behaviour of motion. Is that intentional?

Puzzlr avatar Feb 20 '16 21:02 Puzzlr

The reason why on_event_stop is overwritten is that motionEye uses it internally to remove the "motion detected" red frame. Unfortunately there's no way to make it execute custom commands with the current version. I'll think of a way to allow executing extra commands when the event stops.

ccrisan avatar Feb 21 '16 13:02 ccrisan

That would be great! I also need it to start a counter and count time since last detection

maxholgasson avatar Apr 06 '16 13:04 maxholgasson

Instead of adding it under Motion Notification define it in the Extra Motion Options. I have done it for the WiFiPlug, so if the feed gets lost it flicks the plug off and on. on_event_end

ghost avatar Dec 16 '16 20:12 ghost

This is available in current motionEye.

The old limitation mentioned above was that motionEye used on_event_end internally, so custom stop commands could not be configured cleanly from the UI. Current motionEye now builds on_event_end with motionEye's own relay command first, and then appends user-configured end actions.

In the UI this is exposed under Motion Notifications as separate end-event options, including:

  • Web Hook End Notifications
  • Command End Notifications

So for a Domoticz/Home Assistant style use case, you can now configure one command/webhook for motion start and another command/webhook for motion end without manually editing thread-*.conf.

Since this request was specifically about having separate start/end actions, the current implementation appears to cover it.

JamBalaya56562 avatar Jul 02 '26 00:07 JamBalaya56562

It was added here with v0.37: #290 And the respective webhook option here with v0.43.1: #1914

Marking this as closed.

MichaIng avatar Jul 02 '26 13:07 MichaIng