Garmin MyHomeControl & myopenhab.org

Hi,

I’d like to use the Garmin MyHomeControl app to call OH REST APIs via myopenhab.org. Has anyone done this before? My requests work fine via Postman, but I cannot figure out how to set it up in MyHomeControl.

According to the MyHomeControl documentation, the URL can be defined like this:

Type/copy/paste the URL to trigger a device action (without http:// or https://, don’t use them because you’ll get an error :slight_smile: ) (e.g. 192.168.2.1/sw/23_and_command=on). You can add (optional) a json body as parameter of the url as well. (e.g. 192.168.2.1/sw/23_and_command=on?jspost={value1:morning,value2:11.00}). You can use jspost, jsget, jsdel and jsput as methods. Type “and” or “perc” or “space” or “po” or “pc” instead or “&” or “%” or " " or “{” or “}” in the url to prevent saving problems in Garmin Connect. The “xxx” symbols will be translated before executing the command.

But for openHAB I need a raw text body with the command, not sure how to achieve that with the name value pairs shown in the documentation above. Also I am not sure how to get the basic authentication to work with this syntax.

Has anyone here used MyHomeControl to call openHAB REST APIs? Or has an idea how this jspost method works beyond the simple example in the cited documentation?

All I know about accessing myopenhab over REST is this. I don’t think it’s what you’re asking, but posting in case it helps.

Thanks! The REST API call to myopenhab.org works fine from Postman, but I do not know how to build the same request from the Garmin app MyHomeControl.

The app documentation refers to a jspost method bit has no concrete examples and I could not find any further documentation on it.

I have been now looking at another Garmin app called APICall. Same idea, but better documentation. Unfortunately it states that Garmin generally only supports body content “application/json” or “application/x-www-form-urlencoded”, while openHAB expects the command in a “text/plain” body.

Is there a way to send the command as either “application/json” or “application/x-www-form-urlencoded” to openHAB?

I’ve no idea, but would guess that the answer is no.

EDIT: Just saw your post in another topic where Rich confirmed this. Hope you can find a solution!

1 Like

Yes, with the HTTP Webhook binding I could get Garmin to work with openHAB.

1 Like

Robert are you an iOS user? For Android users Garmin app has problems with using http:// addresses - it only allows the https:// version.
Did you organize a certificate for your Openhab somehow?

For Android you can register at myopenhab.org, the webhooks will then be available via your URL there, with https.

I’ve tried to but got only timeout reaction on garmin.
Should I encode to base64 my email and password to myopenhab OR uuid and secret strings?

Email and password via basic authentication should do the trick.

Which app do you use on the Garmin side?

I tried APICall and MyHomeControl. The latter looks better, but the former is better documented and supported. I was able to get the myopenhab.org link working with APICall, but not with MyHomeControl, it was not clear there how to setup basic authentication.

Here the link to the APICall documentation: https://apicall.dumesnil.net/

Robert,
Set this up on my edge 840 using apicall, worked great.
Just wanted to give you a shout-out for documenting this so well on your blog, well done and thank you.

1 Like