[PROJECT] Driver for Blink API

Outdoor Gen3 also work.

2 Likes

I get this error for the doorbell:

And (not surprisingly I imagine) Outdoor Gen1 as well.

This is really useful ! Thanks!

The XT2 motion detection being abysmal (and I haven't seen convincing evidence that the Outdoor Gen1 is any better), I find myself wishing one could either:

  • manually trigger a clip recording
  • change the motion sensitivity

this way I could compensate somewhat / avoid false positives using other motion sources.

I imagine if those functions are already there, the API for it hasn't been reverse-engineered?

There MUST be a way they are handling motion detection (it works via the app)... but the only way with the API (as it is) would be by polling, which would involve polling WAY more frequently than reasonable. So there has to be another way (ex: websockets or similar OR the API has a "push" capability to send notifications to apps) that has not been determined yet.

Hello again. So the thumbnail and image were saved as intended the first time I clicked "Take". However, any further attempts to take a picture result in only the thumbnail being saved to the "Current States". The image is not updated in "Current States", so I don't get an updated image in my dashboard. I note that both the updated thumbnail and the updated image appear correctly in the "State Variables" section.

I get this same result for a doorbell and an outdoor camera.

Not seeing the same behavior... so time for troubleshooting. So few questions:

  1. What type of outdoor camera is it?
  2. Are there any errors in the log for it?
  3. What URL are you using for the image in the dashboard? The one for the image in File Manager?

I just re-tested with my XT2 at the front door and each time I hit Take (or Get Thumbnail) it updated all spots. I do know that if you leave the device's webpage open (if you are viewing it) the image will not update (for display on the page, it IS updated behind the scenes) until you refresh/reload the webpage. Another spot to check is the saved file in the File Manager. That one has the timestamp of when the file was uploaded to it also and it (and the image) changed each time for me but even there I had to refresh the File Manager webpage to see the new time since it is not like it dynamically refreshes the page (at least not fast enough for my testing if it does).

This issue occurs with all of my Blink cameras, which includes XT - Gen 1, Indoor - Gen 3, Outdoor - Gen 3, a doorbell, and a mini,

No, neither the Blink API nor the camera device has any errors - and I set the log settings to trace. Here is the log for an Outdoor Gen 3 camera device right after I clicked Take:

dev:2772023-10-28 05:58:07.416 PMtrace camFrontDoor - State: Snooze = null
dev:2772023-10-28 05:58:07.194 PMtrace camFrontDoor - State: Snooze = false
dev:2772023-10-28 05:58:06.968 PMtrace camFrontDoor - State: API Data Updated = 2023-10-29T00:50:16+00:00
dev:2772023-10-28 05:58:06.205 PMtrace camFrontDoor - State: Created = 2021-06-19T08:07:43+00:00
dev:2772023-10-28 05:58:03.354 PMtrace camFrontDoor - State: Transaction = nbJAmq2NGxwGflNY
dev:2772023-10-28 05:58:02.150 PMtrace camFrontDoor - State: Player Transaction = _0ijSb4_cewLKgIo
dev:2772023-10-28 05:58:01.875 PMtrace camFrontDoor - State: Execute Time = 2023-10-29T00:58:04+00:00
dev:2772023-10-28 05:58:01.704 PMtrace camFrontDoor - State: API Data Updated = 2023-10-29T00:58:04+00:00
dev:2772023-10-28 05:58:01.320 PMtrace camFrontDoor - State: Created = 2023-10-29T00:58:04+00:00
dev:2772023-10-28 05:58:01.257 PMtrace camFrontDoor - State: Stage Rest = 2023-10-29T00:58:04+00:00
dev:2772023-10-28 05:57:59.293 PMtrace camFrontDoor - Getting thumbnail on Camera ------.

Yes, the urll for the image in the device. As I mentioned, the image in the tile itself -- the one in "Current States" -- is not updating, so I'm not suprised. I'm using HD+, which automatically selects the image url, and it is the old one in Current States, not the updated one in State Variables.

Thank you!

There is one error in the API Device log:

dev:2722023-10-28 06:04:36.643 PMerrorcom.hubitat.app.exception.LimitExceededException: Device 272 generates excessive hub load on line 3990 (method ProcessHomescreen)

That is very strange, as the State Variable is set in the same process as the Current States.

I think I did not explain clearly what I'm looking for. It would be neat if I could use the Blink cameras as motion detectors in HE, but I don't really need it tbh.

My problem is this : the Blink motion detection performance is bad, at least on the XT2 and not perceivably better on the Blink Outdoor (gen1). Even after carefully setting up motion zones, in order to reduce false positives (a passing cloud on a sunny day, stronger winds moving foliage, etc) and keep reasonable batttery life, I have to set motion sensitivity fairly low (can't go above 5-6). Which causes the cameras to miss motion events I'm actually interested in.

I have a Hue Outdoor and a Yolink motion sensor in the area and they are far less susceptible to false positives. What I was thinking is that when I get a motion even from either of those, I could (either or both) :

  • crank up the motion sensitivity on the Blink camera for, say, 15-30 min
  • trigger one or several motion clip recordings

I don't need the clip downloaded to HE, just to trigger it. I saw some code in Blinkpy that appears to be related to this, but of course I have no idea if or how it works.

I get it now. So regarding the two options:

  1. I have not found a way to change the motion sensitivity in the API. It reports it... but configuring camera settings is not something I know how to do at this time.
  2. Triggering a video clip though... I have had some rough underlying stuff for it but never implemented because I could not think of a way to bring the videos INTO Hubitat. But if it just has the clips accessible via the app only, maybe that would work? I will see what I can do, since I am already trying to figure out if there is any way to improve the images for @Kvothe.

EDIT:
Shockingly... my first attempt at the new clip worked. It is also interesting to note that when it is triggered, shortly after the phone app gets a notification about motion detected and has the clip. So apparently when they detect a new clip is added that is how motion has been detected. I still need to try it with a couple of the other cameras I have... but it should be posted soon.

Still not sure about the image interaction @Kvothe is hitting because mine still seem to be working as intended. Maybe it is some interaction with the tile... maybe an image caching issue... not sure. If the State Variable is being updated though... the image is being received.

1 Like

Updated Version(s):

  • BlinkAPI.groovy = 0.5.14
  • BlinkChild-Camera.groovy = 0.1.5
  • BlinkChild-Doorbell.groovy = 0.1.4
  • BlinkChild-MiniCamera.groovy = 0.1.4
  • BlinkChild-WiredFloodlight.groovy = 0.1.4

Change(s):

  • Added command to trigger new video clips "GetNewVideo". These are NOT saved to the Hubitat, but will show up in the Blink app (and trigger a motion detection notification). Confirmed working with XT, XT2, Indoor, and Mini at this time (the ones I have).
2 Likes

@kvothe
I am going to reach out to @jpage4500 about the HD+ tile. I have HD+ on a tablet and I am seeing that the image does not refresh even on dashboard update (swipe from the top) although the images in my Hubitat child device HAVE been refreshed.

So I do not think this is a driver-side issue, but an interaction with HD+ (I found another thing I need to check on with him also when setting it up).

Awesome! Works great on my XT2s. Thanks so much! :smiley:

While Take works, GetNewVideo doesn't seem to work on my Outdoor gen1 (says Type : catalina in the device page). However that camera isn't subscribed and stores clips to a USB stick, in case that makes any difference. I know for instance that IFTTT integrations don't work unless the camera is subscribed (even though Blink won't admit it).

Here are some trace-level logs from that device:

Summary

I did not even know there WAS a catalina! I did not remember that type (I thought my xt was in the category for first outdoor camera). Looking back in the thread I do see two previous references people sent in logs though. Huh...

If the clips are not stored on Blink's servers... is the app able to get them?

Different thing to check... Your camera's DNI is actually "Camera-871516" correct? No space in it?

Lastly, can you send me a message with the Trace logging when you run the command? In particular I am interested in the line that starts with "New Video response for".

Yes. There is a tab for Blink Sync Module 2's that have an attached USB thumb stick. Looks like this in the app (note the absence of a thumbnail in the clip list).

Correct, looks like this
image

Will do. Did not see that line though EDIT: ok found it.

I think it's because the app caches images so if the URL doesn't change it'll just use the cached version. I have an image tile which adds logic to force refresh the image every X seconds (user configurable)

I will get the latest driver and test it out (possibly today but I've got kids activities so it might be this week). I can add an option to auto-refresh and default it to something. How often does the image update?

I sent you a separate message going into this in more detail, including about the image tile (I tried it in my HD+). But it sounds like what I was thinking might be it (cached images).

There is no specific refresh interval for the thumbnail as it is manually triggered (or by a Rule or such). I am not making it an automatic thing at this time. So if there was an auto-refresh interval that could be set (like the image Tile) OR the image tile used (depending on what I mention in my message) then it could be handled that way.

I had a thought.. if the thumbnail/image URL had a timestamp in it -- like the one for Thumbnail File that would work for the caching logic. Meaning if the Thumbnail attribute added ?ts=1698672204&ext= to the end of the image URL then HD+ would reload the image whenever the ts= value changes but would still cache it when it doesn't. Which seems like a good idea since the image may never change or could change often in a future driver update.

Thumbnail: <img height=\"25%\" width=\"25%\" src=\"http://192.168.0.201/local/Camera-89002_Image.jpg\">
...
Thumbnail File : /api/v3/media/accounts/36734/networks/39640/xt2/89002/thumbnail/thumbnail.jpg?ts=1698672204&ext=