[PROJECT] Driver for Blink API

I maybe mistaking but I doubt that a complaint resulting from an unauthorized usage of their API would yield any good.

Then why do they authorize the device?

For the moment we enjoy the fact that ones can use his own account credentiel to access their API in order to control its associated devices. But this way of doing thing is not supported nor warranted by blink. They allready block smartthings users from doing the same thing.

If anyone could correct me on this, please do so.

Nope, you hit the nail on the head!

Yes, please don't upset the apple cart too much.
I so missed Blink when ST got blocked and now I get texts 2 times a day which I ignore to get my WebCore piston to automate my cameras again!

2 Likes

I should be able to reduce the number of those irritating emails/texts... but still confirming how long an auth token lasts. Unfortunately my logs filled and ran past where I could see when I actually last authorized... so I need to do it again (and I copied it all down on paper as well).

3 Likes

Ok... so the latest I have to share on this all. I have found I can "safely" switch the authorization schedule to once a day.

I have ALSO found that Blink updated the API to a new version for authentication and changed how that structured the response data. This is brand new (I JUST found it) but I did not get any new PIN sent to me when I used it. Then I confirmed it on GitHub - MattTW/BlinkMonitorProtocol: Unofficial documentation for the Blink Wire-Free HD Home Monitoring & Alert System... wish I had checked there a week ago.

Updated Version(s):

  • BlinkAPI.groovy = 0.2.13

Change(s):

  • Authorization is now resubmitted every 24 hours instead of every 12 hours, you will need to Save Preferences after importing the updated driver to benefit from this.
  • Updated Authorization related URLs to use the new version Blink appears to have and the new data structure that it responds with.
  • Removed the GetSyncModuleEvents command as it no longer appears to work with the changes to the Blink API.
  • Changed the GetNewThumbnail URL as that appears to have been changed. There is also a lot more data fields returned (none of which seem actually useful).
5 Likes

Great work! @snell

So this morning by Blink cameras didn’t disarm. I’m getting “unauthorised” message.
If I click the Authorised button within the device, nothing seems to happen. Didn’t receive any PIN either. Any ideas?

I'm seeing the same thing after updating to the latest driver. I get "unauthorized" and clicking the Authorize button does nothing. I see this error in the log:

dev:4992021-02-22 11:08:28.022 am errorBlinkAPI - Unauthorized

For those that are brave, I've fixed mine by changing the driver call to authorise on line 383 from:

Params = [ uri: "https://rest-${ state.Tier }.immedia-semi.com/api/v5/account/login", contentType: "application/json", body: "{\"unique_id\": \"${ state.ClientID }\",\"password\":\"${ Password }\",\"email\":\"${ Email }\",\"client_name\":\"${ ClientName }\",\"device_identifier\": ${ DeviceType },\"reauth\": True}" ]

to:

Params = [ uri: "https://rest-${ state.Tier }.immedia-semi.com/api/v5/account/login", contentType: "application/json", body: "{\"unique_id\": \"${ state.ClientID }\",\"password\":\"${ Password }\",\"email\":\"${ Email }\"}" ]

then click Authorize in the Blink Parent and then Get Homescreen.

1 Like

From that fix it looks like the reauth request to Blink is not being handled properly... Ugh. I will have an updated version later this afternoon (now posted). Sorry folks.

Updated Version(s):

  • BlinkAPI.groovy = 0.2.14

Change(s):

  • Removed the "reauth" being sent to Blink in authorization that was SUPPOSED to tell them it was a reauthorization and that a PIN was not needed... but instead seemed to break it...
  • Removed the Device Type preference and related command being sent to Blink in authorization that was SUPPOSED to make PINs easier to tell they were coming from what you set.
5 Likes

How do you find the complete url to the Thumbnail??

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.