I can add you as a beta tester if you PM me your username and e-mail address.
Martin
I can add you as a beta tester if you PM me your username and e-mail address.
Martin
Had another look at this - I have a camera device that I have been using for testing. Currently it had an invalid camera URL. So I changed it to a functional one, so now the dropbox plugin works. It looks like this bit of the code assumes that “downloadUrl” should be OK, when in fact for my camera device it wasn’t. Probably just need to check the return status and scribble something in the log, if it fails:
local tempfile = ltn12.sink.file(io.open('/tmp/tempimage.jpg', 'wb'))
http.request {
url = downloadUrl;
sink = tempfile;
}
Another slight problem - “GetLuaInterface can’t find device type”:
50 09/15/13 10:56:19.030 luup_log:87: Dropbox file for webcam 29 sent successfully <0x2f131680>
50 09/15/13 10:56:19.031 luup_log:87: sending device 66 images to Dropbox 87 <0x2f131680>
50 09/15/13 10:56:24.527 luup_log:87: Dropbox file for webcam 66 sent successfully <0x2f131680>
01 09/15/13 10:56:24.528 GetLuaInterface can't find device type: 4/0x11b63d8 str: 87 <0x2f131680>
01 09/15/13 10:56:24.528 luup_variable_get interface 0x11b6188 args 3 <0x2f131680>
50 09/15/13 10:56:24.528 luup_log:87: Dropbox update frequency= 10 minutes
In this function there is some mix up with numbers versus strings: “update_frequency” is loaded with either a string or a number and I think luup.call_delay expects “dropboxNumber” to be a string?
[code] function sendImagesLoop(lul_data)
send_all_images_to_dropbox(lul_data)
local update_frequency=luup.variable_get("S_WebcamDropboxUploaderSettings1.xml","SendFrequency",lul_data) or 10
luup.log("Dropbox update frequency= "..update_frequency.." minutes")
update_frequency=update_frequency*60
local dropboxNumber=tonumber(lul_data)
if(update_frequency>0) then
luup.call_delay('sendImagesLoop',update_frequency,dropboxNumber,true)
end
end[/code]
Thanks for your analysis a-lurker. Glad you got it working when setting the webcam URL differently. I’m changing the next version so it should be less sensitive to that sort of problem.
With the other errors, you are right that the error message is to do with types. It’s not that luup.call_delay expects a string though - lua does that conversion automatically. The problem is that luup.variable_get expects a number for the device. I wish they would be consistent about when you pass a string and when you pass a number, but I’ll change that in a future version too.
Thanks
Martin
This plugin is a great idea - I really like it.
I was interested when you said “uup.variable_get expects a number for the device”. It seemed to me this may be the case but the documentation refuted that idea:
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_get
It states the device number can be a string or a number. I tried a few tests and you are right; it must be a number. A string fails, so the documentation is incorrect.
EDIT: if it’s a string it must be a udn, not the device number as a string.
The lug_startup function always get’s a number, so I couldn’t figure out how it was becoming a string. Turns out that these delays change “dropboxNumber” to a string:
luup.call_delay(‘removeOldFilesLoop’,86400,dropboxNumber,true)
luup.call_delay(‘sendImagesLoop’,update_frequency,dropboxNumber,true)
If you run this code in the Test Luup code" area - the log shows that testVar is a string, although the delay was called with a number:
[code]function testing(testVar)
luup.log('DELAY ENTERED')
local theType = type(testVar)
luup.log('type is: '..theType)
luup.log(testVar)
end
luup.log(‘STARTING DELAY’)
luup.call_delay(‘testing’,3,256,true)
return true[/code]
If the very first action of these two functions was:
lul_data=tonumber(lul_data)
and that could eliminate the need for any other type conversions elsewhere.
Thanks once again for your efforts on this plugin.
If you pass a string … it is interpreted as a udn.
See the luup.variable_set for better documentation.
Thanks Richard - that now makes sense to me - the documentation is correct but my reading of it was in error. So as an example where “SendFrequency” = 8:
[code]local update_frequency = luup.variable_get(“S_WebcamDropboxUploaderSettings1.xml”,“SendFrequency”,87)
local theType = type(update_frequency)
luup.log('1 type is: '…theType)
luup.log(update_frequency)
local update_frequency = luup.variable_get(“S_WebcamDropboxUploaderSettings1.xml”,“SendFrequency”,“87”)
local theType = type(update_frequency)
luup.log('2 type is: '…theType)
luup.log(update_frequency)
local update_frequency = luup.variable_get(“S_WebcamDropboxUploaderSettings1.xml”,“SendFrequency”,“uuid:4d494342-5342-5645-0057-000001c9d682”)
local theType = type(update_frequency)
luup.log('3 type is: '…theType)
luup.log(update_frequency)
return true[/code]
Running the above gives this in the log:
[code]50 09/16/13 9:37:48.635 luup_log:0: 1 type is: string <0x2ff92680>
50 09/16/13 9:37:48.636 luup_log:0: 8 <0x2ff92680>
01 09/16/13 9:37:48.636 GetLuaInterface can’t find device type: 4/0x955fa8 str: 87 <0x2ff92680>
01 09/16/13 9:37:48.636 luup_variable_get interface 0x947da0 args 3 <0x2ff92680>
50 09/16/13 9:37:48.636 luup_log:0: 2 type is: nil <0x2ff92680>
50 09/16/13 9:37:48.637 luup_log:0: (null) <0x2ff92680>
50 09/16/13 9:37:48.637 luup_log:0: 3 type is: string <0x2ff92680>
50 09/16/13 9:37:48.637 luup_log:0: 8 [/code]
The first test has the device number as a number and works as expected:
The second test has the device number as a string and fails:
The third test has the device number as a string but the string must be the Unique Device Number (UDN) and works as expected:
Hi. I love this plugin concept, and look forward to making it take a picture when someone presses by doorbell.
I have a Foscam camera. I don’t know if the way the URL is built differently than others. All my jpg files in Dropbox apprear to be zero byte
My device properties have separate device parameter values such as:
ip= 192.168.x.xxx
URL= snapshot.cgi?size=640x480&quality=4
username= admin
(I haven’t got a password defined, so password is blank).
I did try building the URL as per http://{ip}{URL} in a browser. After entering username and password, I do see the camera image. I was unsuccessful using the format http://{user}:{pass}@{ip}{URL} (possibly due to the blank password?)
Will the updated version of the plugin support the Forcam camera please? If so, is that die to be released soon? Is there any work round or setting I can change to make it work for me? Thank you.
I submitted a new version at the weekend which should solve your issue. I’m still waiting for that to be approved my MCV.
However, if you want to get it running sooner, I suggest adding a slash at the start of the URL, i.e. make it /snapshot.cgi?size=640x480&quality=4, and put in a dummy password, e.g. admin. I suspect it will work fine then.
Martin
The new version works brilliant for the Foscam, I already have the new version and it is great. I setup a scene which sends a pic whenever motion is detected
Thank you Martin. I followed your Foscam advice and it now works perfectly!
@Martin. Are there specific limitations on how quickly I can take successive snapshots? When my doorbell rings, I would like to take say 3 snapshots in quick succession in order to increase probability of a clean shot of the person at my door. Perhaps 0.3 seconds apart.
I have tried this with timers between 0.2 and 1.0 seconds, but my results are very variable, showing that in many cases it could be as long as 2 seconds between snapshots.
Thanks.
There’s no in built limit on the upload rate, but it does have to download the webcam image to a local file, upload the local file to dropbox, then delete the local file, and it can only do that one step at a time. And it can’t do the second one until the first one has finished. How long it takes will depend on how fast the connection is to your webcam, how big the image is, and how fast your connection is to dropbox, and I can easily imagine that taking a few seconds in reality.
Martin
I am also looking forward to adding this scene for this plugin. Can you please post the steps on how you achieved it?
Martin, fantastic plugin by the way. Love it. Works flawlessly.
Here we go:
lul_settings={}
lul_settings[“webcamNumber”]=17
luup.call_action(“urn:milliesoft-com:serviceId:WebcamDropboxUploader1”,“SendSnapshot”, lul_settings,259)
Change the 259 and 17 to your device numbers. Whenever the motion sensor gets tripped, the scene is started
[quote=“Crismaison, post:35, topic:176879”]Here we go:
lul_settings={}
lul_settings[“webcamNumber”]=17
luup.call_action(“urn:milliesoft-com:serviceId:WebcamDropboxUploader1”,“SendSnapshot”, lul_settings,259)
Change the 259 and 17 to your device numbers. Whenever the motion sensor gets tripped, the scene is started[/quote]
Thanks for a fast response. Just before reading your thread i had created a new thread for the same.
Quick question regarding the numbers you posted above, i understand that 17 is the webcam device number that i got to replace with my webcam device number, but what is 259? what device is it for?
Also, do i need to create a new scene for this and actions and add the luup code you posted above?
If so, can you please guide on the steps for creating what scene?
259 is the dropbox device id. You create a scene and paste this ciode in the luup part.
Are you familiar with triggering scenes?
[quote=“Crismaison, post:37, topic:176879”]259 is the dropbox device id. You create a scene and paste this ciode in the luup part.
Are you familiar with triggering scenes?[/quote]
Thanks for your reply. yes i am familiar with triggering scenes. Just now i created new scenes with triggers and schedules using this post.
http://forum.micasaverde.com/index.php/topic,11161.msg79424.html#msg79424
Awaiting your reply. Thanks for the help.
Also, can videos be uploaded to dropbox using this plugin.
I was thinking if i could create a scene that could trigger to record videos for 1 min and upload to dropbox when the door lock is opened.
The last reply of the creator in the dropbox thread explains how it works, videos are not possible.
Best Home Automation shopping experience. Shop at Ezlo!
© 2024 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules