Is there a way to get OpenGarage/HTTP properites into the Gateway?

I’m using the OpenGarage device.

I am able to open and close it with the Gateway using the HTTP add-on. There is an HTTP action to open and close the garage door:

http://192.168.1.xyz/cc?dkey=xyz&open=1
http://192.168.1.xyz/cc?dkey=xyz&close=1

For reference, the API documentation can be found here:
https://openthings.freshdesk.com/support/solutions/folders/5000283223

There is also an endpoint to get the status of the door (whether it’s open or closed), and a bunch of other properties. Is there a way with an existing add-on to get the values of these properties into the Gateway to use for rules and such?

Also, I’m wondering if there a better way to incorporate this device into the Gateway?

I just created a new OpenGarage add-on, based on that API document (I don’t actually have one of these devices). Can you give it a try?

Absolutely, I’m willing to test it out! Just let me know what to do!

I was thinking about creating an add-on myself, but I didn’t know where to start, so this will be a good learning experience for me too!

You just need to install the add-on the usual way, then configure it with the device’s IP address and device key.

Oh, I didn’t realize it was already available!

Anyhow, I just tried to add it, but I ran into an error:

2020-06-01 21:44:27.272 INFO   : Fetching add-on https://s3-us-west-2.amazonaws.com/mozilla-gateway-addons/opengarage-adapter-0.1.0.tgz as /tmp/9Cq7zX/opengarage-adapter.tar.gz
2020-06-01 21:44:29.115 INFO   : Expanding add-on /tmp/9Cq7zX/opengarage-adapter.tar.gz
2020-06-01 21:44:32.702 INFO   : Loading add-on: opengarage-adapter
2020-06-01 21:44:33.637 INFO   : opengarage-adapter: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2020-06-01 21:44:34.060 INFO   : opengarage-adapter: Loading add-on opengarage-adapter from /home/pi/.mozilla-iot/addons/opengarage-adapter
2020-06-01 21:44:34.930 ERROR  : opengarage-adapter: { Error: Cannot find module './lib/adapter'
2020-06-01 21:44:34.931 ERROR  : opengarage-adapter:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
2020-06-01 21:44:34.932 ERROR  : opengarage-adapter:     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
2020-06-01 21:44:34.933 ERROR  : opengarage-adapter:     at Module.require (internal/modules/cjs/loader.js:692:17)
2020-06-01 21:44:34.934 ERROR  : opengarage-adapter:     at require (internal/modules/cjs/helpers.js:25:18)
2020-06-01 21:44:34.935 ERROR  : opengarage-adapter:     at Object.<anonymous> (/home/pi/.mozilla-iot/addons/opengarage-adapter/index.js:3:27)
2020-06-01 21:44:34.936 ERROR  : opengarage-adapter:     at Module._compile (internal/modules/cjs/loader.js:778:30)
2020-06-01 21:44:34.937 ERROR  : opengarage-adapter:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2020-06-01 21:44:34.938 ERROR  : opengarage-adapter:     at Module.load (internal/modules/cjs/loader.js:653:32)
2020-06-01 21:44:34.939 ERROR  : opengarage-adapter:     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2020-06-01 21:44:34.939 ERROR  : opengarage-adapter:     at Function.Module._load (internal/modules/cjs/loader.js:585:3) code: 'MODULE_NOT_FOUND' }

Oops, my fault. That should be fixed now, with version 0.1.1.

I got the new version, and I entered the IP address and the device key. Then I tried to add a new Thing, but nothing is showing up. Is there something else I should try?

Are there any errors being logged?

Ah yes, I see another error in the logs:

2020-06-02 18:59:56.863 INFO   : Loading add-on: opengarage-adapter
2020-06-02 18:59:57.804 INFO   : opengarage-adapter: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2020-06-02 18:59:58.216 INFO   : opengarage-adapter: Loading add-on opengarage-adapter from /home/pi/.mozilla-iot/addons/opengarage-adapter
2020-06-02 18:59:58.392 ERROR  : opengarage-adapter: Failed to create device: Error: Invalid API response: undefined
2020-06-02 18:59:58.393 ERROR  : opengarage-adapter:     at OpenGarageDevice.promise.fetch.then.then (/home/pi/.mozilla-iot/addons/opengarage-adapter/lib/device.js:25:15)
2020-06-02 18:59:58.393 ERROR  : opengarage-adapter:     at process._tickCallback (internal/process/next_tick.js:68:7)

I verified the IP address, device key, and that the OpenGarage device is running.

Can you post the output of http://<ip address>/jc please?

{"dist":101,"door":0,"vehicle":1,"rcnt":39,"fwv":111,"name":"My OpenGarage","mac":"C5:D6:23:68:93:34","cid":1148688,"rssi":-55}

Thanks! Hopefully v0.1.2 will work better for you.

It totally works now! I see the new “garage door” device and I can open and close it too! :100: :tada: Thanks for writing this add-on, I really appreciate it! :smiley: :+1:

Great! Glad it works. :grinning: