Open toshibochan opened 8 years ago
You must have a list of people in doorbellToAddress. That is not implemented yet, sorry. Change it to only one SIP address. (That should be your address. I don't know if I can invite multiple people or not. Is that something you need?)
i change for one! but now i cant call or receive call
I abble to receive text on linphone from the raspberry pi but no call Doorbell ring on sip:linphone@xxx.xxx.x.xxx:xxxx at 2016-03-27 18:31:43.791428
@toshibochan Do you have two SIP accounts? Use one on the RPi (doorbell) and one on your desktop/mobile/tablet, etc., such that when the RPi calls you, it will ring on whichever device you're logged into Linphone with. (Or on all of them, I believe.) You then should hear a ringing sound and you have to click "Answer" to accept the incoming call.
Also, on the Linphone side, I did add the other (RPi) SIP account to my contacts. I'm not sure if that matters. Will you please try that and let me know? Also confirm that you are using two different SIP accounts? (I don't expect you to post the contact info, only confirm that you are using two accounts.)
If none of that helps, will you please send me the log file? You should be able to attach a file here (drag & drop it onto the edit panel).
You'll probably need to transfer /var/log/security_camera.log to your PC to transfer it, depending on how you're using your Pi. :)
There will be a slight delay between the time you get the doorbell ring chat message and the time the call rings. But it should be a second or two. That's because it is also emailing a picture to you each time the doorbell is rang. So you will always know who has been ringing your door! :)
To clarify, the "sipUserName" and "doorbellToAddress" must be two different SIP addresses. You should log in using your PC/mobile/etc., using the "doorbellToAddress". (Only your RPi should be logging in with the "sipUserName".)
Open Liniphone and add the account referenced by "sipUserName" -- except the full SIP address (e.g., "sip:sipUserName@sip.linphone.org") -- , to your contacts. Then you should see all incoming calls from the Pi as coming from that account.
Clear as raspberry pie? Hehe
@toshibochan If you want to, we could have a Linphone chat to make sure your PC/Mobile/etc., is working. We could then eliminate that and focus on the RPi. :)
Have you tried calling into the device? Also, you may have your doorbell button hooked up to the wrong pin. It's GPIO pin 18. I use the GPIO.BCM numbering scheme which is different than GPIO.BOARD. So double-check your pin. If you have one of the breakouts pictured in the Fritzing file, you can see that it is numbered 18. That is the correct pin.
The other side of the switch is just connected to ground.
If I think of anything else for you to check, I'll let you know. I hope some of this helps and your doorbell will work for you! :)
If you want to try a Linphone call with me, please email me (look in the .py scripts to find my "email"--interpret correctly--then email me. (It really is simple. But very effective to date.
I look forward to hearing from you! :) :+1:
Thank you.
@lelandg thanks for help! where i can find your e-mail?
for install your security camera is missing ".git" on the end?
git clone https://github.com/lelandg/Raspberry-Pi-Security-Camera cd Raspberry-Pi-Security-Camera
@toshibochan Yes, that is correct, it is not required to have the .git. The command you show is correct.
Lelandg, getting the following error:
pi@raspberrypi:~/script $ sudo python securitycamera1.py Traceback (most recent call last): File "securitycamera1.py", line 686, in main cam = SecurityCamera(username=XXXXXX, password=XXXXX, \ NameError: global name 'zahersyed' is not defined securitycamera1.py:696: RuntimeWarning: No channels have been set up yet - nothing to clean up! Try cleaning up at the end of your program instead! GPIO.cleanup()
Can you please help,
Thanks in advance. Zaher who do you use for your SIP service? linphone does not show password just username.
You can't change this part of script! You only edit your account information on the beginning of the script! Where is xxxxxxx now you have to put back what was! cam = SecurityCamera(username=XXXXXX, password=XXXXX, \ cam = SecurityCamera(username=sipUserName, password=sipPassword, \
thisDeviceName = "rpi01" # you can change name RECORDVIDEO = True # you can change to False resolution = (1296, 972) # (1920, 1080)
LOGFILENAME = '/var/log/security_camera.log' SIPSERVER = 'sip:sip.linphone.org;transport=tls' AUTHORIZATIONDOMAN = 'sip.linphone.org'
SAVEEMAILEDIMAGES = True SAVEIMAGEDIR = '/home/pi/' # Leave this blank for current directory, else end with '/' char.
sipUserName = 'yourEmailAddressFrom(UserNameOnly)' sipPassword = 'yoursippassword'
sndCapture = 'ALSA: default device' sndPlayback = 'ALSA: default device' whiteList = ['sip:yourSipUsername@sip.linphone.org', 'sip:aSecondSIPAccount@sip.linphone.org']
emailFromAddress = 'yourEmailAddressFrom(UserNameOnly)' emailServer = 'smtp.gmail.com' emailPort = 587
emailAddressTo = 'youremail@example.com' # or like this for just one recipient.
emailAccount = 'emailaddressfrom@example.com' # Account to use for emailing emailPassword = 'youremailpassword' # Password for that account
doorbellToAddress = 'sip:yoursipaccout@sip.linphone.org' LEDPIN = 17 # change this for the pin you want BUTTONPIN = 18 # Change this to the pin you want
@zahersyed I think you failed to enclose the username in quotes. Make sure all values are quoted just like the original script.
Try placing zahersyed within quotes like: 'zahersyed'
Generally speaking, in Python, all constant string values should be quoted. Numeric values should not be.
I do recommend you edit the "settings" in the top portion of the script, only.
Thanks for the prompt reply toshibochan. Your suggestion corrected the issue. However, I am running into other issue now.
I got the script to work with the following error posted below. I also received a notification about google preventing sign attempt from non secure app/browser. Since then I have disable it and allowed less secure sign, since this account is setup for notifications only. Now the script hangs in stabilizing camera and while it is hung I am still adding pictures to my /home/pi folder. I do not have the push button setup yet. I am waiting for my 220 ohm resistor. everything else is setup and should be working. I have attached pictures of my setup. Also how do I initiate linphone call to the pi and, can you explain that in details . I can email you the log if need for trouble shooting.
pi@raspberrypi:~/script $ sudo python securitycamera1.py Waiting for motion sensor to come online.... Waiting for it to stabilize... Traceback (most recent call last): File "securitycamera1.py", line 691, in main cam.run() File "securitycamera1.py", line 594, in run self.notify_email_contacts() File "securitycamera1.py", line 632, in notify_email_contacts self.emailImage() File "securitycamera1.py", line 446, in emailImage self.smtp.login(emailAccount, emailPassword) File "/usr/lib/python2.7/smtplib.py", line 622, in login raise SMTPAuthenticationError(code, resp) SMTPAuthenticationError: (534, '5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtN\n5.7.14 Tg4mFVSIMbDrMjpS8wp3IpX2gFBzcJhDXWxk4DvYZssqtKo1ipFxutIFMXIhX8YHEHr72N\n5.7.14 gd1DoaKz6GpfvXpCrNPgS5-m3QA1wpHqXHczhyOYvj5tB2rzyfDy8Z47ZNaHcbxH1tjDkG\n5.7.14 dlxI9wWrgrDfyId52NLJikmwWdzGZWLc75MvZWnWYndd6t1adT91w71rmzgTbQuU0iBXed\n5.7.14 KprmtXkXVto8P9lKscXNxK1CLlRMo> Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 v13sm3537418vke.8 - gsmtp') pi@raspberrypi:~/script $ sudo python securitycamera1.py Waiting for motion sensor to come online.... Waiting for it to stabilize... ^Z [2]+ Stopped sudo python securitycamera1.py pi@raspberrypi:~/script $ sudo python securitycamera1.py Waiting for motion sensor to come online.... Waiting for it to stabilize...
Thanks in Advance
@zahersyed Nice setup.
According to Google, that error means an invalid password was used somewhere. (Your password should also be quoted.)
I cannot tell for sure which pins you're using on the GPIO. But on that sensor, the yellow pin is your signal pin, so that should be connected to a GPIO pin and you should change PIRPIN=<GPIOPIN#>
Note this uses BROADCOM mode, not BOARD mode.
Once it starts saving pictures, the script is running and it is no longer initializing. Please check the log for details, not the console output. (Please start with .startscript.sh for best results and ease of log monitoring.)
Let me know if this helps.
@zahersyed Also, when you press Ctrl-Z you're sending the process to the background, which is fine... just so you're aware. The script will behave erratically if more than one instance is running. Please use security_off to kill each process until _showproc only returns one line. :+1:
Thanks for you help guys. I am assuming I have a bad sensor. I am getting linphone notification "motion detected" every few seconds even though no one is in the room or possibly have bad connectors. I have the PIR connected to Pin#7 GPIO04. I have attached pictures and the code.
MDPIN = 0 # Set this AND PIRPIN = 0 to use as a "video doorbell", only. You can do both, too, if you'd like. PIRPIN = 4 # Set this to zero to always use the MDPIN. That's for legacy ePIR devices, which you
I will try to replace the PIR sensor and try it again. I using RPi 3 and like to use the Bluetooth for audio. where do I change settings for audio?
Thanks, Zaher
@zahersyed I see one problem, at least. You want to set either MDPIN or PIRPIN and not both. In your case, please try changing: MDPIN = 0 And let me know yes/now and I'll take a deeper look if needed. Your pins sound OK. I do not think it's a problem with the sensor... I think the script is trying to detect a sensor that is not there! (You do not have the type for MDPIN, so it should definitely be zero.)
MDPIN is set to 0 ... portion I copied was is comments section from your description. My configuration is in the small fonts below. I spent hours can't figure it out. I even replaced my sensor same result. Script sitting at "waiting for motion sensor to stabilize"
@zahersyed My apologies, I see that, now. :100: :+1:
I did see what you describe in early development. I finally realized I had a bad power supply. I believe it was < 2A and also produced "dirty power". It caused noise on the line, and these sensors are very sensitive. Make sure you have a 2A power supply, preferably a switching power supply. (Don't skimp here. And if it's labeled < 2A / 2000 mA, that could be your problem.)
It's possible the sensor is bad, but since I saw that same thing, I'm suspicious of the power. :)
I have Raspberry 3, requires 2.5 A to power. I have nothing else connected other than the PIR sensor. I have attached the log. whenever you get a chance. I really appreciate any assistance. Hate to scratch this project. I know I am doing something wrong.
Afraid I'm not very good at troubleshooting a remote site. :-/
Check the specs for the sensor to verify you have everything wired correctly. You could also make a little script for nothing but the security sensor to see if that's working. (I have one, but for the ePIR-type sensor, which will not do you any good at all.) I have seen test-scripts online for these sensors.
@zahersyed You could try this and see if your sensor is working: https://www.raspberrypi.org/learning/parent-detector/worksheet/
Yes, tested sensor with separate script, sensor is working fine. could it be because I don't have the push button connected yet? Script hangs "waiting for it to stabilize" , but I know it is reading past that line since I receive text notification on my linphone app. I hear audio from speakers "espeak" when motion is detected and I get email notification. Can someone post a picture of their setup?
I also get video files in the home folder *.h264. what app do you use view these files? Can VLC open .h264 files?
Hi zahersyed you able to call to raspberry PI? I only can make PI to call my phone but I can't call to PI.
@zahersyed Yes, VLC or most apps that play videos can open the *.h264 files.
Also, if you have *.h264 files, the script is not hanging. Again, please run with .startscript.sh. I know you are not because the last thing printed to the console and not the log is (normally) the "Waiting for it to stabilize...." message.
Output to the console should be ignored for the most part. You want to tail the log file, which the .startscript.sh does automatically for you. Please run that script.
On your sensor, I don't quite know what to think. Did you check the datasheet for the sensor? Or do you have a model#? I suppose it's possible they're different, but unlikely.
One last thing: the PIR sensor may have two screw-adjustments on it. One is for the sensitivity and one is for the amount of time it "remembers" movement. So if these screws got moved, I think it's possible that you would also see constant motion detection.
Lelandg, i feel so stupid. I know you mentioned once before to run the .startscript, but i could not find it. Some how the file did not get downloaded. I grabbed it and ran .startscript. This time i get a different error. Starting security_camera.py, tailing the log. tail: cannot open ‘/var/log/security_camera.log’ for reading: No such file or directory tail: no files remaining cp: cannot stat ‘/var/log/security_camera.log’: No such file or directory
So far, i did not see a security_camera.log in the /var/log. so I created one... but it does not seem to stick.
toshibochan. I have not tried the call yet. I will update you soon.
@zahersyed No problem. I miss stuff all the time, so I can't complain, can I? :)
More importantly, I have reproduced your problem of constantly detecting motion and it is now fixed. This will be in the next commit (possibly today--soon for sure).
Also, yes, I will post a picture of my setup soon, too. That's a good idea. (I may put it in the main ReadMe. Will let you know.) I had a problem with my USB card reader not working, so I couldn't get pictures that were any good. But this problem is now resolved and it was not related to this project.
In conclusion, I've not forgotten you. Just had a few bad days that I couldn't do anything. Things seem to be falling in place today, though! :)
I really appreciate the input (from everyone), too... even if we're troubleshooting. That's how bugs are found and eliminated.
@zahersyed My setups for this project are not terribly obvious, so I am going to attach three pictures. I think you can tell what's going on, and it is basically like yours. Perhaps the pins are different. Let me know if this is clear or not and if you cannot make it out I could annotate the pictures and post again.
Just let me know if you have any questions.
@zahersyed I finally committed my changes.I believe this will fix your issue of constant motion detection false positives. Please let me know about that.
There are a lot of other changes, also. Some of these are only partially implemented, but they do not cause any problems. There are major re-factoring's to clean the code.
@toshibochan I also implemented each stay-on feature for the doorbell LED. It is currently configured to the same LED as the motion detection, so it will always be on, now. (I don't really like that but I don't have a separate LED to test that with yet. The second LED in the diagram above is for my ATXRaspi power supply.)
@All I have started having the issue where I can no longer call into my device. I'm not sure if this is a configuration issue because I have installed on a fresh Raspberry Pi. I will check my configuration with the old device and see if I can figure this out. I know it has affected other people as well. So stay tuned on this one.
Thanks for all your hard work, I will be out of town for few weeks. I will test it when I get back. Your setup looks good, once everything is working for me. I will solder all the lose wires and put it in a project box with Bluetooth speakers.
in the log have error and warning, maybe that why i cant call from my iphone to PI. 21:01:26.786 ERROR: TCP bind() failed for 0.0.0.0 port 5060: Address already in use 21:01:26.786 INFO: Listening point [0x217a5b0] on [sip:0.0.0.0:5060;transport=TCP] destroyed 21:01:26.786 WARNING: Could not start tcp transport on port 5060, maybe this port is already used.
hi zahersyed you are able to make call from raspberry pi to your devices using doorbell push button? and you able to cal from your devices to raspberry pi?
No, I was running into few issues with linphone. Tried a different setup with. www.vibell.org that worked for few weeks and after an update that stop working for me. So I am back to the drawing board. I want the audio working both ways so I am currently looking into Gstreamer setup for audio and video streaming... don't have much time so moving slow.
@toshibochan, Thank you for the error report. I have been unable to work on this project due to pain in my hands. I still hope to get back to this, but at this point IDK when. However, when I do, your error report may be of assistance.
Thanks to you and @zahersyed for the information exchange.
Regardless of the outcome. I thank you for the time you already put into this project and truly hope you feel better and get back to 100% health.
Thank you @zahersyed, I appreciate that. I'm happy you've found it useful, too. :+1:
@lelandg sorry for hear you not feeling well. Hope you get better soon! For now I'm using my old code from linphone page and puchetta for notification!!
Thanks
@toshibochan thanks for the sentiments and the information! :+1: :100:
Waiting for motion sensor to come online.... 2016-03-27 16:24:13:043 belle-sip-warning-There is no object pool created in thread [1995640832]. Use belle_sip_object_pool_push() to create one. Unowned objects not unref'd will be leaked. Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started Traceback (most recent call last): File "security_camera2.py", line 691, in main cam.run() File "security_camera2.py", line 548, in run address = linphone.Address.new(doorbellToAddress) TypeError: must be string or None, not tuple