OpenGarage Forums Pictures and Creative Use HOWTO: App Integration to Check Garage Door at 10 PM

This topic contains 15 replies, has 5 voices, and was last updated by  Ray 1 year, 11 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #99

    Anonymous

    I have been playing a lot with a few different app integration tools, and mostly the work I’ve done centers around Blynk’s REST API. You can find a great listing of the API over at Apiary.io, http://docs.blynkapi.apiary.io

    I was looking for a few things:

      A “garage door button” on my Android phone (and my Pebble smartwatch)
      A way to display garage door status on demand or at a specified time

    I’ve been using Tasker on my Android phone for a really long time, and if you know how to do any basic programming, it’s really easy to do. I downloaded a Tasker plugin called RESTask to allow programming of a REST API call within Tasker. I’m also using Pushbullet to push notifications to my phone (which will display the notification on my Pebble).

    So I’m going to go over only the item in the subject, checking the garage door at a specified time at night (for this example, we’ll use 10 PM). I am having Pushbullet push a notification to my phone at 10:00 PM that will show the status of the door. That notification, in turn, displays on my Pebble. How you get notified is up to you. You can send an SMS, or an email. You can even bring in another app integrator at this point, IFTTT. You can send an SMS to IFTTT tagged with either #OPEN or #CLOSED and have IFTTT perform some action based on what it gets from your phone, such as lighting a Philips HUE bulb a certain color (i.e. green for closed door, red for open door) or speaking an alert through Amazon Echo. Although to be fair, Tasker has plugins for both HUE and LiFX bulbs which you can install, so the whole bulb thing can be controlled from within Tasker.

    Here is the procedure for using Tasker and RESTask to check the status of your door every night at 10 PM:

    1. Make sure you have Tasker installed, and make sure you have RESTask installed as well. Both Tasker and RESTask are available in the App Store. Tasker does carry a nominal fee, but once you start doing stuff with it, you’ll wonder how you ever lived without it. You can try Tasker free for 7 days by visiting their website: http://tasker.dinglisch.net/download.html. What makes Tasker so abundantly useful is that it is extensible with plugins. RESTask is one such plugin, which allows Tasker to interact with REST API interfaces on the web. RESTask is free.
    2. Start with creating a new Tasker task. Call it whatever you like. I have mine called “Check Garage Door Status”.
    3. Click the + at the bottom to add your first entry, click “Plugins” and click RESTask.
    4. Click the pencil in the upper right to configure RESTask. In the RESTask configuration, you’ll be sending a GET call to http://blynk-cloud.com//pin/V0. The V0 pin is the one labeled “Door” that shows the little light signifying an open or closed door. The response to the call will go into the Tasker variable %rtres. That variable will contain one of two values: [“0”] if the door is closed, or [“255”] if the door is open. The value of the response includes the bracket and the quotes.
    5. You can click the Play button to test your API call. You should get a return code of 200 (which means your API call was successful), and a return result of either [“0”] or [“255”], depending on whether or not your garage door is currently open or closed. When you’re ready, click the floppy disk to save the RESTask configuration and head back into Tasker. Click the “back” button ( the < symbol in the upper left) to leave the Task Edit screen, and head back to programming the next steps in your task.
    6. Press the + again, choose Task, and select If. We’re basically making an If/Then/Else statement. Inside If, click the label icon to choose a label. You’ll want to choose %rtres. Click the condition operator (currently a tilde, ~ ) and choose Equals, and in the space on the right, enter [“0”]. Click back when you’ve completed.
    7. Click + again, and you will be programming your “Then” statement (you will see that it is indented under the “If” statement). Here is where your configuration will differ depending on how you want to be notified. You can choose to have the phone send an SMS or an email. Mine sends a simple Pushbullet notification to my phone which says my door is closed, which in turn appears on my Pebble. Let me know how you’d like to get notified, and I can help you program this statement, but Tasker is pretty extensible and there are lots of tutorials out there on the Interwebs.
    8. Click + again, click Task, and select Else If. This is where you program the other side, if the door is open. Again choose %rtres, choose Equals, and in the space on the right, enter [“255”]. Click back to exit Else If.
    9. Click + to code a statement to notify you of an open door. Again, depending on how you want to be notified, enter those details now. For me, I send a Pushbullet notification that says my door is OPEN.
    10. Click + one more time, choose “Task,” and choose “End If” to close out your If statement.
    11. Click the Play button on your Task to watch it run. Green dots will appear next to every statement which successfully executes. If any statements have errors, red dots will appear next to them. If all goes well, the status of the door will cause your selected alert to be sent.
    12. Now we have to tell Tasker to launch the event at 10 PM. Click on “Profiles” at the top, and click the + to add a new profile. Choose “Time” to make the profile launch at a certain time. The Time Edit dialog is a little funky, but that’s because it has so many options. You only want the task to launch at one time, so set both the From: and the To: times to 10:00 PM. When you’ve chosen a time and click the back arrow, your chosen time will appear on the left, and a list of your Tasks will appear on the right. Choose your “Check Garage Door Status” task, and you will see the new Profile, which shows the time to launch on the left, followed by a green arrow, and your Task to check the status of the door.

    That’s it! Now, Tasker will launch your Task at 10:00 PM, and the status of the door will be reported to your selected reporting method.

    #136

    Ray
    Keymaster

    This is great. Thank you for sharing. I learned about Blynk’s REST API, which I didn’t know before.

    #291

    billstein
    Participant

    Hello all, I wrote the original post over on the old site, so if you have any questions about Android integration projects, or Tasker or RESTask or the Blynk REST API, I can try my best to answer them.

    Regards, Bill

    #491

    Chad
    Participant

    I keep getting a return code of 404, what am I doing wrong?

    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    Attachments:
    You must be logged in to view attached files.
    #496

    billstein
    Participant

    Hi all

    There was a problem with the way the article copied over from rayshobby site to the new OG site, and one of the pieces of the link seems to be missing. The article shows

    http://blynk-cloud.com//pin/V0

    In actuality, it stripped out the stuff between the second set of slashes. The link should, actually, read:

    http://blynk-cloud.com/{your_blynk_auth_token}/pin/V0

    So in practice, the link would look like:

    http://blynk-cloud.com/a123b123c123d123e123f123/pin/V0

    Make sure you insert your own Blynk auth token.

    #497

    billstein
    Participant

    Hi,

    Please see the reply I just posted. I’m sorry about that, but there was a problem copying the article over from the old rayshobby site to the OG site, and a part of the link was cut. Also, since the accounts are different, I’m not the “author” of this article, so I can’t edit that link.

    I apologize about the error, please let me know if you run into more issues.

    -bill

    #498

    Chad
    Participant

    I wondered how it would know who I was without some kind of authorization…

    Thanks

    Now if we could just automate closing the door if it is open…?

    • This reply was modified 1 year, 11 months ago by  Chad.
    #507

    Ray
    Keymaster

    Auto-closing is already supported in current OG firmware. Go to Options -> Automation and you can find where to configure the auto-closing.

    Blynk API uses the authorization token, which is the secret key only you know about. So that’s your ‘authorization’.

    #516

    Chad
    Participant

    Auto-closing is already supported in current OG firmware. Go to Options -> Automation and you can find where to configure the auto-closing.

    I did see that, but, especially during the summer here in MN, my garage doors remain open most of the day. What I wanted was a way to check at a specific time, and automatically close if open. I figured it out with help from @billstein, and a bunch of experimenting with Tasker.

    #551

    Chad
    Participant

    Here is my tasker Setup:

    Overview 1

    Overview 2

    1. RESTask–Under Host enter Blynk-Cloud token:

    http://blynk-cloud.com/{your_blynk_auth_token}/pin/V0

    RESTask

    2.If Closed (i.e. %rtres eq [“0”]),

    3. Send SMS to specified number, just enter number and any message.

    4. Else If OPEN (i.e. %rtres eq [“255”]),

    5. Send SMS warning door is open, and then,

    6. HTTP Post, sends http request to OG to send “click” to close door.

    HTTP Post

    Under SERVER:PORT, enter your OG’s info:

    http://{IPADDRESS:PORT}/cc?dkey={YOUR_OG_KEY_HERE}&click=1

    (In photo above I missed the “&” symbol after your key)
    I did not enter anything in the optional fields.

    7. Waits 20 seconds to give time for door to close.

    8. Does another status check, in case my dog walks under the door when trying to close :-).

    9. If still open,

    10. Sends me a text alerting me the door did not close.

    11. Else if door DID close,

    12. Sends SMS telling me the door did, in fact, close.

    13. END

    Hope that all makes sense?

    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad. Reason: Somehow deleted post
    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    • This reply was modified 1 year, 11 months ago by  Chad.
    Attachments:
    You must be logged in to view attached files.
    #558

    Chad
    Participant

    @ray how can I delete unused attachments?

    • This reply was modified 1 year, 11 months ago by  Chad.
    #569

    billstein
    Participant

    Cool, I very much like your “close, then check” process.

    #573

    Chad
    Participant

    @billstein

    Cool, I very much like your “close, then check” process.

    Thanks, for whatever reason, my dog likes to cross under my door(s) just before they close–EVERY TIME!–setting off the safety, and raising the door(s) open again. So, I that’s my answer. I thought about adding a second check, but where do you stop….?

    #576

    bgnome
    Participant

    The OG firmware has a built-in setting now that will send you a notification that the door is still open after a set amount of time. It also seemed to repeat the notification after some time if the door remained open. I think this would obviate the need to keep checking door status after attempting to close, especially if you set a short time limit.

    #577

    Chad
    Participant

    The OG firmware has a built-in setting now that will send you a notification that the door is still open after a set amount of time. It also seemed to repeat the notification after some time if the door remained open. I think this would obviate the need to keep checking door status after attempting to close, especially if you set a short time limit.

    I don’t want to be notified every 30 minutes or whatever time would be set. During the day, when I’m home, the doors are open most of the day. I just want to know they are closed up at night if I forget to check before I go to bed.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.

OpenGarage Forums Pictures and Creative Use HOWTO: App Integration to Check Garage Door at 10 PM