I have an automation that would be used to send a still image from my Hikvision camera when motion is detected. Motion is handled by the Hikvision binary sensor.
The automation works fantastically when triggered manually, within a few seconds i get the telegram notification with my image.
When the motion alert is triggered under normal situation, i get the below error:
Status code 503 (retry #1) loading http://admin:[email protected]/ISAPI/Streaming/channels/101/picture
I am unsure where to start checking next for a solution.
Are you running out of resources? What’s your setup? Do you do any video processing? (Stream, motion detection, tensorflow) out of HA ?
I had issues when doing some of this with cameras setup with the full resolution in HA. Set the cameras to channel 2 (low res) which is much easier on the system. The camera still records at full res
This is another way of doing it. I don’t call the send_photo service…just notify, but attach a photo. It is what I do and I never have issues:
action:
- data:
data:
photo:
- caption: Motion In Driveway
url: http://admin:[email protected]/ISAPI/Streaming/channels/101/picture
message: Motion in Driveway
service: notify.telegramgroup
This was cobbled together from other peoples examples, but it works.
HTH
EDIT
My action is the only part of the automation that is different from the OP’s automation (save the sensor name of course) That is why I only posted the part from action down.
I have just noticed that when the sending fails, the saved jpg is only 1kb.
I am able to replicate this same behavior if i move the automation over to NodeRed.
It would seem like the camera.snapshot is the issue here.
Odd. Mine works flawlessly. Have you tried to set the camera with the 2nd channel (low res) to see if the issue is still there? It would not surprise me if the high res was just too much at times of your box is also busy doing something else
I just realized I should have given you more info on my last post.
My action is the only part of the automation that is different from the original automation you posted (save the sensor name of course). That is why I only posted the part from action down.
So there is no camera.snapshot used. It just pulls from the URL and sends with telegram. I never have anything missed so it seems to work pretty well.
@danbutter Yeah, i figured your way would be my next best bet as it bypasses the snapshot service altogether.
I have doubled the memory allocation for my HASS box and switched to your suggestion for the notifications. I will report back with the result.
I have narrowed down the issue to the Hikvision Camera not accepting the Username and Password (As visible in the camera logs) when input into an automation. However the automation succeeds 100% of the time if manually triggered. When the automation is triggered by motion the camera rejects the credentials.
It is very weird and easily replicated, I just cannot figure out how to solve it.
The camera doesn’t accept the authentication being passed through with the snapshot service.
I am really at a loss for this, currently using a Node Red flow that triggers on the motion state and performs an HTTP request to the camera. But it is still not triggering on its own. The camera is successfully sending all the alerts via email, and it is successfully passing the alerts onto home assistant.
If i input that with the correct username and password into an incognito browser window it still prompts for authentication.
This did work for around two months back in May. But i cannot for the life of me figure out if it was an HA upgrade or firmware upgrade on the camera that broke it.
Shot in the dark, but I had to put my username and password in quotes to make my camera work using ffmpeg. I believe it was special characters that were in my password causing the yaml issues.
With both the suggestions above, I am able to still successfully trigger the automation manually, but when it is triggered by motion i get a 1Kb file saved by the snapshot service.