[PROJECT] Driver for Blink API

Ok, I am on now so I can try to catch up on all of this. Unfortunately, I avoid checking online when I am during work hours.

@jb1: Unfortunately, I have not seen that error reported by anyone before. So... assuming NOTHING else has changed with your network or such:

  1. You already tried rebooting the hub, to no success. (This would not have been my first recommendation, but it is out of the way already).
  2. Have you tried reauthorizing the driver (using the Authorize command with reauthorize set to true)?
  3. If #2 fails... try resetting the authorization entirely by doing the Authorize with reauthorize set to false. This will require you to get the PIN from Blink (should arrive on whatever phone is tied to your account). Like when you first set up the Blink, you will then need to enter that PIN for the "Verify PIN" command.

Beyond that... It sounds like a network issue but you said nothing changed there, correct? You are not having any issues using the normal phone app? I hit the same link that @nutcracker provided when looking (and before I got through the whole line of posts).

It does not matter if the HE and the Blink devices are on the same network. This driver cannot communicate directly with any of them (nor does it try to). It communicates with the Blink API servers.

1 Like

Thanks for your reply @snell .

Currently so far no changes. Yesterday morning I still received temperature from the different cameras. Now everything is dead.

Unfortunately I had no time to dig into this deeper today. I will play and test a bit more over the weekend.

To me it looks like an network issue, but what I don't understand Phone and Blink sync module work fine and are connected to the same WiFi/LAN than HE hub.

Will connect the hub to a different network tomorrow and will test if this changes anything. Maybe the hub causes all this trouble. I don't know why, but maybe. I did a reboot, tomorrow I will try a power cycle and test with the network.

Authorization (true or false) didn't help, because it seems I can't reach the Blink server.

You got the same 406 error even for authorizations? That is VERY strange...

I will let you know if I think of anything to check otherwise.

1 Like

Please see shot below

image

Network looks good to me everything behaves normal besides these drivers.

Any help and thoughts are highly appreciated. I really love(d) this integration.

Thanks

I also started to get 406 from Blink, I have tried following things.

  1. Reboot
  2. Repair Blink from HPM
  3. Uninstalled and Installed Blink.

No success, still getting 406.

Thanks

1 Like

I got it working again.

Changed the User-Agent header in BlinkApi from

'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'

to

'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.193 Mobile Safari/537.36'

Authorizations worked and populated all child objects, disarm and arm works as charm again.

/Thanks

1 Like

Oh man if this helps you really make my day.
Should I try to fix by myself or wait for an fix from @snell.

Thanks for your digging and letting us know....

It's easy todo it your self and try if it works.

Goto Drivers Code and open BlinkApi
CTRL + A to select all and select copy then paste it in some other editor like Notepad++

Find and Replace

'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'

with

'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.193 Mobile Safari/537.36'

Copy this and paste it back to BlinkApi and click save

Cheers

It looks like Blink is starting to block "unauthorized" use of their API again, if these changes did indeed fix them. This has happened before but not with the 406 error. In addition, it seems like they are "trying" it because not everyone is hitting the error.

At this time I would say if you feel comfortable making the change, please do. I will try to find a more "permanent" solution. Maybe if Hubitat can detect the browser being used and put that in... Or it may just be a new Preference field.

1 Like

I did the changes in the code and don't get the 406 error anymore.
Now I get "Blink Camera - Unauthorized".
image

Seems to be one step further. Sorry for asking @snell / @zimba, what is the next step. Authorize true or false?
Thanks for any help

I guess since you already have completed the PIN verification you can go ahead with

"Authorize command with the Reauthorize parameter set to true."

This is what I did.

Regards

Strange thing, I received an email from Blink that a new device was added to my account. But I don't see the device "null" in my Blink account :frowning:
Can I do something wrong? Something additional to do after the authorizing/reauthorizing?

Got it to work, yessssssssssssssss!**

Thanks @zimba and @snell for your support!!!!!

Cannot take any credit here... This is all @zimba for determining that they are playing with the User-Agent header again.

1 Like

Greetings from the Home assistant community which was facing as well trouble with the Blink Servers. Same issue.
I forwared your comments regarding the User-Agent.

They just tried it and now it works thx to u.
Good job :slight_smile:

BR

2 Likes

Updated Version(s):

  • BlinkAPI.groovy = 0.5.18

Change(s):

  • There is now a Preference field for the User-Agent value that will be provided to Blink during requests. This is because they have (again) set a restriction for at least some people that appears to be based on what is here. You should NOT have to set anything in this field as I have changed the default value and it is working on mine without issue. I will be checking this now and then and updating the default. But the Preference is there if people need to change it. Thanks to @zimba for confirming the restriction and to @jb1 for being the canary. :slight_smile:
  • A few attributes had their name changed (driver ones, not ones that affect data/Rules using the driver). "Driver Name" to "DriverName", "Driver Version" to "DriverVersion", and "Driver Status" to "DriverStatus". This did not change much but this is a start to me changing attribute names to help alleviate the visual "glitch" that device pages have when an attribute has a space in the name.
1 Like

I am getting what seems a spurious error in the log.
When I click on the "get thumbnail" button on the device page for my blink doorbell, it does update the doorbell thumbnail, but it also puts out the following error message in the log:
" dev:5972024-01-07 06:30:13.158 PMerror Blink system - Requested resource not found, attempted [GetNewThumbnail:148893, Type:Doorbell]"
I have deleted the doorbell, and done a "get homepage" to get it automatically re-added, and it finds it, but the spurious log error persists....

One strange thing I noticed is that, when I view the device on the right of the page, it shows a different network id that doesn't match the ID? Here's a partial scrape:
" Current States

  • Driver Name : BlinkChild-Doorbell
  • Driver Status : Up to date
  • Driver Version : 0.1.4
  • Enabled : true
  • ID : 148893
  • Issues : []
  • Motion Detection Enabled : true
  • Name : doorbell
  • Network ID : 467076
  • Status : done

Any suggestions?

Thanks,
Philip

The ID and Network ID are different attributes. The ID is that specific device's Blink API ID, but the Network ID is what network the device belongs to. Many commands require both (and more).

As for the strange error message... Is it actually getting a new thumbnail entirely or just replacing it with whichever one is shown in the app (that may not match what the driver currently shows)?

The "Get Thumbnail" actually performs two commands behind the scenes:

  1. The first thing the GetThumbnail triggers is another command to GetNewThumbnail (telling Blink to get a new thumbnail for the particular device). Then in pauses for 5 seconds to let the API do it's job.
  2. Then it sends the actual request for the thumbnail so that it can be displayed in the device data/stored on the Hubitat.

Of those two "Requested resource..." is ONLY coded within the GetNewThumbnail portion of the code. So that could imply that they have changed the URL to request a new thumbnail for doorbells (I tested it on my cameras, without error, but I do not have a doorbell or floodlight to test on those). But you said it is still getting a new thumbnail anyways...

I noticed today that the armed status is out of sync between the two of my cameras and the entire system.
The blink app states "System Armed" which is correct.

One of the blink cam (child camera) states:
image
Edit: A "System Arm" command at this specific camera didn't change the status.

The second camera (child camera) states a different "arm" status at the same time.
image

The Blink child-network states armed as well.
image

It seems only one of my cameras is out of sync.
I can switch motion detection on and off but in combination with my HD+ dashboard states a wrong status.

I tried the "Get Homescreen" command (BlinkApi) which seemd to fix it, but a couple of minutes later the specific camera lost its status again.

The only errors in the log file are shown below. I saw this when I turned both cameras on or off at the same time (timing issue with the API - probably).

Any ideas?

Thanks in advance

I typically see a conflict detected error when the Blink API is given commands too quickly. I can even hit something similar using their app actually. For any of the data, I try to not to make any assumptions and only report the data that the API has returned but it could get out of sync somehow (maybe?). The Get Homescreen command is the one for the vast majority of information.

I hate how the made the app nowadays... it makes it much more difficult to match things up than it used to be. I am not even sure if I should show Armed on the cameras anymore because the app does not separate them anymore.