Motioneye notification and push_camera no longer works since 0.84 upgrade

Hi, I’ve a script in home assistant that was called by a motioneye notification webhook, i.e. from here: -

Using this:

Sure, here you go:
Go to  **Motioneye**  and open  **Motion notifications**
Turn on  **call a web hook**
on the  **Web Hook URL**  use this:

Note this ~script/ **camdetecon** ?api~
This should be the same name as your script!

Select the  **POST (query)**  on the  **HTTP Method**  field.
    indent preformatted text by 4 spaces

So now calling the curl command from the command line I get a message: -

401: Unauthorized

This worked perfectly prior to the 0.84 update, can anyone help, thanks.

The push_camera configuration no longer works either since moving to a webhook, detailed here: -

and here

Your answer is at the latest posts. We made it work using the “run a command” option.

1 Like

Can you show an example please?


You have to enter the command as shown in the example in the last post on my thread.

1 Like

Ah ok sorry, no that’s not what I meant, so in your example: -

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

BOLD have to be converted to something right? But what? I know my script name, camdetcon, but where do I get the rest from, i.e. TOKEN, entity_id
and should there be something in my script referencing “turn_on”

In essence, how does this: -

curl -X POST http://192.168.xx.xx:8123/api/services/script/camdetecon?api_password=xxxxxxxxxx

convert to yours?

Alright. First things first. Let me show you my script:

  alias: Stairs Camera Motion Detection ON
  - service: notify.jarvis_lenovo
        method: alarm
      message: chime
  - service: light.turn_on
    entity_id: light.office_screen
  - service: light.turn_on
    entity_id: light.bedroom_screen
  - service: light.turn_on
    entity_id: light.entrance_screen
  - service: shell_command.cctv_kodi_stairs
  - service: counter.increment
    entity_id: counter.motioncounter_stairs
  - service: automation.trigger
    entity_id: automation.sys_stairs_camera_snapshot

This script runs a numerous of services that I want to run everytime a motion is detected from my stairs cam. There is nowhere a service to “turn on” the script like you thought ( I will explain later what script/turn_on does.
So, all you have to do is to create a script and tell it what to do when motion is detected. You will later connect this script to Motioneye. I will show you how.
The name of my script is stairsmotion. Yours can be anything.

Now you need to create a long-lived token from HA. Tokens in a simple explanation are something like a password. They give access to applications.
Go to Homeassistant and click to your profile like this:

Now go to the bottom of this page and create a long-lived token.

Name it as you like. It doesnt matter. COPY THIS TOKEN SOMEWHERE until you paste it to Motioneye because you wont be able to copy it again. This is for one time only. If you lose the token, you have to create a new one.

Now, lets go to Motioneye:
Go to Notifications and turn on Run a command
What you have to paste here is the command I told you on my previous post.
Let me explain you what it means:

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

curl is a command for linux to send data using various protocols. We use POST here.

TOKEN is where you paste your long-lived token I told you before.
-d ‘{“entity_id”: “script.stairsmotion”}’ is what I put here because the name of my script is stairsmotion (see at the start of my post for the name)

https://yourip:8123 is your Homeassistant IP.
Now something I noticed here:
In my configuration.yaml I have setup a base_url according to this documentation:
So… my base_url is my ddns name

I have noticed that using IP is not working for me, probably because I have this setup for remote access. If you havent setup like this, then IP will work for you maybe.

Finally, ** script/ turn_on is a trigger to activate the script. You dont have to reference it anywhere. It just tells HA to run the script.

Feel free to ask anything if I got you messed. I know it is a lot, but I wanted to make sure you understand what you are doing.


can you share/explain who your counter work? could not find this service in hass
what do you use it for?

  - service: counter.increment
    entity_id: counter.motioncounter_stairs

I have it to know how many times the motion is triggered.

1 Like

That’s a great explanation, thank you very much for your time over this. Much appreciated. I will give this a go over the weekend. :wink:

1 Like

Sure! Tell me how it goes. Good luck.

ok, gave it a whirl, and failed. Tried it from the command line and got this: -

curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

In your example: -

curl -X POST -H “Authorization: Bearer TOKEN” -H “Content-Type: application/json” -d ‘{“entity_id”: “script.yourscript”}’ https://yourip:8123/api/services/script/turn_on

I’m just changing the word TOKEN for my actual token, is that right? Also the token generated is quite long, 184 characters, does that sound daft?

And then all I changed was yourscript, to my script name, which is camdetcon

And my ip address in yourip

error messages from journalctl

hass[9722]: Traceback (most recent call last):
hass[9722]:   File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.p
y", line 242, in data_received
hass[9722]:     messages, upgraded, tail = self._request_parser.feed_data(data)
hass[9722]:   File "aiohttp\_http_parser.pyx", line 523, in aiohttp._http_parser.HttpPars

Yes, the token is that large.
you changed everything correctly.
What I am trying to figure out is what I told you before about the base_url… I just made it work with my setup and never tinkered it again.

Now, we have to figure out yours… The problem is in the https://yourip:8123 thing
Are you using SSL or not?
Have you setup remote access on your HA instance? If yes, You probably have a ddns…
Does any of these sound a familiar?

Doh! Very good point, I’m not, I’ll remove the “s” lol :wink:

OK, no error now and in journalctl I see: -

INFO (MainThread) [homeassistant.components.http.view] Serving /api/services/script/turn_on to (auth: True)

But the script doesn’t seem to run, even though it appears in the home assistant logbook list. Clicking on that link in the logbook I can trigger it manually with the switch that appears, and it works. So the script seems fine. But my curl doesn’t seem to be triggering it properly.

I am afraid I can no longer help you here… This is out of my knowledge… :confused:

Good day, Im getting this error:

2019-03-23 11:19:43 ERROR (MainThread) [] Could not get information from POST <Request Entity Too Large>

I presume the file size is too large? any advice on how to modify/correct?

Thank you

You should reduce the image resolution a bit in motioneye

thank you for your help.

I did set up my motioneye camera using the camera push component, but I’m getting a lot of Could not get information from POST <> errors in my logs. The camera seems to be working correctly (at least I see the images coming in) and the correct ‘recording’ / ‘idle’ states on the camera.

I already tried lower my file size by changing the resolution of the images, as well for the number of stills it will take, nothing did make the errors disappear.

Also next to the other error I see this one a lot in my logs:

Error processing webhook motion_eye_livingroom
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/webhook/", line 85, in async_handle_webhook
    response = await webhook['handler'](hass, webhook_id, request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/camera/", line 70, in handle_webhook
    data = dict(await
  File "/usr/local/lib/python3.7/site-packages/aiohttp/", line 650, in post
    field = await
  File "/usr/local/lib/python3.7/site-packages/aiohttp/", line 564, in next
    await self._read_boundary()
  File "/usr/local/lib/python3.7/site-packages/aiohttp/", line 657, in _read_boundary
    % (chunk, self._boundary))
ValueError: Invalid boundary b'--------------------------2784e3a67c54049b-', expected b'--------------------------2784e3a67c54049b'

Anyone an idea what is going wrong here?

(btw running hassio; HA 0.90.2)