Wow nice project! Using hass control improve for now, but will definitely try this project tomorrow!
Another cool feature would be changing brightness of lights, not sure how that would work on a small screen on the watch though.
Wow nice project! Using hass control improve for now, but will definitely try this project tomorrow!
Another cool feature would be changing brightness of lights, not sure how that would work on a small screen on the watch though.
Two tap buttons for increase and decrease brightness, volume, cover etc. I already do this on an HA dashboard.
Thank you for this project. Would be possible to do some manual for dummies? I have a Nabu Casa Cloud, I have created the json file on the HA, but I am getting -400 error on watch. I have put json here
And setting in Conect is:
I had to do something wrong, but I am not sure
Thanks
Tom
Hi Tom,
We’re not using Nabu Casa Cloud for our public access, so I am not familiar with your particular setup and constraints. Its these variations that make doing a “manual for dummies” slightly hard, and why we opted for generic URLs. Our dummies guide is the README.md! That way the responsibility for setting up URLs and APIs is not our responsibility! That said, when you find the solution, please post it on this thread for others to find.
There’s another discussion providing some clues at Use Nabu Casa URL to use HA API? Their API URL is similar, but without the default port for HA (8123), which I assume is HTTP not HTTPS and hence you are not connecting to the HTTPS server which would be on port 443 (no need to specify in the URL). So try https://<>.ui.nabu.casa/api
?
I’m also a nabu casa user. I’m getting error code = 0. Maybe you could share all the error codes?
And it took me a while, but for anyone else. The app isn’t a glance but as an activity sort of
Error codes can be found here:
https://developer.garmin.com/connect-iq/api-docs/Toybox/Communications.html#Error-module
API documentation from the links above.
Error code 0 is the most unhelpful description, “unknown”! Good luck with that one…
And it took me a while, but for anyone else. The app isn’t a glance but as an activity sort of
Correct, the app has no glance view implemented (yet), hence it does not get added to the carosel. But it is an App, and gets listed with the other apps that include activities too.
Great app, works fantastic. Thank you for your work. One question I have.
In the json file, the word “tap” (behind the “type”) is frequently used… In my Garmin it shows up as “Kraan”, which is the dutch translation of the word “tap”. Any idea how to fix this?
Hope to hear from you.
In the json file, the word “tap” (behind the “type”) is frequently used… In my Garmin it shows up as “Kraan”, which is the dutch translation of the word “tap”. Any idea how to fix this?
We’ve implemented an automatic translation override. Please indicate the preferred word for “tap” as in “press and don’t hold”. Perhaps “Tik”
Tap on the window
Tap in the sink
Tik op het raam
Kraan in de gootsteen
I’ve just published a new version (1.4) which will alleviate the problem by allowing you to choose not to have the second row of text which is instead replaced by an icon thanks to a code contribution from a user.
Thanks for the quick reply. I think I will have a go with the 1.4 version. I have said it before, this is a great app.
Unfortunately I cannot get this to work. I simply get a “-400 Response body data is invalid for the request type.” error.
I’ve double checked my API key, json url and api but can’t find anything wrong with it. I am using HA behing a NGIX proxy and 2FA setup but I guess that should not really matter…
As you will see from the link to the error codes above, -400 relates to INVALID_HTTP_BODY_IN_NETWORK_RESPONSE
.
That suggests to me that your webserver is returning something other than JSON in its reply. In this situation the reply is often plain text with an error messages, e.g. about authentication failure, or a problem serving the URL. The former suggests the API key might not be right, e.g extra spaces front and end. The latter can be checked by browsing to the intended URL and checking JSON is displayed.
Due to the limits of the Connect IQ API, I cannot get the plain text before the function call parses the expected JSON in order to display it. Perhaps I could make a second call and request plain text for displaying the error…
Thanks. I’ve double checked the API key and also created a new one. The json is being displayed when I copy and paste the URL in the browser which is why I am at a loss as to why this doesn’t work…
Do you make use of the JSON schema validation?
If your file is served from Home Assistant as in our example in the README.md, then you should have schema validation working already.
Yes. The JSON is served from: https://myurl.com/local/garmin/garmin.json
and the json itself simply contains the following:
{
“$schema”: “https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/main/config.schema.json”,
“title”: “Home”,
“items”: [
{
“entity”: “light.nano_dimmer”,
“name”: “Bathroom”,
“type”: “toggle”,
}
]
}
I think that trailing comma after "type": "toggle",
has a bad effect. I tried adding such a comma to my own JSON and got the -400 failure.
Try this:
{
"$schema": "https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/main/config.schema.json",
"title": "Home",
"items": [
{
"entity": "light.nano_dimmer",
"name": "Bathroom",
"type": "toggle"
}
]
}
Seems like I am getting closer. I removed the comma and now I am still getting the error but when I swipe back on the watch (left to right swipe) I briefly see the switch but it goes immediately back to the original -400 error…
Hmm. Thinking out loud. It sounds like you have got the menu config URL with JSON working. The next error is likely to be a failure to update the present toggle’s status. That means an issue accessing the API to query the switch’s present state.
Do you have the means to use curl
? If so, you should be able to check that when you substitute API_KEY
and URL
below, you get JSON back.
curl -s \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${API_KEY}" \
"${URL}/states/light.nano_dimmer"
The above was used on a Raspberry Pi (Linux), but Windows has curl these days, just different variable substutitions.
I also note that your HA installation did not manage to verify the JSON schema correctly. You might want to install:
to edit the JSON file.
I think you’re right with an issue around API. Now every time I open the app I do get an error in the Home Assistant log:
I have generated yet another API token and this time copied and pasted via remote screen share/ADB to my phone so the key is definitely correct
Got it! It was indeed an issue with the JSON file. I previously edited it in Notepad++ and uploaded it via SFTP and somehow I ended up with some strange characters at the end of the JSON file that weren’t visible in Notepad++ but I could see and delete in StudioCodeServer! Many thanks for your help with this! Glad I got it working!