[PROJECT] Driver for Blink API

Ok, thanks For the clarification, so I was definitely not expecting tha On/Off button to Turn off the motion detection! Is there not a way of avoid the creation of 2 child devices? Especially because they have the same names (that’s why I manually changed the name of one child device) which makes it confusing when selecting the right child when creating rules etc.

Thanks for all your work on this, I am always amazed by the amount of people contributing on here!

Hmm... Coding-wise it is possible to have just one child (or none). It just becomes more difficult to deal with if anyone has more than one device because it turns into a case of which one responds to what. I think the majority of Blink users have more than one, or started with the other cameras. Maybe a BlinkLite... Something that only works for people with a single device, no children, etc...

Mini cameras also do not need a sync and Blink treats them as their own network (thus the naming I assume). Mine should arrive in 2 days. It will be interesting to see how it adds itself into my existing arrangement.

@snell - sorry to bug you but I've noticed for a while that all of my camera's "Armed" state aren't staying in sync on my dashboard.

  • I have the Blink cameras automatically arm at night and disarm in the morning every day (though the Blink app).
  • I have the blink driver set to refresh every 1 hour
  • I manually hit refresh on the parent Blink device and noticed in the log the 'armed' state is 'false'
dev:3642020-11-12 06:07:58.159 pm traceBlink - Child Event: Name = home
dev:3642020-11-12 06:07:58.101 pm traceBlink - Child Event: Armed = false
...
dev:3642020-11-12 06:07:57.933 pm traceBlink - Homescreen response = {"account":{"id":<SNIP>,"email_verified":true,"email_verification_required":true},"networks":[{"id":39640,"created_at":"2019-07-19T16:58:25+00:00","updated_at":"2020-11-12T10:00:50+00:00","name":"home","time_zone":"America/New_York","dst":true,"armed":false,"lv_save":false}],"sync_modules":[{"id":67329,"created_at":"2019-07-19T16:59:38+00:00","updated_at":"2020-11-12T18:00:31+00:00","onboarded":true,"status":"online","name":"My Blink Sync Module","serial":"234878710","fw_version":"2.13.26","type":"sm1","last_hb":"2020-11-12T23:07:53+00:00","wifi_strength":5,"network_id":39640,"enable_temp_alerts":true,"local_storage_enabled":false,"local_storage_compatible":false,"local_storage_status":"unavailable"}],"cameras":[{"id":88951,"created_at":"2019-07-19T17:06:06+00:00","updated_at":"2020-11-12T18:10:53+00:00","name":"front door","serial":"850218051","fw_version":"7.98","type":"xt2","enabled":true,"thumbnail":"/media/u008/account/<SNIP>/network/39640/camera/88951/thumbnail/fw_7.96__Zi7psW4H_2020_09_18__12_44PM","status":"done","battery":"ok","usage_rate":false,"network_id":39640,"issues":[],"signals":{"lfr":5,"wifi":5,"temp":69,"battery":3},"local_storage_enabled":false,"local_storage_compatible":false},{"id":88989,"created_at":"2019-07-19T17:10:08+00:00","updated_at":"2020-11-12T22:55:53+00:00","name":"pool","serial":"850218132","fw_version":"7.98","type":"xt2","enabled":true,"thumbnail":"/media/u008/account/<SNIP>/network/39640/camera/88989/thumbnail/fw_7.75___ZYiwPjx_2019_09_04__14_41PM","status":"done","battery":"ok","usage_rate":false,"network_id":39640,"issues":[],"signals":{"lfr":5,"wifi":5,"temp":69,"battery":3},"local_storage_enabled":false,"local_storage_compatible":false},{"id":89002,"created_at":"2019-07-19T17:11:17+00:00","updated_at":"2020-11-12T18:10:53+00:00","name":"garage","serial":"810217911","fw_version":"7.98","type":"xt2","enabled":true,"thumbnail":"/media/u008/account/<SNIP>/network/39640/camera/89002/thumbnail/fw_7.96__1cYUq__e_2020_09_18__12_42PM","status":"done","battery":"ok","usage_rate":false,"network_id":39640,"issues":[],"signals":{"lfr":3,"wifi":3,"temp":69,"battery":3},"local_storage_enabled":false,"local_storage_compatible":false}],"sirens":[],"chimes":[],"video_stats":{"storage":21,"auto_delete_days":14,"auto_delete_day_options":[3,7,14,30,60]},"doorbell_buttons":[],"owls":[],"app_updates":{"message":"An app update is required","code":105,"update_available":true,"update_required":true},"device_limits":{"camera":10,"chime":5,"doorbell_button":2,"owl":10,"siren":5,"total_devices":20},"whats_new":{"updated_at":20200902,"url":"https://updates.blinkforhome.com/"}}
  • After the refresh, I look at my cameras and they all have:
Arm String : Armed
Armed : true
  • I just have 1 network, 1 sync module and 3 cameras

Is it possible the "armed" status isn't getting propagated to the camera devices?


Not sure if this means anything or not but I noticed it in the homescreen response:

"app_updates":{"message":"An app update is required","code":105,"update_available":true,"update_required":true}

Last note (and not as important) -- now that the cameras have the "switch" capability can you set their "switch" state to on/off? At least for my cameras there is no "switch" variable.. just the on/off commands.

I will have to look over the Armed part. I only made it propagate when the command is given, the refresh should not set them. Armed is not part of the normal camera info, I was "faking" it.

The cameras should show as a switch in things like Rules, they have that capability. On/Off commands are part of that.

perfect - thanks!

as for the switch - yep - it works great! But, I just noticed that on a dashboard that displays the current switch state there's no 'on' or 'off' state to display. So, you can turn it on/off but don't know the current state

Ah. I get it now. You are right, I do not think I put events for it because it was always setting the Armed or Motion events depending on child.

I will add that to my work list, thanks for pointing it out!

UPDATED:
Checked my code in the morning and my current driver I have posted does not do it, but the one I have on my development hub already DOES have these changes. I just have not posted it yet because it also has a lot of changes to enhance support for the MiniCameras and I have not had a chance to test those yet (my Mini should arrive today). So there should be a fairly decent update tomorrow.

3 Likes

@snell

Happy Friday the 13th :wink:

I installed the html driver as noted in the blink driver instructions:

  • Instructions for using @anon81541053's HTML Template method: (GitHub - mircolino/ecowitt: Ecowitt WiFi Gateway driver for Hubitat Elevation)
    1. In "Hubitat -> Devices" select the child/sensor (not the parent) you would like to "templetize"
    1. In "Preferences -> HTML Tile Template" enter your template (example below) and click "Save Preferences"
  • ex:

    Temperature: ${temperature} °F

    1. In a Hubitat dashboard, add a new tile, and select the child/sensor, in the center select "Attribute", and on the right select the "html" attribute
    1. Select the Add Tile button and the tile should appear

I get a tile that looks like this. It that what is expected or what exactly is the functionality of this Dashboard tile supposed to be?

Dashboard Tile

Kind regards,
Marcus

It could be working perfectly. Do you have a temperature event listed in the device's Current States list? My mini (it just arrived today) does not show one. From the basic data it receives from Homescreen it does not get it there. I have not had luck yet getting it to provide "CameraInfo" either. If it does not have a temperature value anywhere, it would be "null" because there is no such value to display.

I am ALSO finding that the Mini does not respond to Enable/Disable Motion directly, but you CAN Arm it directly (something you cannot do with a normal camera). I have a MASSIVE amount of changes I am making to try to support the mini's more properly. I hope to have this driver posted this weekend.

1 Like

Your probably right and it is working. Habe the following entry in the current status setting “ * html :
Temperature: null °F

I was just wondering what the idea and use case was for that dashboard link and was thinking I might me able to pull a still picture out of the blink somehow via html. Now I understand what the idea behind it is.

Glad your seeing your Mini acting the same as mine. I appreciate the time and effort you are putting into this project. Can we send you a coffee donation at least to keep you up while you do your magic?

PLEASE @snell?!?!?!?!?!?

Any more coffee might be a bad idea for me. :slight_smile:

I like the Mini... and I hate the Mini. It seems to work quite well and feels much like an indoor Blink camera that is wired (and does not need a sync module). BUT... the API sometimes treats it differently. It seems really odd WHY it does not work in some cases. Like Enable/Disable motion. It has it. The app does it (separate from Arm/Disarm even). But the API does not work with it and the references from other projects seem to indicate it does not. Nor does it respond to camera info requests... but it OBVIOUSLY has them.

One thing I really do not want to do... but may have to... is create different child device drivers. That way I could account for the Mini not having battery, temperature, and various commands. Just makes more things to maintain though. This is another scenario where I wish there was a way to hide/unhide commands & set attributes/capabilities dynamically...

I think the updated driver is pretty well set but I am holding posting to give me a bit more time to test things. But I am pretty sure there will be an update this weekend unless something catastrophic happens.

2 Likes

Ok, there have been 100 posts exactly since my last. My question is this - I had the sync modules connected already. Now, I have a second set of sync modules called My Blink Sync Module whereas before they were designated as a Network. Should I keep one or the other, or do I need either if I am only enabling and disabling motion per each camera?

Sync modules really do not do much of anything as far as the driver is concerned. You can actually delete any child device, but they will be automatically recreated the next time data shows up for them.

Networks can be used for Arm and Disarming (they are fairly important for the overall process, even Mini Cameras get one). Enabling/Disabling motion is done for the cameras but will not actually do anything overall if the Network that camera belongs to is not armed.

This is something that can be a bit confusing coming from the Blink mobile app to this fine Hubitat app. In the Blink mobile app, the sync module was the focus of arming/disarming while underneath it all it is apparently the "network" that you arm and disarm. I'm still not sure what a Blink network is except perhaps now a recently adopted more inclusive term that means the sync modules or mini cameras.

The Network is a Blink term they have always had in their API apparently. The Network is the group of devices that is armed/disarmed. With the normal cameras this coincides with sync modules so they SEEM like they should be the same.

The mini cameras do not use a sync but do still get a Network. You can combine multiple minis into that one Network.

The easiest way to think of it is that a Network is a group of cameras. Blink requires the Network ID to be with many commands, and all camera ones.

Here is the major update. It seems pretty stable but I may have missed something with all the changes this time around. Hopefully nobody will notice much difference except those people using Minis, although there are some changes for normal Camera users as well. You should update BOTH drivers.

Updated Version(s):

  • BlinkAPI.groovy = 0.2.0
  • BlinkChild.groovy = 0.1.10

Change(s):
General (Both Drivers)

  • Major overhaul of a lot of camera-related sections to add support for Mini Cameras, then further work to comment out some pieces when it was found Mini Cameras do not appear to support those functions.
  • Added GetNewThumbnail command. Allows you to request a new thumbnail be taken from the camera. Still have no way to show it in your Hubitat :angry: but it will be displayed in the app.
  • MiniCameras now support most commands EXCEPT the following:
    1 - Enable/Disable Motion Detection. This is one of the most confounding because the app can do it, but the API only provides errors whenever it is sent to the camera method or any similar ones (like what is used for the mini cameras "owls" elsewhere). Hoping there is some way around this eventually.
    2 - GetCameraInfo/GetCameraSensors/GetCameraStatus all do not work similar to the motion, although it is not clear how much information they could provide for these anyways.

BlinkAPI Specific

  • Password is now hidden in Preferences. I did not actually find anything documenting that there is a password type for preferences... but there is... and it appears to work perfectly fine for turning your password in to ****. Sometimes it works to just type something in wishing I guess.
  • Added a 1 second pause whenever multiple devices are being sent commands. For example, if you have 3 cameras and set Enable Motion for all of them, before it would hit Blink with a near simultaneous set of 3 requests. Now it will wait one second between each of them. Just to be nice AND make it a little easier to tell which request is coming back for which device.
  • Found an odd scenario where Blink would return an HTTP 202 error. It appears this is a "it worked... but is taking time..." type of request. I only saw it for enabling/disabling motion, so I made that area handle it.

BlinkChild Specific

  • Made it so the Network ID is not sent during camera info requests.

Known Issue(s):

  • Only the commands documented above that do not work with the Mini Cameras for some absurd reason(s) of the API.
1 Like

I've just updated my hub firmware to 2.2.4 on both my C7 hubs. I'm trying out the new hub mesh feature but when I select to share my Blink parent device only 1 child device is showing on the secondary hub. On the primary hub I have 16 child devices, 3 sync modules, 3 networks and 10 cameras. The only child I get on the secondary hub is one of the networks. Also the parent device is showing as offline on the secondary hub.
Anyone know how I can get this all working over hub mesh? As these aren't actual real devices as such but just sort of virtual devices that connect via the cloud do I just need to install the drivers directly on the secondary hub rather than using hub mesh for them?
Thanks in advance.

Unfortunately I do not know yet. I am on the betas, but I broke one of my hubs in the midst of it so could not actually try making a mesh. Now that it is in the general release I guess that is something I will have to try out ASAP.

That would be excellent. Let me know if there is any testing I can do to help.
Many, many thanks for all the hard work you are putting into this. Very much appreciated by all I'm sure.

Ok, my initial test worked out well actually (amazingly smoothly considering I had not played with it AT ALL yet). I did notice that one of the children (the Sync Module) took a bit longer than the rest to "mesh" (it reported offline at first, at least I think that was the message as it was gone by the time I checked again). It does mention in the documentation it can take a minute before everything shows up.

All showed up (I have a sync with 3 cameras and a mini on it's own, so in all the parent, 2 networks, 1 sync, 3 cameras, and 1 mini). I tried doing a camera status and that worked (with logging showing all the details on BOTH hubs even) and then Arming the Mini... and they both worked.

So initial indications are good. Is yours still having trouble? I am not even sure what needs to be checked yet for this scenario... but I will leave mine going for a while to see how it seems to work.