[DEPRECATED] Blink Camera Device Handler with Motion Sensor, Live Video Streaming, Integration with SmartThings/SHM, Temperature, Signals and Push Notifications

The link on your web site still leads to App code versioned “5.0.2”

Your browser is caching it, refresh it.

Same unexpected error message, and failed to create device notification.
Still doesn’t create any devices in the device list, but the first camera is created enough to start showing up in the logs.

Now we’re popping an NPE.

	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:34 AM:
error
java.lang.NullPointerException: Cannot get property 'id' on null object @ line 220


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
error
Error creating device: java.lang.NullPointerException: Cannot get property 'id' on null object


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Blink server successfully logged out client


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
debug
Logging out of Blink using token: [TOKEN_AUTH:drMptaax_38nD0vidYadaA]


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Found Camera front door with Id 86562


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Found Camera Garage with Id 86554


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Found Camera Basement with Id 86551


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Found Camera Family Room with Id 86543


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Found Camera Foyer with Id 86528


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Querying Blink: /homescreen


	ce40d691-a108-4814-b6dc-e1992a5bfd60

9:17:33 AM:
trace
Getting Cameras List

That’s because you haven’t opened the SmartApp and updated the settings. You now need to select the hub, that’s the error you’re seeing. Open the app and select your hub.

but you see in line 127 that you only give me the opportunity to set the hub that if there are multiple hubs…
installHubs isn’t defined in the case of one physical hub, so in the trace on 203, installHubs?.id is null (which is correct as written, but disconcerting)

putting a log.trace of physicalHubs.size() right before line 220 yields 0 so it’s as if location.hubs.findall didn’t find anything, and the NPE on 220 is because of the reference to physicalHubs[0].id

Okay you’ve some issues here, the code is fine but I think the issue is that your hubs being reported are 0 - that’s the crux of the issue. Let me connect you with a ST person who might be able to help you out.

I should also add that the trace on line 203 shows the one hub properly (via the spreads on location.hubs), so it really does look like findAll on location.hubs didn’t find anything. And the type reported in the spread was indeed “PHYSICAL”.

Strange.
I’d bet that if I changed the app to reference only location.hubs[0], I’d get farther along. Maybe later tonight…

Something it might be good to document somewhere is that if you want to remove the app, you have to break your Blink creds in the app to get it to log out - otherwise it reports that you are not authorized to remove the app.

Hmm that’s definitely weird, I would report it to ST support. In the initialize() log dumps the names and types of all the hubs found, does it show it as a “PHYSICAL” hub in the logs? Can you post what you see in the logs here from the dump?

To uninstall the app, make sure that none of your blink cameras are connected to any SmartApps and then click Remove on the SmartApp. If any devices are linked to SmartApps it won’t uninstall by design. Breaking the credentials just to remove is a bad idea and you’ll end up leaving fragments of devices behind which will cause a problem in future. Always do a clean uninstall.

EDIT: I’ve just put a check for 0 hubs reported in the SmartApp 5.0.6 and it will log the error accordingly.

@twack FYR

Thanks for the pointer @twack

@numlock try Blink Camera Manager v5.0.7 and it should work now. They “PHYSICAL” is actually not a string but a type which Iv’e fixed now.

EDIT:

This won’t work since all Dev accounts have 1 physical and 1 virtual hub (simulator). I’ve seen this switch around in the past 24 hours, sometimes the physical is hubs[0] and sometimes the virtual is hubs[0]

Yup, that explains why findAll didn’t findAny.

I now successfully have 5 camera devices, so onward with more testing.

Thanks very much for all the help.

1 Like

You all good to go here now?

1 Like

As of right now, yes, I was able to install. Now the true testing begins. Thanks, Todd.

I have these error when coping the code of the device handeler, into the new smart app form code:

No signature of method: script1462587590711725733397.metadata() is applicable for argument types: (script1462587590711725733397$_run_closure1) values: [script1462587590711725733397$_run_closure1@6746be9b] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

Please help

Thanks.

I do that:

  1. Click on “camera unavailable”
  2. The refresh icon apears, click on it
  3. After it apears Connecting, and then the crash most of the times.

I upgraded to 5.0.7 tonight and for some reason I can no longer use live preview in ST. The play button just keeps spinning and it either says connecting or active with a black image. I tried all the usual steps, installing the device handler first, opening the app and clicking done to refresh everything…just can’t seem to get it to work. No issues with snapping pictures though. Everything works fine in the native app as well. Any suggestions? Thanks!

See the instructions again in the 1st post, there’s a SmartApp and a Device Handler and they have different installation instructions.

Still can’t get live preview to work. Now it is saying the camera can not be found. I tried rebooting the smartthings and the blink hub. Also tried deleting the app and reinstalling from my phone. I could remove the code from the IDE and start over, but I don’t think that will fix anything. Pictures and everything else work fine.

Update: Okay it worked once out of like 20 tries. The rest of the time it just says it cannot find the camera or it just keeps spinning. Don’t get it…lol.

It depends on your phone, this is a VERY phone capability dependent. It’s working fine on my iPhone 4S, 5S and Galaxy S6. But it doesn’t work on my iPhone 4.

Interesting. I have an iPhone 6. I was playing with it this afternoon, and it def works once in a while. I do notice if I switch over to the native app after using it in smartthings, I get a system is busy message for about 30 seconds or so. Oh well, as long as the pictures work I’m good :). I’ll just keep and eye on it, it is in beta after all!