This could I guess be put under cover, anyway I’m no way a programmer.
Would like to see this in HA as a component. Let me know if anyone wants me to test anything.
The list of supported functions, variables and events can be found in https://github.com/Garadget/firmware
deviceid and token instructions are for people that have a garadget (wiki instructions)
Deviceid 24 digits (lowercase letter or number)
Access token 40 digits (lowercase letter or number)
Garadget supports REST API.
Gather info
First you’ll need to find:
device ID - a string that uniquely identifies each Garadget unit.
authentication token - a secret string your app receives to use instead of the username/password after you successfully log in.
The simplest way is to login into the web interface and use the document inspector to pick at the background requests it sends:
In Google Chrome click anywhere in blank space of the page and select “Inspect” from the context menu
Navigate to the Network Tab2
Filter by text: setState and resource type XHR
Use web interface to open and close the door
See the requests appearing in the list, you can find the details under Headers tab
You can open you garage door that has garadget hooked to it with:
curl https://api.particle.io/v1/devices/XXX-DEVICEID-XXX/setState -d arg="open" -d access_token=YYY-ACCESS-TOKEN-YYY
and change the arg to close to close it.
reponse looks like (i imagine all HA needs is the return value 0)
{
"id": "XXX-Deviceid-XXX",
"last_app": "",
"connected": true,
"return_value": 0
}
You can get the status of the door (open or close):
$ curl https://api.particle.io/v1/devices/XXX-DEVICEID-XXX/doorConfig?access_token=YYY-ACCESS-TOKEN-YYY
the response is in the format below, I guess a status icon could be made of open or close (of course status would =closed if door was closed)
I would think you would only want to pull back to HA “Status=open/close”
{
"cmd": "VarReturn",
"name": "doorStatus",
"result": "status=open|time=3m|sensor=0|signal=-56",
"coreInfo": {
"last_app": "",
"last_heard": "2016-10-11T23:42:57.087Z",
"connected": true,
"last_handshake_at": "2016-10-11T22:05:56.625Z",
"deviceID": "XXX-DEVICEID-XXX",
"product_id": 000
}
}