[PROJECT] Driver for Blink API

I updated - added a new device and removed it (just to make sure any children got removed). Re-added and tried to get a PIN but it never arrived.

Any thoughts?

dev:3572020-09-23 08:51:12.961 pm traceBlink - Login response = {"account":{"id":<SNIP>,"verification_required":false,"new_account":false},"client":{"id":<SNIP>,"verification_required":false},"authtoken":{"authtoken":"<SNIP>","message":"auth"},"region":{"tier":"u008","description":"United States","code":"us"},"lockout_time_remaining":0,"force_password_reset":false,"allow_pin_resend_seconds":60}
dev:3572020-09-23 08:51:12.410 pm infoBlink - Requesting PIN for validation or reauthorizing auth-token.

I hadn't tried to get the PIN since this afternoon and I've only requested it maybe 5 times today total.. the Blink app works fine too

Is this an expected response? It's almost like it's saying it doesn't need me to enter a PIN..

last note for tonight.. it actually seems like I don't need to enter a PIN at all! I did a homescreen command and watched the logs and it looks like everything was fetched and created just fine.

I also was able to arm and disarm the system.. thanks for adding that note in the logs "Blink - Request accepted but not completed. Please try again."


Next up - individually enabling/disabling motion detection on a given camera. I entered the camera ID but that command failed (404). Where do I enter the network ID which is being sent as '/null/'?
image

dev:3572020-09-23 09:09:06.416 pm errorBlink - 404 from Blink
dev:3572020-09-23 09:09:06.105 pm traceBlink - Enable Motion Params = [uri:https://rest-u008.immedia-semi.com/network/null/camera/88951/enable, headers:[token-auth:SNIP]

You cannot manually enter the Network ID in such a case, it should be listed as a state variable within the camera. I did notice I had both Network ID AND NetworkID states... but they had the same value. In any case I am posting version 0.1.5 which should standardize on Network ID and hopefully solve that problem.

As for the Verification Required... maybe it is saying it does not need the PIN validation because your account has done it before. The problem with this is that since there is no API documentation from Blink there is really no way of knowing and they could change things at a whim.

In any case:
BlinkAPI.groovy version 0.1.5 is now posted. Only change is to standardize the Network ID state.

2 Likes

that worked!

1 Like

I'm trying to think through how I can use the Blink cameras on my dashboard. My app uses the MakerAPI to get all devices/attributes/commands.

I see 3 cameras (type=BlinkChild) and 1 type=BlinkAPI device. Only the BlinkAPI device has the commands such as arm/disarm/enable motion/etc. The camera devices have a bunch of attributes but none of these commands.

Ideally, each camera would have some commands which can be applied just to the camera - like enable/disable motion detection, get thumbnail, video, etc (future stuff I know..).

Anyway, it seems like I'm going to need to display a dashboard tile for the overall Blink system and 1 for each camera. It'd be really nice if I could use that Thumbnail File image for the dashboard tile. That would make it clear which camera is which

  {
    "name": "Blink",
    "label": "Blink",
    "type": "BlinkAPI",
    "id": "357",
    "date": "2020-09-25T00:51:00+0000",
    "model": null,
    "manufacturer": null,
    "capabilities": [
      "Refresh",
      "Sensor",
      "Actuator"
    ],
    "attributes": {
      "ClientID": null,
      "dataType": "STRING",
      "values": null,
      "Driver": null,
      "Updated": "2020-09-24T00:42:59+00:00",
      "Version": "Patch development 0.1.5 version"
    },
    "commands": [
      {
        "command": "ArmSystem"
      },
      {
        "command": "DisableMotionDetection"
      },
      {
        "command": "DisarmSystem"
      },
      {
        "command": "EnableMotionDetection"
      },
      {
        "command": "GetCameraInfo"
      },
      {
        "command": "GetCameraUsage"
      },
      {
        "command": "GetHomescreen"
      },
      {
        "command": "GetNetworks"
      },
      {
        "command": "GetNotifications"
      },
      {
        "command": "GetVideoEvents"
      },
      {
        "command": "RequestPIN"
      },
      {
        "command": "VerifyPIN"
      },
      {
        "command": "refresh"
      }
    ]
  },
    {
    "name": "Camera-88951",
    "label": "Camera-88951",
    "type": "BlinkChild",
    "id": "359",
    "date": "2020-09-24T13:23:57+0000",
    "model": null,
    "manufacturer": null,
    "capabilities": [
      "TemperatureMeasurement",
      "Battery",
      "Sensor"
    ],
    "attributes": {
      "Account": null,
      "dataType": "NUMBER",
      "values": null,
      "Account ID": null,
      "Alert Interval": null,
      "Alert Repeat": null,
      "Alert Tone Enable": null,
      "Arm String": null,
      "Armed": null,
      "Auto Arm By Geo": null,
      "Auto Arm By Time": null,
      "Battery Alert Account": null,
      "Battery Alert Count": null,
      "Battery Check Time": null,
      "Battery Number": "3",
      "Battery Status": "ok",
      "Battery Voltage": null,
      "Busy": null,
      "Camera Error": null,
      "Clip Bitrate": null,
      "Clip Seconds": null,
      "Clip Warning Threshold": null,
      "Created": null,
      "Daylight Savings Time": null,
      "Enabled": null,
      "Encryption Key": null,
      "Feature Plan ID": null,
      "Firmware Version": null,
      "ID": null,
      "Illuminator Duration": null,
      "Illuminator Intensity": null,
      "Issues": "[]",
      "LFR Alert Count": null,
      "LFR Channel": null,
      "LFR Strength": "5",
      "Last HB": null,
      "Last Snapshot Event": null,
      "LiveView Mode": null,
      "LiveView Seconds": null,
      "Liveview Bitrate": null,
      "Local Storage Compatible": null,
      "Local Storage Enabled": null,
      "Local Storage Status": null,
      "Manufacturer Mez Type": null,
      "Max Resolution": null,
      "Motion Detection Enabled": "false",
      "Motion Sensitivity": null,
      "Name": "front door",
      "Network ID": "39640",
      "Network Key": null,
      "Network Origin": null,
      "NetworkID": null,
      "Onboarded": null,
      "Ping Interval": null,
      "Privacy Zones Compatible": null,
      "Record Audio Enable": null,
      "SM Backup Enabled": null,
      "Serial": null,
      "Snapshot Enabled": null,
      "Status": "done",
      "Storage Total": null,
      "Storage Used": null,
      "Sync Module Error": null,
      "Temp Adjust": null,
      "Temp Alerts Enabled": null,
      "Temperature Alert Count": null,
      "Thumbnail": null,
      "Thumbnail File": "fw_7.96__Zi7psW4H_2020_09_18__12_44PM.jpg",
      "Thumbnail Image": null,
      "Time Zone": null,
      "Type": "xt2",
      "Updated": "2020-09-23T22:57:59+00:00",
      "Usage": null,
      "Usage Rate": "false",
      "Video Description": null,
      "Video History Count": null,
      "Video Length": null,
      "Video Quality": null,
      "Video Recording Optional": null,
      "WiFi Strength": "5",
      "WiFi Timeout": null,
      "battery": null,
      "temperature": "75"
    },
    "commands": [
      {
        "command": "Clear"
      }
    ]
  },
1 Like

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.