[PROJECT] Driver for Blink API

The URL for a thumbnail is structured like:

https://rest-${ state.Tier }.immedia-semi.com/media/production/account/${ state.AccountID }/network/${ NetworkID }/camera/${ CameraID }/${ Thumbnail File.jpg }

However, just using the URL will not work since it needs the authorization token in the headers. That is why I cannot just use the URL with an image object in the dashboard to show the thumbnails. That is also why I do not have the URL directly represented anywhere, because it would not help people and would cause more confusion.

1 Like

Just noticed 0.2.14 is available. Just updated and all appears to be working again! :+1:

I updated to 0.2.14 yesterday and noticed this morning my cameras were still armed. I have rule that arms them around 11:30 PM and disarms them at 7 AM. The arm command must have worked but the disarm must not have.

I found this in the logs.. not much to go on.

After updating, I did hit 'save preferences' for the parent Blink driver. Do I need to try logging out and back in again?

[dev:364]2021-02-23 07:00:01.133 am [error] Blink - Unauthorized, attempted [Method:Disarm System, ID:39640]

I updated to 0.2.14 this morning and am still getting the unauthorized error. Blink sent me a pin email this morning as well. I tried entering the pin into the verify PIN command, but all I got back was a 404 error.

Update: I just cranked the logging up to TRACE and it appears that the authorization was successful. It just isn't displaying correctly in the driver page. If I do a GetHomeScreen it gets updated with the correct information.

Edit: I just noticed I was really on 0.2.13 so I guess my update didn't actually go through. I feel like that's a known issue with Hubitat and the Import button.. anyway, I'll get 2.14 and try again

I saw this and I figured I could fetch the image with my dashboard app - but I'm not able to get it using Postman. I added the "TOKEN_AUTH" header but I get back a "Media not found" response. I double-checked all of the variables in the URL and tried for 2 different cameras.. just curious if you know what I might be overlooking or missing

I just installed this version clean today and ran into the same thing including the 404 in the logs. After doing a GetHomeScreen it seems to have updated and built the child devices.

@scoob8000, is it working fine now? I wonder if the 1 authorization a day might be too little...

No matter what it looks like the PIN thing is going to stick with us. I am still getting them even with the new authorization version.

@jpage4500:
The import having the old version is pretty well-known.
Here is the (basically identical) CURL example from MattTW's Blink API page:

curl --request GET \
  --url https://rest-prod.immedia-semi.com/media/production/account/1234/network/1234/camera/123456/theClipFileName.jpg \
  --header 'token-auth: {Auth_Token}'

Its working for me. I can't speak for the old version because this is new to/for me.

I've been using webcore and ifttt webhooks for awhile. But this will make things more flexible.

Great work!

thanks.. rats.. i can't get it to work so I must be doing something wrong. I tried both rest-prod and rest-u008 (which is the tier my account is on). rest-prod returns 'unauthorized access and rest-u008 returns "Media not found".

I double-checked all of the values including the auth token..

Does that thumbnail name look correct?

curl --request GET \
  --url https://rest-u008.immedia-semi.com/media/production/account/ACCT/network/39640/camera/88951/fw_7.98__hBn1rSJx_2020_12_05__01_25AM.jpg \
  --header 'token-auth: AUTHTOKEN'

{"message":"Media not found","code":700}

I'm not sure I want to update to .14 :slight_smile:
I haven't had a PIN since yesterday and everything is working fine so far.
Ignore me, yeah it's working but device says:

  • Armed System(s) : [284174, 118478]
  • Authorization : Unauthorized
  • Camera(s) With Motion Enabled : [371746]
  • Status : Unauthorized. Please perform Authorization and try Disable Motion Detection again.
  • Updated : 2021-02-22T15:12:23+00:00
  • Version : New patch 0.2.14 available

Updated and entered fresh PIN. Loged in fine but still says Unauth and reminds me of new code that I already have.

  • Armed System(s) : [284174, 118478]
  • Authorization : Unauthorized
  • Camera(s) With Motion Enabled : [371746]
  • Status : OK
  • Updated : 2021-02-22T15:12:23+00:00
  • Version : New patch 0.2.14 available

State vars seem to indicate all is well though:

State Variables

  • Video Limit : 500
  • Video Purge ID : 2303387625
  • Driver : BlinkAPI
  • AuthorizationFailures : 0
  • Local Storage Notification : true
  • Max Owls : 10
  • Camera Usage Notification : true
  • Authorization : OK
  • Bandwidth Notification : true
  • Blink New Info Date : 20210204
  • Verified : true
  • Low Battery Notification : true
  • Version : 0.2.14

Yes GetHomeScreen on 0.2.14 is what I’ve done and so far, so good. Still monitoring.

Yeah, there are two oddities there:

  1. The Version field messaging only gets updated when it runs the check for any new versions. So it will clear out tomorrow. This is expected for how I have it written. I felt having it check my site every time it refreshes (the other main time) would be a bit excessive.
  2. I have NO IDEA why the Authorization EVENT has a different value than the Authorization STATE and I have seen this one myself. They are set at the same time (I call a command ProcessEvent... which sets the State for the variable passed it and then creates an Event for it). I triple checked every instance of it in the code and they all are the same. I spent a bunch of time trying to track down what causes them to be different. At this point it must be something really simple. :frowning:

Those are the worst :wink:

That thumbnail did NOT look normal to me until I looked at my Mini. All of my normal cameras start with "clip" for the thumbnail name. Only the Mini started with "fw".

The Mini has a different path I think:

https://rest-${ state.Tier }.immedia-semi.com/media/production/account/${ state.AccountID }/network/${ Network }/owls/${ it }/${ ThumbnailFile }

So your URL MIGHT look like:
...rest-u008.immedia-semi.com/media/production/account/ACCT/network/39640/owls/88951/fw_7.98__hBn1rSJx_2020_12_05__01_25AM.jpg

Is is normal/expected to get a blink access code via text daily after setting this up?

Unfortunately, yes. It did not used to be but Blink changed something about the API and it has not been figured out yet.

After the very first PIN verification, once your system is working, you can just ignore all the rest. If texting is not set up, it would be an email for it every day. The original authorization method was performed every 12 hours. But it looks like they leave the token valid for longer now so I was able to push that out at least.

Okay. No big deal. I haven't responded to or done anything with the texts and the API still works so I figured it safe to ignore. :slight_smile:

Anyone seeing a failure today?
I noticed my WC piston sends commands to Blink but none of my cameras are enable/disabling anymore.
I did get the usual PIN this morning and ignored it.
Had to manually Authorize in the driver.

I'm having to re-authorise manually every few days. The status shows as " * Status : Unauthorized. Please perform Authorization and try Arm System again.".
I then have to press the authorise button and then verify the resulting PIN that I get in a text. Then select Get Homescreen and the status changes to "OK" and everything works again.