Home Assistant App for Garmin

Only when your watch is connected to GPS, which is when you are in an activity

Just working with what the Connect IQ SDK gives us ;-).

As per the explanations already given in the documentation. See here please: GarminHomeAssistant/BackgroundService.md at 4d4a86f19554f2119bef2c6fd6f6c9ffe5dfd78e · house-of-abbey/GarminHomeAssistant · GitHub

Thank you.

Great work Phil. I have the app working on my Fenix 5 Plus. I wanted to control my home door locks with it, which I can do by using the automation entity. It does the job but are you considering adding support for lock entities?

We are not considering supporting lots of different bespoke entities like cover, door, gate, lock. Its a watch, so we’re keeping things simple. For entities that do not have service calls to turn_on and turn_off there are tap and template menu items.

Thanks Phil!

Hi, yesterday I´ve installed watchface which can show data from another ap if it is published. I realy don´t understand problematic of it. It is named compication.
Toybox.Complications (garmin.com)
Do you think that it is possible expose data from your ap? for example data from sensor?

@jjusko Sorry, I’m not familiar with the app, and don’t really want to spend my time finding out. But if you do gain insights of how the two application can interact, please do post back here with any example usage.

This would not be easily possible as our current background service does not fetch data, it only sends data.

I know. I mean to display data from your ap on watchface. For example I have data from temperature sensor outside in your ap and want to show it on watchface.
But I realy don´t know if it is possible.This is from watchface manual:


link for manual: SHN TxD II-E - Disk Google

Worth noting that the API you link to:


Module: Toybox.Complications

Overview

The Complications module allows apps to both subscribe to and publish complications. Complications are exposed via an iterator, or can be queried by identifier. Watch faces can register a callback and subscribe to multiple complications. Device apps and audio content providers can publish complication information.

Since:

API Level 4.2.0


Requires an API level higher than the one we specify in our manifest, which is deliberate in order to make the App work as many watches as possible

minApiLevel="3.1.0"

To answer your question here requires significant investigation, and hence significant investment of personal time. I have little idea of what Complications is all about, without investing that time since it is clearly non-trivial and non-obvious. Then we need to consider how we expose user’s data, does that mean additional JSON format options? And then a test burden.

We have stated many times that our App is “packed” meaning we are running out of memory on older devices. Although we have just agreed to separate widget and application versions to free the latter to be further developed. I am also conscious of creating bloatware where we now add many non-core functions for use by one or two, and then have to maintain and support all the additional functionality.

So I’m left asking the question “is it even worth it”? So a few users can put text on another watch face? I expect it would be quicker and simpler to author your own watch face, and then retain control of the code and development.

Apologies, I’m struggling to see the use case here as general enough and desired enough to make me want to find out more and make that time investment.

Sorry.

Now if you would like to fork the code on Github, make the changes you desire to the project and submit a pull request we will review it. Good luck!

Hi Philip, congrats on a great documentation and app overall, can’t wait to be able to use it!

I’m plundered through the documentation, troubleshooting guide, and this community for some answers but I’m having trouble to even get the app up and running. I have two separate errors so far, which I think may be related.

Current config: I’m running Home Assistant Green and connecting via Nabu Casa. I have a Garmin Descent MK II watch and I’ve installed the GarminHomeAssistantApp via Connect IQ.

I have a long-lived access token for GarminHomeAssistant app, and I’ve created a single json file called “garmin.json” in my root Home Assistant folder.

I’ve only copy/pasted your template in the json file so far, no other changes.

Here’s the links I’m using for the setup:

  • Server: https://id.ui.nabu.casa/api
  • File: https://id.ui.nabu.casa/garmin.json
  • Added the below to my configuration.yaml:

http:
cors_allowed_origins:
- https://house-of-abbey.github.io

The two erros I get:

  1. GarminHomeAssistant web:
    • API checks out as working
    • File check error: Check CORS settings on HomeAssistant server
  2. GarminHomeAssistant app:
    • Error on start: No JSON returned from HTTP request

Note that I’ve restated Home Assistant, refreshed GarminHomeAssistant web, and Connect IQ multiple times.

How could I get this wrong?
Thanks for your help

Hi @purierca,

Firstly well done on reading the docs through, thank you for doing that. I’m thinking the problem is the same in both cases. Your garmin.json menu definition file is not being returned by a plain HTTP GET request.

I’m wondering if there is a chance that the file location you have chosen is outside the scope of the files the HA web server is allowed to serve? In our Nabu Casa example we used: /config/www/garmin/menu.json which mapped to a URL of https://<id>.ui.nabu.casa/local/garmin/menu.json.

In your case https://id.ui.nabu.casa/garmin.json would need to map to a file location of /config/www/garmin.json. That means you cannot use the root Home Assistant folder, you must use the correctly named subdirectory /config/www/ or deeper.

Can you type https://id.ui.nabu.casa/garmin.json in a web browser’s address bar and get the content you recognise servered?

Thanks for the speedy reply Philip; I agree this is probably the mistake I’m making.
I’ve updated based on your feedback but get the same errors. I’m quite unclear as to the relationship between the actual location of the file vs. what it maps to:

  • I’ve moved and renamed the file to homeassistant/www/community/Garmin/menu.json
  • I’ve plugged in the link https://<id>.ui.nabu.casa/config/www/garmin/menu.json as well as tried https://<id>.ui.nabu.casa/local/garmin/menu.json in both Connect IQ settings and on HomeAssistant web
  • In both cases, the same error messages as before…

I do notice that in File editor I get the path homeassistant/www/community/Garmin/menu.json vs in VS Code I get a slightly different one:
image

I’m probably missing something quite simple, but I can’t put my finger on it

Anything in /config/www/**/* is served statically by homeassistant at http://homeassistant.local:8123/local/**/*.
/config/www/community is just where HACS puts it’s JS and CSS.

Try /config/www/garmin.json with http://homeassistant.local:8123/local/garmin.json.

…JosephAbbey

1 Like

Hi Joseph, congrats as well by the way on the plugin!
Thanks for the rookie explanation.
I’ve tried your solution and I get a different error (“No connection”) which I assume is due to the http vs https (I’m going through Nabu for my SSL).
When I go back to SSL through Nabu’s links, I get the same errors as before.
It might be a small thing, but I’ve only copy/pasted the entire json from the example you have shared, it might need some update?

Here’s the current setup/links:

  • File in /config/www/community/garmin.json
  • Link in GarminAssistant app & web https://<id>.ui.nabu.casa/local/garmin.json

Web still returns “Check CORS”.
Another check, the Nabu casa link has “ui.nabu.casa”, I’m assuming it’s fine but maybe the “ui” part is wrong, since we’re not going through the UI?

Thanks again for your time and patience

A bit more details on this:

  • With link https://<id>.ui.nabu.casa/www/community/garmin.json I get “Check CORS”
  • With link https://<id>.ui.nabu.casa/local/garmin.json I get a 404

And I’ve tried many versions of these (local/config etc., config/www etc.) and I get “404” in all cases with ‘local’, and “CORS” in all cases with anything else

As previously mentioned:

We’re suggesting you don’t put your file in /config/www/community. but move it outside of that directory, but still under /config/www/. Your URL was wrong for that subdirectory anyway! (The community bit was missing for your URL.)

@JosephAbbey previously suggested:

Try /config/www/garmin.json, that should map to either http://homeassistant.local:8123/local/garmin.json or in your case https://<id>.ui.nabu.casa/local/garmin.json.

Please note how those path names map. URL stem https://<id>.ui.nabu.casa/local/ maps to file pathname stem /config/www/. After each of those stems you can add subdirectories, E.g.

  1. https://<id>.ui.nabu.casa/local/abc.json maps to file pathname /config/www/abc.json
  2. https://<id>.ui.nabu.casa/local/community/garmin.json maps to file pathname /config/www/community/garmin.json - We suggest you don’t use that. But this example shows how so far you’ve not used the correct URL for the placement of your menu file.
  3. https://<id>.ui.nabu.casa/local/garmin/menu.json maps to file pathname /config/www/garmin/menu.json - That’s what I use.

Presently you seem to be mixing up the paths after the initial stem. Let’s get that right then we’ll move on to the next issues which might evapourate.

If you have done as we suggest you should be able to type the final choice of URL into the address bar of your browser and get the JSON file served. Did you try that as previously suggested? I really do mean use Edge/Chrome/Firefox/Other first before amending the settings for the app. This is covered in the trouble shooting guide.

Thank you for this super clear and detailed explanation, it’s now working and here’s the main reason I got it wrong, just FYI:

  • I didn’t understand the https vs homeassistant.local link mapping
  • I was misled by the Studio Code folder view, where the www/community was rendered as a single folder rather than a sub-folder, because www didn’t have any files in it

It’s all working splendidly now, with the final setup as such (if it can help anyone in the future):

  • file in /config/www/garmin.json
  • ilnk for https connection through Nabu Casa https://<id>.ui.nabu.casa/api
  • link to file through https with Nabu Casa https://<id>.ui.nabu.casa/local/garmin.json

Again thanks for your support. Would download again.

1 Like

Hi there, just found your app today and it looks great. Having read through the whole thread I can’t seem to find a similar example of my problem.
Basically in glances view I have
API: Unavailable
Menu: Available
I’m using Nabu Casa and have entered the long lived access token.
Apreciate any help.