[PROJECT] Driver for Blink API

Thanks, the indoor on is a mini! and the outside on is an outside cam, with the sync

So maybe you put the mini on a smart plug, and you turn the camera power on when you are away.

(Mostly said in jest)

The indoor being a mini does make it more difficult, however it should still be able to be set how you want. Mini cameras do not need a Sync module but they still get their own Network in the API and you can use the Actuator capability in Rule Machine (for example) to trigger the System Arm and System Disarm commands of the Mini. At the same time you could use a System Arm/System Disarm on the outdoor camera. Since you do not have multiple cameras on the same Sync module (and the API gives each Sync or Mini it's own network, which is where the Arm/Disarm actually occur) you do not need to worry about arming or disarming extraneous cameras.

1 Like

I’m pretty new to this, I have my blink all connected to hubitat
How are guys creating virtual switches to use for arm and disarm for both the dashboard and automations.
Thanks

Do a search in this topic for virtual switch… or take a look at [PROJECT] Driver for Blink API - #139 by nutcracker for some assistance (combination of a virtual switch and rules).

2 Likes

Can the blink cameras be use as motion detection to trigger automations?

Through this driver/app it’sa little slow, but you can use Alexa to set a virtual motion sensor to get a nearer real time event.

1 Like

I’m pretty new at the hubitat and figuring out the virtual stuff. So I create a virtual motion sensor, which blink installed the 5 cameras I have as virtual devices, so do I create a virtual motion sensor using which camera I want as the “type” drop down menu when adding a virtual device. I believe I’m saying it right.

Look for one that says Motion with Switch and share it to Alexa; Alexa will see it as a switch and allow you to turn it on when the camera sees motion. HE will see it as both which allows you to use it with HSM or other automations.

1 Like

When creating a virtual device I don’t see a type for switch with motion
I just see virtual switch and virtual motion as the type for virtual devices.

Had this code for a while courtesy of @cwwilson08. Go to the Drivers Code section, and create a new driver using the code below:

Virtual Motion w/ Switch
metadata {
	definition (name: "Virtual motion with Switch", namespace: "cw", author: "cwwilson08") {
		capability "Sensor"
		capability "Motion Sensor"
        capability "Switch"
	}
    
}

def on() {
    sendEvent(name: "motion", value: "active")
    sendEvent(name: "switch", value: "on")
    runIn(12, off)
}

def off() {
    sendEvent(name: "motion", value: "inactive")
    sendEvent(name: "switch", value: "off")
}



def installed() {
    off()
}
1 Like

Awesome thanks

Ok so I got around to messing with this more, I start to confuse myself when trying to use virtual devices.
So create “switch with motion” device and name it backyard motion switch.
Then share to Alexa, so when my blink backyard camera detects motion, it will tell Alexa to turn on that virtual switch, which will trigger a automation in hubitat when that virtual switch is turned on to turn on backyard light?
Do I need to have Alexa turn that virtual switch back off?

You can, but IIRC the switch will turn itself off after about 12 seconds.

1 Like

I have been trying to uncomment the code to download the thumbnail just so I can upload it to my own server for hosting, but I am having a bear of a time getting it to work. Uncommenting alone and changing the POST URl to my own, does not result in success. I am currently fighting with the same "700" error another poster provided.

It is interesting timing... I had some new ideas after some success with my Unifi Protect driver so I was trying to get the thumbnail to appear on the device page at least. Just started working on it Monday.

Unfortunately it appears as if Blink has altered the way the API works for them and the "old" method I had that used to work in a fashion (for getting the data at least, but it could not be readily displayed which is why that command is commented out) does not anymore.

I am continuing to "mess" with it. If I find anything I will let you know. I have been checking over the blinkpy project from fronzbot (https://github.com/fronzbot/blinkpy). We have discussed some pieces over time and sometimes looking at alternatives helps.

I was also looking at BlinkPy. I am thinking about running a tiny BlinkPy daemon on my NAS that just downloads all the thumbnails and videos and serves them up to Hubitat via HTML blocks.

1 Like

That is a pretty reasonable workaround. I have been hoping that Hubitat would allow for writing image files to the File Manager from a driver... but that feature has not happened (and I have no idea if/when it would). Until there is a way to get it in the driver then it is one of those things where people are stuck with workarounds.

I know a lot of people use multiple methods for many tasks (like running things on a NAS, or a RasPi, etc...) but I have been trying to keep my drivers to what the Hubitat can handle/provide/process.

Updated Version(s):

  • BlinkAPI.groovy = 0.5.4
  • BlinkChild-Camera.groovy = 0.1.2

Change(s):

  • Some alterations in the BlinkAPI parent driver to receive the thumbnail data from the API again as they changed the method needed to call for the data. This command is commented out at this time though as it does not actually produce usable output. It receives a data stream but so far I have been unable to determine the formatting of it in order to even save it to the driver data (and the data itself is a bit much to save as a text string). I am continuing to try to figure it out though. Although this basically puts me back to where I was before as the methods I figured out for the Unifi Network devices did not work here.
  • Correction to the GetCameraLiveView command. There was an error where I had it calling a non-existent code to process the received data. It now is processed correctly and the RTSP "URL" is provided again. However those cannot be displayed within current browsers, so again it is questionable use but may be useful for those people with a separate application for watching RTSP streams.
  • Additional data points have been added as the API is returning some new data (none of it seemed of real significance though). An example is that now it returned the device color...
  • The Camera child driver now has the ImageCapture capability. This adds the "take" command which is currently working exactly the same as the GetNewThumbnail (which triggers the API to have the camera capture a new thumbnail that would be shown in the app). The GOAL is to be able to have it trigger that new thumbnail then poll the API for the actual image data and display it in the driver... but as mentioned above getting it in a usable format has eluded me so far.

Note(s):

  • I am still working at getting the thumbnail in. It is something I have never given up on, just have had no success. I really thought I was onto something when I got my Unifi Network drivers to provide an image based on the device's snapshot (even though it is not as useful as I want because it cannot be put in the dashboard). Since that failed in this case (the data appears to be encoded and I have not figured it out) I just have to keep trying.

If the RTSP URL is available to be hyper-linked from a thumbnail, that is really all that is needed. When people click it it will open in their desktop or mobile application that handles that protocol - like VLC.