[PROJECT] Driver for Blink API

Still working at getting thumbnails to be displayed (if possible).

As for control from the camera children themselves (for enable/disable), I think I can add that without too much trouble. So thanks for the feature request. I will likely make the modules allow for arm/disarm as well, plus enable/disable "their" cameras.

2 Likes

FWIW, I've received the verification email two days in a row around the same time. I'm ignoring them and it doesn't seem to matter .. arm/disarm still works fine.

Meanwhile, an error that gets logged but doesn't seem to be hurting anything. Maybe because I renamed the child devices?

Weird. The verification email should only be triggered if you hit Request PIN. It might be because of the reauth, but that should not be needed if everything is working. Blink did not bother to email mine in such cases, but I guess I will have to account for such.

As for the child... That brings up a good point. I think my checks are all based on child name, not DNI. I should change that. It also means that problem exists on ALL my child-using drivers. But you are the first I think to mention you changed the name. Something to add to tonight's work.

2 Likes

I was going to change the name too but saw that post and figured I'd wait.. good thing then. Is there a way to default the child name or label to the device/camera name? No biggie if not.. just wanted to organize the children devices somehow

1 Like

I’m assuming the UUID passed at login is consistent each time? Will help in reducing the need to verify.

Yes, the Client (UUID) value is stored as a State Variable. This is returned by Blink when the RequestPIN function succeeds and is used from then on. It is different from the ClientID value I generate for the device.

1 Like

The child name cannot be defaulted to it, because it is not known at the time the child is generated. However I will see about changing the label to match the name. That makes sense.

2 Likes

@snell great effort in building this! Finally got round to installing.

So a clean install... all appears to have been configured and connected ok. I’m seeing a few of these:

8652020-09-25 22:18:02.419 errorBlink - addChild Error, likely child already exists: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

Did you rename some child devices? If so, see above posts.

Nope, nothing renamed. A clean install.

Hmm... Not sure why it is getting those. That section is pretty basic. The version that should be posted soon will add the name to the label... but when it does the addChild routine it is checking against the DNI anyways so even renaming should not affect it (unless you edit the DNI, but it should just create a new one then). So I am not sure why these are happening. Something to look at but right now I want to get the other fixes and changes in.

2 Likes

Updated Version(s):

  • BlinkAPI.groovy = 0.1.6
  • BlinkChild.groovy = 0.1.3

Change(s):

  • Update to ClientID generation to try to make sure it is always generating the correct number of digits.
  • Update to "Reauthorization" method, tough to test, but it should be better.
  • Now tracks which systems are armed and which cameras have motion detection enabled. This should be available both as a State Variable and an Event. At this time it tracks it using the ID number.
  • Children labels should now populate with the Name of the child IF the label is null. If you put something there already, it should not overwrite it.
  • Children can now send arm/disarm and enable/disable commands. There is a big caveat here though. Since commands cannot shown/hidden dynamically all four are displayed. But cameras generally do not "know" which system to arm/disarm and the network child (the one needed for arm/disarm) does not "know" which cameras are in that network. So right now I am only allowing arm/disarm to actually happen on a Network child, and enable/disable motion detection to happen on camera (Camera or MiniCamera) children.

Different topic(s):

  • I did confirm that child devices are checked and generated by DNI... so I am not sure why it says it already exists in some cases.
    For those of you having this happen, do you have multiple cameras? Could you send me a PM with a Trace of your the Homescreen data (feel free to hide anything you want in there, but please at least leave the camera sections clear).
  • Does anyone have anything other than sync modules or cameras? Anyone with one of the Siren, Chime, or Doorbell devices? Need to figure out what those devices truly contain for info. Plus I would like to confirm that Owls (MiniCameras) actually seem basically identical to the regular Cameras.
3 Likes

To help test this feature, I decided to remove the parent/kids and start over. The camera children are now named with the same friendly names I have defined in the Blink app. But the sync modules do not match the friendly names from the app (e.g. Indoors and Outdoors), but instead appear to be default names or something:

  • Blink SM
  • My Blink Sync Module

Should I rename them to the friendly names or do you want to see if there is some other field for sync modules that you should be using?

Update: I changed the name of one of the sync modules in the Blink app, wanting to see if that forced the Name of the sync module to change. It did not. However, it did cause the creation of a new child device with Device Label of the test name and Device Name Network-xxxxx (where xxxxx is numeric). Seems like this goes to how a "network-" is different from a sync module.

Camera labels were set correctly! I also enabled motion on a camera which worked too!

The logs did have some strange errors which I'm not sure are really errors but I'll post here anyway.. nonetheless the actions worked which is all that really matters

The PIN log seemed odd here.. I will say that i never did enter a PIN for this driver. I had initially but uninstalled and re-installed and never needed to enter a PIN

dev:3572020-09-26 11:17:06.086 am errorBlink - Select the Request PIN command to request a PIN be emailed to you from Blink.
dev:3572020-09-26 11:17:06.083 am traceBlink - Has ClientID
dev:3572020-09-26 11:17:06.081 am traceBlink - Has Email and Password

several error log entries that don't look like errors to me..

dev:3572020-09-26 11:16:38.446 am errorBlink - Video Event Data [thumbnail:/api/v2/accounts/36734/media/thumb/1000198321, device_id:89002, network_name:home, created_at:2020-09-15T00:07:43+00:00, source:pir, media:/api/v2/accounts/36734/media/clip/1000198321.mp4, type:video, time_zone:America/New_York, device_name:garage, network_id:<SNIP>, watched:false, deleted:false, updated_at:2020-09-15T00:07:43+00:00, id:1000198321, additional_devices:[], device:camera, partial:false]
dev:3572020-09-26 11:16:38.446 am traceBlink - Child Event: Name = garage
dev:3572020-09-26 11:16:38.444 am errorBlink - Video Event Data [thumbnail:/api/v2/accounts/36734/media/thumb/1000201034, device_id:89002, network_name:home, created_at:2020-09-15T00:09:01+00:00, source:pir, media:/api/v2/accounts/36734/media/clip/1000201034.mp4, type:video, time_zone:America/New_York, device_name:garage, network_id:<SNIP>, watched:false, deleted:false, updated_at:2020-09-15T00:09:01+00:00, id:1000201034, additional_devices:[], device:camera, partial:false]
dev:3572020-09-26 11:16:38.441 am errorBlink - Video Event Data [thumbnail:/api/v2/accounts/36734/media/thumb/1002419340, device_id:88951, network_name:home, created_at:2020-09-15T21:33:32+00:00, source:pir, media:/api/v2/accounts/36734/media/clip/1002419340.mp4, type:video, time_zone:America/New_York, device_name:front door, network_id:<SNIP>, watched:false, deleted:false, updated_at:2020-09-15T21:33:32+00:00, id:1002419340, additional_devices:[], device:camera, partial:false]
dev:3572020-09-26 11:16:38.439 am errorBlink - Video Event Data [thumbnail:/api/v2/accounts/36734/media/thumb/1003097492, device_id:88951, network_name:home, created_at:2020-09-16T03:05:20+00:00, source:pir, media:/api/v2/accounts/36734/media/clip/1003097492.mp4, type:video, time_zone:America/New_York, device_name:front door, network_id:<SNIP>, watched:false, deleted:false, updated_at:2020-09-16T03:05:20+00:00, id:1003097492, additional_devices:[], device:camera, partial:false]
dev:3572020-09-26 11:16:38.436 am errorBlink - Video Event Data [thumbnail:/api/v2/accounts/36734/media/thumb/1003098107, device_id:88951, network_name:home, created_at:2020-09-16T03:06:08+00:00, source:pir, media:/api/v2/accounts/36734/media/clip/1003098107.mp4, type:video, time_zone:America/New_York, device_name:front door, network_id:<SNIP>, watched:false, deleted:false, updated_at:2020-09-16T03:06:08+00:00, id:1003098107, additional_devices:[], device:camera, partial:false]
dev:3572020-09-26 11:16:38.421 am traceBlink - Child State: Video Description = server

this one also seems like a non-error level log.. guessing this is expected for every command?

dev:3572020-09-26 11:24:23.836 am errorBlink - Request accepted but not completed. Please try again.

@HAL9000:
Can you shoot me a Trace log of the Homescreen response? It seems to contain a wide range of data and maybe I can figure out where those names are coming from and what name field should override them (maybe Blink has something like the name/label method?). I just ran a Homescreen myself and it appears my Sync Module also got "My Blink Sync Module"... so that is where that is coming from. I do not know if my module has a different name though (I only have the 1) so more I can check on my end as well.

@jpage4500:
I still have no idea how yours is working to be honest... Since the ClientID would have been generated new. So apparently Blink is doing something more for determining where logins come from and how they are authenticated. The fact you did originally is good, and that it is no asking anymore. One thing to check, your "Verified" state variable = true, correct?

As for the logging... yes, that was an error on my part. Those are NOT error entries, but should have been Debug entries. I put the wrong value for my logging in the Video Event area. So no worries there. Thanks for the log portion also, I can try to make some additions tonight.

2 Likes

@snell I've created a virtual switch that controls the arm/disarm of Blink. Works as expected.

I've setup a RM rule to detect my presence and when away to flick the switch to on (arm). On my return, flick the switch to off (disarm).

Had to pop to the local shop to get some more refreshments (:beers:) and it worked perfectly - arming and disarming as expected.

I do notice however this in the log file (unfortunately only have it at info) for when the system was armed and disarmed.

2020-09-26 17:30:11.228 errorjava.lang.ArrayIndexOutOfBoundsException: 1 on line 758 (GeneralResponse)

Not sure if you can see anything obvious that may cause that... Likely would need to provide more detailed logs another time.

Thanks for building and integrating this - have done away with the Blink scheduler now and will look to arm/disarm based on modes (day, night, etc) as well as based on my presence!

update
Now with trace log:

dev:8652020-09-26 18:22:45.219 error java.lang.ArrayIndexOutOfBoundsException: 1 on line 758 (GeneralResponse)

dev:8652020-09-26 18:22:45.202 trace Blink - General response data Disarm System, 2????

dev:8652020-09-26 18:22:45.199 trace Blink - General response = {"id”:12345678,”network_id”:2????,”command":"disarm","state":"new","commands":[{"id":12345680,”network_id”:2????,”command":"config_lfr","state":"running"},{"id":12345679,”network_id”:2????,”command":"config_lfr","state":"running"},{"id":12345682,”network_id”:2????,”command":"config_lfr","state":"running"},{"id":12345683,”network_id”:2????,”command":"config_lfr","state":"running"},{"id":12345684,”network_id”:2????,”command":"config_lfr","state":"running"}]}

dev:8652020-09-26 18:22:44.927 trace Blink - Disarm System Params = [uri:https://rest-prde.immedia-semi.com/api/v1/accounts/1????/networks/2????/state/disarm, headers:[token-auth:Vxblahblahblahblahh_g]]

correct

Thx David, great progress and development wrt Blink-HE integration. I started yesterday the process of transitioning from ST to HE; cutting out IFTT is a bonus. Your drivers already work beautifully, the only thing I can't get to work are the tiles on the dashboard; they don't seem to update. I'm a newbie on HE, what am I doing wrong? Thanks!

I haven't gotten this far yet (adding an arm/disarm tile and camera tiles) but I think right now everything is setup to poll every X minutes (disabled by default) - so the current armed state won't show in realtime. Also, if I'm understanding the logic correctly (today), if you send a command to Blink (ie: arm) - the server replies with some 'pending' response -- so even that won't update the state until the next time the driver checks.

Can you take a screenshot so I know what tiles you are using and what you are trying to do with them? Selecting a custom attribute, showing temperature?