[PROJECT] Driver for Blink API

How to get Battery reading for Doorbell camera to dashboard?
It is not in Current States but in State variables. Those later ones are not visible to dashboard. Is there any way to get battery reading to dashboard?

1 Like

I will have to check but there is a chance I forgot to make it an attribute on the doorbell child driver. I will try to check about it this evening.

Updated Version(s):

  • BlinkChild-Doorbell.groovy = 0.1.2

Change(s):

  • Battery capability added for Blink Doorbells. This was not there before because I mostly based it on the Minis and thought a wired doorbell would not need it... but @petteri.joutseno's post made me notice that there are battery versions (or they all have one to begin with). Either way, the capability is now added. As a general note though, the Blink API does not report battery value in a nice, straightforward % value (like the Battery capability uses). Instead there are two possibilities, one where the battery is good/bad (which I set to 75% and 0%) OR a battery voltage value, which I try to calculate a reasonable % from.

Note(s):

  • This did not require any changes to the API driver itself. Battery values were already being sent as Events... they just would not remain if the battery attribute (added by the Capability) does not exist in the child driver.
2 Likes

Updated with Package manager. I don’t see any change. Version still reports 0.1.1 and battery still missing. Driver is updated.

Can you go to the driver code page on your Hubitat and check the version within the driver? Version control on line 37 should show it is 0.1.2 and there is another listing of the driver version code on line 54. The ACTUAL change for the code is on line 63:

capability "Battery"

I double-checked that the manifest for HPM to use is set for 0.1.2 and that the correct version is loaded (and that it has the Battery capability) on my website.

As for the version display on the device's page... that can take 24 hours to update (it gets updated when the "CheckForUpdate" process is run each day). There is no mechanism for a device to know it's driver has been updated so can only change the version when "something" else happens. So I made it check as part of the daily check for updates (since I do not really release THAT many versions).

Driver was correct. Had to clear current values with Device as my driver. Then to Doorbell driver and all good. Strange thing.

@snell,
Thanks for the driver.
Just wondering why the battery level for the doorbell is still showing 75% when the blink app is reporting it as low ?

Summary


So there are two methods of getting battery data that I knew of in the API.

  1. A voltage level that could be relatively converted to battery %.
  2. A good/bad (OK/low) 0/1 value returned. If it reports 75% it is probably coming from this method because I had the good/OK value set battery as 75%. Bad/low sets it to 0%.

The doorbell may report it differently or have switched the values... No idea (since their API is not published). You may be the first person here whose doorbell has gotten low because they are not that old.

Can you send me a message with Trace logging of when the refresh is performed so I can see what the API is reporting? I will not be able to work on it until Sunday (I am traveling and coding from my phone is useless) but I will try to get to it once I am home.

1 Like

The problem is, I do not know. In theory, it is because the API is responding with the 1 (or 0, I forget which way it is) that corresponded with 75%.

But it appears something is different for the doorbell with regards to the API.

1 Like

@snell,
Thanks for your reply.
I have enabled trace logging.

Summary


Same here. Deleted doorbell device and then waited for it to be re-added. Then battery attribute appeared. Perhaps because the driver doesn't update the attribute unless the received value is different from the state variable.

Yes, to save on "unnecessary" writes for events or just state variables my drivers do not write if the value changes. Since most have hundreds of values being received during responses.

So it is working though? Maybe I should start clearing everything when a device's Preferences are saved... Something to think about.

Thank you! It is working - i think (the battery reports at 75 - do you know if this will ever change?) - and I am able to retrieve the value in webcore. Clearing the state variable when prefs are changed would be helpful, i think. Thank you for all of your effort in putting this set of drivers together!

It should change... eventually. When the API finally reports the other value it should switch to 0%. If you mean, will they change the method to make it more accurate, my bet would be no. If a device does not already use the voltage reporting, it probably would not in the future.

When I start a general update I will probably try to remember to set up a clear.

Hi there - after looking through this entire thread, it looks like you stopped working on adding a thumbnail image because you were (at the time) unable to store image files. I was wondering if you tried to add this functionality since uploadhubfile() function was added in 2.3.4.132 (see Release 2.3.4 Available - #15 by gopher.ny) and

I had not even noticed that on the release list...

I will try to look into it again over the week. Thanks for letting me know!

Right on! Fingers crossed!

Thanks for pointing this out! Initial tests have been successful (I can get a usable image) for my Mini (owl) camera. There are problems to iron out (the URL does not work for my older cameras for example) and the image provided is NOT a thumbnail (it is 1280x720)... but I hope in the next few days I can at least start to provide something after so long.

This is going to be valuable for my Unifi Protect driver also... They handled the images differently so I could already get and display snapshots... but now I can save them as well. So thank you very much!

1 Like

Hey - its called a community for a reason, right? :sunglasses: After reviewing this thread, I searched all posts for other drivers that saved images and just luckily stumbled upon some code on github that used the uploadhubfile() function. Reviewed the code for your drivers and didn't see it being used. Then searched all posts for that. Just dumb luck and persistence (which is 90% of successful coding I think).

Anyway, I'm glad to have helped - this driver has been such a great help to me and to many others - so you're the one who truly deserves our thanks.

Updated Version(s):

  • BlinkAPI.groovy = 0.5.13
  • BlinkChild-Camera.groovy = 0.1.4
  • BlinkChild-Doorbell.groovy = 0.1.3
  • BlinkChild-MiniCamera.groovy = 0.1.3
  • BlinkChild-WiredFloodlight.groovy = 0.1.3

Change(s):

  • Added capability to process and store thumbnails. Tested (at present) on Camera (xt, xt2, indoor
    "white", and mini "owl"). Should work on Doorbells and Wired Floodlights also. Images are posted within the device as well as stored in the File Manager. In File Manager they are named with _Image.jpg. These are the full image received by the camera not just a thumbnail. On the device they are displayed in a smaller version "Thumbnail" and a full size version "image" (so it is compatible with the imageCapture capability), although they are all actually the same.
  • The various child drivers needed minor updating to properly call the thumbnail method.
  • Some cleanup in Armed and Armed System(s) data to reduce event calls.
  • Reducing some Info and Debug logging to Trace logging.
1 Like