OpenGarage Forums Comments, Suggestions, Requests Request: SmartThings Integration

This topic contains 38 replies, has 9 voices, and was last updated by  codahq 1 month ago.

Viewing 15 posts - 1 through 15 (of 39 total)
  • Author
    Posts
  • #298

    jasonbade
    Participant

    I purchased the OpenGarage in hopes that I could integrate it with my SmartThings hub. I’ve played around with the SmartThings code all weekend, but with my beginner level scripting expertise, I can’t figure out how to get the SmartThings hub and OpenGarage to communicate effectively. SmartThings has a garage door controller capability, but I can’t figure it out.

    Has anyone written an integration with SmartThings for the OpenGarage that they would like to share? I saw the integration with IFTTT, but I would prefer all of the logic in my SmartThings hub.

    Attachments:
    You must be logged in to view attached files.
    #306

    Ray
    Keymaster

    The OpenGarage API is available here:
    https://openthings.freshdesk.com/solution/folders/5000283224
    everything is implemented through HTTP GET requests, which most services support.

    #443

    l0kisc0t
    Participant

    I’ve just written a device handler for the opengarage device for smarthings, which is working well for me.

    You can try it yourself here: https://github.com/littlegumSmartHome/opengarage.io-handler/tree/master

    Just create a device handle, copy this code in, and publish for your own use. Then add a device using the device handler and fill out the preferences.

    Cheers
    Ian

    #444

    l0kisc0t
    Participant

    screenshot of smartthings with the OpenGarage device added

    Attachments:
    You must be logged in to view attached files.
    #620

    kculhane
    Participant

    I used your code and it worked great! Thanks so much for posting it!

    #624

    l0kisc0t
    Participant

    No problems. Glad its working for you.

    I’ve been meaning to have a review of the code, as its not always refreshing correctly and it doesn’t do that automatically, so if you operate the garage door without using opengarage it doesn’t always report the correct status (or, at least, we’ve had one occasion where the app said the door was closed and it wasn’t).

    cheers
    Ian

    #657

    Ray
    Keymaster

    Thanks Ian for writing the sharing the code!

    #877

    ang3l12
    Participant

    So I just set up my open garage using this code, and for some reason it is always reporting that it is open, even though the API is showing “door”:0

    Could you possibly help me figure out this part of your code:

    def initialize() {
    	log.debug "initialize triggered"
        // initialize state
        state.doorStatus =  1 // 1 means open, 0 means closed
    	api("getstatus", [])

    I think it is pulling the 1 from the distance reading, here:
    {"dist":111,"door":0,"rcnt":X,"fwv":106,"name":"My OpenGarage","mac":"X","cid":X,"rssi":-58}

    instead of the “door”; is that possible that it could be the problem?

    #933

    Alonzo
    Participant

    Any fix to your problem of not reading the status correctly? I am having the same issue

    #935

    codahq
    Participant

    I had issues with this handler as well. I found a couple of problems but namely the methods in the device handler to convert the IP address to hex do not support IPs in the form of 10.*.*.* and other internal IP addresses. Here is a fork of Ian’s work that fixes this issue.

    https://github.com/codahq/opengarage.io-handler/blob/master/OpenGarage.io-handler.groovy

    #937

    Alonzo
    Participant

    Thanks codaHq!

    The code you posted worked for me. Only thing that could make it better is if the sensor could be polled every min or so. Seems that if I use my normal garage door opener smartthings is not refreshing the door status to tell me the state has changed. I have to hit the refresh button within smartthings to read the correct state. Thanks again codahq! It’s definitely closer to working perfectly for me.

    #938

    l0kisc0t
    Participant

    Apologies for the delay in replying and Thanks Codahq for tidying up and correcting my code – I’ve updated the handler to include your work.

    I’ll have a look at refreshing the door status automatically in the future….

    #947

    codahq
    Participant

    I made some more changes today. Instead of (or perhaps alongside) polling the OG for state I put logic in the device handler to refresh state before it blindly performs an open or close. If the door is found to be out of synchronization it updates the status and then decides whether or not the button should be pressed.

    I have implemented a way to poll the OG to synchronize its state as well but I don’t know if it’s best practice so I’m checking around before I push that change.

    I’m also considering implementing switch functionality so that an OG can be shared to Google Home through the SmartThings integration. It would be weird to use because you would be saying something like… “Hey, Google… turn on the garage door”. I tried creating an OOB automation with the OG’s device handler in it but for security reasons any routines with doors in them won’t share through the integration. I haven’t attempted the switch hack yet. There might be other weird restrictions that prevent it.

    https://github.com/codahq/opengarage.io-handler

    #957

    codahq
    Participant

    I added vehicle presence support today. Knock yourselves out.

    #958

    codahq
    Participant

    @Alonzo By the way, the polling I added is for every 5 minutes. I could add 1 minute but SmartThings has rate limits against device handler’s execution time and discourages frequent polling especially when doing it the way that I did it. I’ve been polling the last couple of days at 5 minutes and it feels good enough for me anyway.

    We can actually get away from polling if we want by having the OG send an update to the SmartThings hub but it would require a firmware change and I’m just too lazy to try to get the firmware compiling again. Maybe if you bug Ray or Jeff they’ll add it. It’s already very similar to the IFTTT and Blynk integrations.

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

You must be logged in to reply to this topic.

OpenGarage Forums Comments, Suggestions, Requests Request: SmartThings Integration