News How to Create a Raspberry Pi Security Camera with Motion Alerts

Status
Not open for further replies.
Jun 8, 2020
2
0
10
Many thanks for this article. I've been looking for something similar for a while, so am excited to get this going.

However, I'm getting an error from the 'r = requests.post' line which reads:
NameError: name 'new_filelink' is not defined

The Pi is sensing motion, taking an image, and uploading to Filestack. IFTTT is sending a post to Telegram but the image is not coming through (getting a 'file not found' image).

If I replace new_filelink.url in the r = requests.post line with "https://cdn.filestackcontent.com/theimageurl" then the image gets posted to Telegram, so the IFTTT to Telegram connection is working.

It seems that there is an issue with the IFTTT post picking up the new_filelink.url.

Please can you help!?

Also the camera seems to be only triggering for the first motion sensor, and doesn't continue. Any ideas?

Thanks for your help!
Jan
 
Jun 8, 2020
2
0
10
I'm not familiar with any of this, but the bottom of the article says it was first published in issue 262 of Linux Format Magazine.

Maybe they have some forums where the same issue was already discussed (262 appears to be last month's issue).

Also, that page has a link to the source code, so you can also review it to see if the article missed anything.
Thanks @bit_user! I did check online versions and it looks the same. Can't find any forums on this unfortunately. :(
 

biglesp

Commendable
Jun 11, 2020
6
1
1,515
Thanks @bit_user! I did check online versions and it looks the same. Can't find any forums on this unfortunately. :(
Hello!
I wrote this code for Linux Format, so I hope that we can fix this.

Firstly can you try out this code on your system, adding your API keys where necessary
https://github.com/lesp/LXF262
If that fixes the issue, then there was a typo, and trust me when I wrote this I made quite a few errors!
new_filelink.url should return the url of the image on filestack. What does print(new_filelink.url) (Line 13) return in the Python shell?
IIRC I had an issue like this where the URL was wrong and IFTTT was sending duff URLs to Telegram.

If you can share your code (No API keys :) ) via a Gist or or Pastebin, then that would help me to diagnose the issue.

Happy to help and best of luck!
Les
 
  • Like
Reactions: bit_user
Oct 24, 2020
1
0
10
Hello, Thank you for writing this. I am also getting an error when I run the file. The motion detection is working because every time I move in front of the camera, a web address shows up in terminal and then 'Error' on a new line. Like this:
https://cdn.filestackcontent.com/qm98PXufQKGbeqi93F09
Error
I am not sure what is going wrong but it seems to be with the send alert part of the code. I had to edit the file because, for some reason, it didn't like the quotes you had in there. I had to go through and replace them with new quotes. It kept giving me invalid character errors. Who knows? The edits fixed that but now I am running into this problem. Please let me know if you have any ideas. Also, if you know of a way to have it take a short video instead of a still upon motion detected, that would be cool to know. Thank you! : )
 
Status
Not open for further replies.