Hey Can you please share your code ? I have 2 Hikvision cameras that I believe has image size issue. I had been using them with swanny’s code - Synology Diskstation & Cameras - #229 by Bevanm8. Which works great for notification but I am not able to see any images on ST…Tx.
I have a foscam that did that. I changed the internal ip to a external ip and it worked fine.
Hi there, I’m also trying to add multiple cameras from the same IP, got one working great, but suspect I’m having the same issue as you, would you mind explaining your modification to a random UUID please?
@adamrhoades unfortunately i am no longer using this solution for my web cam needs with ST as it was far too buggy. all i am doing now is managing this and motion detection into smartthings as a contact sensor only using a scripts on my zoneminder box. stupidly this was a modification i did on the fly and didn’t upload to my github so i dont actually have a copy any more.
the basic crux of what i did was on the function that took the picture just before the pic was taken i set the Network ID with the correct hex IP:Port combination and i just added a step to update the Network ID of the device with a randomly generate GUID after the picture was taken so the next time another camera was used to take a pic it didn’t complain about a conflict with the Network ID, worked great until two were triggered at the same time
@pstuart - I just wanted to thank you because I simply could not have done any of the few projects I’m linking below to show you how and where your work evolved. Here’s is one notion that feel compelled to share. I’m now changing device ID to random number at end of execution so multiple devices can point to the same internal IP. This has been really useful especially when I want to point to the single Raspberry Pi but run completely different Device Handler logic. Here’s the line of code I use and it’s done at the end of the parse() function right before doing any returns.
device.deviceNetworkId = "ID_WILL_BE_CHANGED_AT_RUNTIME_" + (Math.abs(new Random().nextInt()) % 99999 + 1)
Here’s a list of my projects of mine that borrow a LOT of your contributions Thanks again, not only for figuring this out but sharing it with us. FYI, lots of folks fail above and have corrupt images. Your description of the issue is more than clear and I made sure to open a support case to give them a piece of my mind. The hubAction/S3 integration breaks at about the 40KB mark.
All the best!
@adamrhoades see my post just above. Should answer your question.
That’s a great idea for the Device ID, though it would obviously only work if something was passed back to the parse method (which it generally does). I’m going to give it a shot in my new DCS-5222L devicetype if you don’t mind
I have been trying to get the generic camera code working with my ComPro IP90s.
The camera returns JPG stills in response to HTTP Gets with basic authentication:
HTTP/1.0 200 OK
Connection: close
Server: MJPG-Streamer/0.2
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
Pragma: no-cache
Expires: Mon, 3 Jan 2000 12:34:56 GMT
Content-type: image/jpeg
I have tried reducing the image size down to 7KB and I still get a generic parse respone with no data.
I tried using HTTP Get and got a ClientProtocolException.
Using the hubAction with or without the putputMsgToS3 option below doesn’t seem to make any difference:
hubAction.options = [outputMsgToS3:true]
I just get a parse response that looks like:
Parsing ‘index:17, mac:001F1F8E3773, ip:C0A800D4, port:0050, requestId:c09b8f63-d199-4cdc-9b3d-94477ce595a8’
These are on the European SmartThings website, as my hub is in the UK.
Anyone got any suggestions?
Considering how much code I ripped from your projects to enrich mine, I definitely don’t mind, in fact honored
Looks like you’ve tried it all including reduction of size. However, the S3 call, when it works, looks like this, notice the key & bucket. I’ve never seen an image come through w/o a good key/bucket combo. My guess is the S3 implementation with ST which has always been interesting:
3:47:03 PM: debug c2e907b49c184f8d9d3bd849da00ed5b
3:47:03 PM: debug firing s3
3:47:03 PM: debug BODY—
3:47:03 PM: debug Parsing 'index:17, mac:B827EB850527, ip:C0A800F7, port:0050, requestId:6de42ae1-5c43-429f-8e14-c53688a2c8a7, bucket:smartthings-device-conn-temp, key:85c36ed2-f911-4a45-8298-30152f8704bf’
3:46:58 PM: debug useS3===true
3:46:58 PM: debug The method is POST
3:46:58 PM: debug The Header is [HOST:192.168.0.247:80, Content-Type:application/x-www-form-urlencoded, Authorization:Basic NOPASS==]
3:46:58 PM: debug body is: GPIO=&UseJSON=
3:46:58 PM: debug Uses which method: POST
3:46:58 PM: debug path is: null
3:46:58 PM: debug The device id configured is: C0A800F7:0050
3:46:58 PM: debug GPIO=UseJSON= Triggered!!!
I’ve been trying to get this to work with a Sercomm 8221. I get nothing. It sends the request and I see “HTTP 1.1” and that’s it, any ideas?
Gotta provide the log if you want help. Also show a screenshot that a regular web browser shows the image URL correctly. Lastly, try flipping between GET & POST.
Latest version of code, can’t edit the top post… Nothing new, just got lost in the shuffle.
Is this the new code you’ve been testing?
Nope, old code. Just updated link cause link at top doesn’t work and can’t edit that post.
Can all this be simplified if you just want to show an image via URL on a carouselTile (similar to SmartTiles.click web client)?
ok so I had two of my IP camaras working with the new generic video in minutes, but I’ve never got it to work with this device.
I have the working feed for my vivotek camera and tested it…
‘http://username:password@192.168.1.197/cgi-bin/viewer/video.jpg?resolution=640x480’
I’ve traced through the code and it appears to give a sensible log…
e9519546-9d01-47a4-8f35-3d01af29ce36 23:15:28: debug Parsing ‘index:17, mac:0002D10ED0B3, ip:C0A801C5, port:0050, requestId:fb93c50b-7191-448f-b357-fadde25f6e25’
e9519546-9d01-47a4-8f35-3d01af29ce36 23:15:20: debug GET cgi-bin/viewer/video.jpg?resolution=640x480 HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.1.197:80
Authorization: Basic xxxxxxxxx
The problem seems to be in the parse and the putImageInS3 is never called.
Not sure what to expect in descriptionmap to know why the if statement is false.
Can someone give me a little steer please?
thanks
Does that URL return a single JPEG file (still image)?
Yep still image
And reading back through the threads is similar problem to #348 meavydev
My Sercom 8021 was working for MONTHS after Patrick helped me, but now it’s broken again. The last change was a ST hub update.
I look in the log and what do I find ? Every time I try and take a picture the ST hub shows a disconnect !
“HUB hub has disconnected hub has disconnected hub has disconnected false”
I can reproduce it consistently. I have the same setup in another house and it’s working OK at that other house.
Inside the house the cameras are working fine.
Any ideas ? Last time the issue was my DSL MTU was wrong. If it SOMEHOW got chagned back I can’t see that causeing the hub to show a disconnect in the log when I take a pic. Or could it ? I’m not at that house so I can’t check the DSL setup.
@pstuart Should I try and update your generic camera device and see if that helps ? I’m running older code ( if it an’t broke, don’t fix it) : Generic Camera Device v1.0.07102014
I opened a ST support ticket and will post any meaningful repy.
THANKS !