Smartapp to have my Blink Cameras armed state follow my STHM status

I wrote my first smartapp hosted on an AWS lambda this week called BlinkFollow.

Was tired of waiting on the IFTTT integration to come back (it just did Jan 31) and this seems better since it uses all my existing STHM and rules for presence sensors that already existed. This obviously cannot run locally as Blink is cloud based. Used this as an opportunity to learn - no where near production/public ready.

It wasn’t too bad. Documentation is ok but you have to read very carefully and I would have liked some more detailed examples. I had zero node.js experience which would have helped speed things up. The new architecture seems familiar if you have any experience working with AWS CLI. I had more difficulty with serverless trying to package two functions as they both wanted to be in the root directory.

The design is pretty simple once I found @nayelyz 's post about accessing the security armstate.

  • Lambda for the smartapp running node.js - extended the weather-color-light-smartapp-nodejs example
  • Lambda for the backend service running python to talk to the blinkAPI - I used blinkpy by Kevin Fronczak. packaged that up with serverless and deployed it to a lambda.
    • Having a library for the backend made it much easier
    • I don’t know how to integrate the MFA challenge text message Blink sends on your first post to the API. Seems like a common practice though that requires user input on config in a timely fashion.
    • I just ran the python blink program locally to understand it and built an authentication file from there.

Now I have my blink cameras dis/arming when we come and go and by scenes/rules as the house goes to sleep and wakes up. Neat!

This shouldn’t be to expensive to host the 2 functions on AWS as it only happens a few times a day for my dev environment. I should tag the infrastructure to see what it costs to host both lambdas over time.

How do I enable/disable the SmartApp as a whole - by having that slider button on the app tile when listed with the rest of the smartapps.

3 Likes

Nicely done! I have mine setup with IFTTT, but would love to start seeing this and similar smartapps becoming available to users.

Mine is IFTTT but this looks interesting