[PROJECT] Driver for Blink API

@snell,
Thanks for your reply.
I have enabled trace logging.

Summary


Same here. Deleted doorbell device and then waited for it to be re-added. Then battery attribute appeared. Perhaps because the driver doesn't update the attribute unless the received value is different from the state variable.

Yes, to save on "unnecessary" writes for events or just state variables my drivers do not write if the value changes. Since most have hundreds of values being received during responses.

So it is working though? Maybe I should start clearing everything when a device's Preferences are saved... Something to think about.

Thank you! It is working - i think (the battery reports at 75 - do you know if this will ever change?) - and I am able to retrieve the value in webcore. Clearing the state variable when prefs are changed would be helpful, i think. Thank you for all of your effort in putting this set of drivers together!

It should change... eventually. When the API finally reports the other value it should switch to 0%. If you mean, will they change the method to make it more accurate, my bet would be no. If a device does not already use the voltage reporting, it probably would not in the future.

When I start a general update I will probably try to remember to set up a clear.

Hi there - after looking through this entire thread, it looks like you stopped working on adding a thumbnail image because you were (at the time) unable to store image files. I was wondering if you tried to add this functionality since uploadhubfile() function was added in 2.3.4.132 (see Release 2.3.4 Available - #15 by gopher.ny) and

I had not even noticed that on the release list...

I will try to look into it again over the week. Thanks for letting me know!

Right on! Fingers crossed!

Thanks for pointing this out! Initial tests have been successful (I can get a usable image) for my Mini (owl) camera. There are problems to iron out (the URL does not work for my older cameras for example) and the image provided is NOT a thumbnail (it is 1280x720)... but I hope in the next few days I can at least start to provide something after so long.

This is going to be valuable for my Unifi Protect driver also... They handled the images differently so I could already get and display snapshots... but now I can save them as well. So thank you very much!

1 Like

Hey - its called a community for a reason, right? :sunglasses: After reviewing this thread, I searched all posts for other drivers that saved images and just luckily stumbled upon some code on github that used the uploadhubfile() function. Reviewed the code for your drivers and didn't see it being used. Then searched all posts for that. Just dumb luck and persistence (which is 90% of successful coding I think).

Anyway, I'm glad to have helped - this driver has been such a great help to me and to many others - so you're the one who truly deserves our thanks.

Updated Version(s):

  • BlinkAPI.groovy = 0.5.13
  • BlinkChild-Camera.groovy = 0.1.4
  • BlinkChild-Doorbell.groovy = 0.1.3
  • BlinkChild-MiniCamera.groovy = 0.1.3
  • BlinkChild-WiredFloodlight.groovy = 0.1.3

Change(s):

  • Added capability to process and store thumbnails. Tested (at present) on Camera (xt, xt2, indoor
    "white", and mini "owl"). Should work on Doorbells and Wired Floodlights also. Images are posted within the device as well as stored in the File Manager. In File Manager they are named with _Image.jpg. These are the full image received by the camera not just a thumbnail. On the device they are displayed in a smaller version "Thumbnail" and a full size version "image" (so it is compatible with the imageCapture capability), although they are all actually the same.
  • The various child drivers needed minor updating to properly call the thumbnail method.
  • Some cleanup in Armed and Armed System(s) data to reduce event calls.
  • Reducing some Info and Debug logging to Trace logging.
1 Like

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)