MotionEye, home assistant, camera motion, automation

Sorry argykaraz, I have to confirm that my approach isn’t working (anymore?).
I hope someone finds a solution to make it work with token.

has anybody managed to get this to work? all the above does nothing.

@argykaraz and me managed to make it work with “command” instead of web hook.
This goes into motioneye command:

curl -X POST -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" -d '{"entity_id": "script.yourscript"}'  http://yourip:8123/api/services/script/turn_on
3 Likes

This no longer works since release 0.84, can anybody help?

I get a

401: Unauthorized

returned

HI John,
In your node red flow the exec node does not find the image file(debug) shows “” )and so the msg.payload is not populated. Does this flow work with Hassio?

For those using docker, the developers have added the mosquitto-client to the dev-amd64 image and will work with the HassCasts mqtt command

No need for webhook/token etc

1 Like

I’m running Hassio 0.85.0 and finally I was able to get it to work by using the command below:

curl -X POST https://youraddress/api/services/script/turn_on -H 'Authorization: Bearer TOKEN' -H "Content-Type: application/json" -d '{"entity_id": "script.yourscript"}'

5 Likes

Thank you. Sold. I’ve just subscribed!

Did you ever do that video? I couldn’t immediately spot it.

1 Like

Mr HassCast, shooting way back into the past here, but is this still working for you? I tried but HA isnt making any changes on a motion mqtt command.

i still have no issues with my setup, curl is the way to go. As for ghost motion i’ve noticed a lot of it depended on my camera quality, meaning resolution and fps, also wireless vs wired. here is a picture of my motion settings.

51%20PM

with this setting i dont get a lot of ghost motion, its a crappy camera 3 db antenna

2 Likes

can u send a pic of ur setup to use curl command

I guess ill just have to figure out curl then. Its just not very familiar or readable to me. MQTT I have had more success as I’m all in on Sonoff light switches with Tasmota.

4

Just turn this on and add this from an earlier post:

Replace the script.yourscript with a script name of your choice. You will have to create a script to do something when motion is detected.

1 Like

this is my old post on here, also my setup uses a mqtt to http bridge thats why the binary sensor is mqtt, the curl command is issued to the mqtt service and passed to http or https. In my opinion dont use a script, use the mqtt binary sensor, works great, that way in the future if you figure out mqtt all you have to change is the command in motioneye. Also i believe you should definitely use the run end command so it turns off the sensor once motion has stopped being detected.

Why use curl when you can use mosquitto_pub and just use MQTT? Way easier.

Because MQTT isnt working (well not for me)

I managed to get it working via MQTT. Using this command.

Motion On
curl -X POST \ -H “Authorization: Bearer YOURTOKEN” -H “Content-Type: application/json” \ -d ‘{“payload”: “{“status” :“MOTION”}”, “topic”: “cameras/motion/picam”, “retain”: “True”}’ \ http://192.168..**:8123/api/services/mqtt/publish

Motion On
curl -X POST \ -H “Authorization: Bearer YOURTOKEN” -H “Content-Type: application/json” \ -d ‘{“payload”: “{“status” :“NO MOTION”}”, “topic”: “cameras/motion/picam”, “retain”: “True”}’ \ http://192.168..**:8123/api/services/mqtt/publish

Sensor YAML:

  • platform: mqtt
    name: “PiCam Motion”
    state_topic: “cameras/motion/picam”
    payload_on: “MOTION”
    payload_off: “NO MOTION”

HA is complaining about the payload on/off but ill sort that out later, its still working.

Anyone that has mosquitto_pub can use these:

mosquitto_pub -h <MQTT IP> -p <port> -t cameras/motion/frontdoor -u <username> -P <password> -m ON

mosquitto_pub -h <MQTT IP> -p <port> -t cameras/motion/frontdoor -u <username> -P <password> -m OFF

1 Like

Hi all

actually I have motionEye installed outside Hassio on another VM on my Intel NUC.

I’ve created a python script like this to run on motion detection.

curl -s -X POST https://api.telegram.org/botxxxxxx/sendPhoto -F chat_id=xxxxxx -F photo=@/var/lib/motioneye/Camera1/Alarm.jpg -F caption="Motion Vialetto!"
mosquitto_pub -h 192.168.x.x -u user -P password -t topic/Vialetto/motion -m "ON"

that I activate here

58

and this is how is defined the Still Images section

57

then in Nodered after receiving the ON payload on that topic after 15secs I send the OFF payload to manage a binary_sensor in HA

In this way I receive in a Telegram BOT a picture with the motion.

What I would like to receive (or to save locally, is a small video of the motion.
Is there a way to do it?

Thanks

2 Likes

I just found the solution, but this imply to have both MonionEye and NodeRed as Hassio Addon.

1 Like