Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"unable to connect, check uri and config" when using https #37

Closed
bverkron opened this issue Mar 6, 2022 · 5 comments
Closed

"unable to connect, check uri and config" when using https #37

bverkron opened this issue Mar 6, 2022 · 5 comments

Comments

@bverkron
Copy link

bverkron commented Mar 6, 2022

Attempting to setup the Agent for the first time and I get unable to connect, check uri and config.
image

I have verified the url and long-lived token via this test. Both were copied from their original source and pasted into the HASS.Agent installer so unlikely to be a entry error.

$ curl --insecure -I -X GET https://192.168.1.105:8123/api/ -H 'Authorization: Bearer <long-lived-token>'
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 27
Date: Sun, 06 Mar 2022 21:03:50 GMT
Server: Python/3.9 aiohttp/3.8.1 

Note that without the --insecure flag I get the follow error

$ curl -X GET https://192.168.1.105:8123/api/error/all -H 'Authorization: Bearer <long-lived-token>’
curl: (60) SSL: no alternative certificate subject name matches target host name '192.168.1.105'
More details here: https://curl.haxx.se/docs/sslcerts.html

Thus, I believe this may be due to having a self signed certificate when connecting over https?

When hitting my instance locally (i.e. https://192.168.1.105:8123 I have to confirm I want to proceed due to the invalid cert and know this can cause problems elsewhere with other integrations.
image

I think HASS.Agent installer may be failing for this reason. Not sure if the installer saves more detailed logs anywhere that I can check.

@LAB02-Admin
Copy link
Member

LAB02-Admin commented Mar 7, 2022

Hey @bverkron,

When you open HASS.Agent, go to Configuration and then click Home Assistant API on the left:

image

Here you can set your own certificate, and if it's installed in your pc you can try checking use automatic client certificate selection.

Let me know if that helps.

@bverkron
Copy link
Author

bverkron commented Mar 9, 2022

I misspoke a bit in my description, was tired when I wrote the issue. I don't actually have a self signed certificate but rather my cert is for the duckdns url that I was using before switching to Nabu Casa. IIRC connecting via https but using the IP on the LAN will throw this kind of error for any https cert you have because they're for internet domains / urls and not local IPs.

I rectified the issue by using my Nabu Casa url instead of my local IP for now.

@bverkron bverkron closed this as completed Mar 9, 2022
@LAB02-Admin
Copy link
Member

Yep, you need to use the duckdns url and open a port in your WAN firewall, so not ideal. You don't need to provide a cert for duckdns though (as you can tell in my screenshot, I use duckdns for my testing environment).

But using the Nabu Casa url is safer :)

@ALERTua
Copy link

ALERTua commented May 17, 2022

as far as I understand, an external URL is unusable while your internet connection is down. it would be nicer to use local IP while keeping HTTPS and use no certificate. could you implement an option to do so?

@LAB02-Admin
Copy link
Member

Hi @ALERTua,

If you enable https, home assistant (by default) won't listen to local non-ssl connections anymore. If you want to use both local and ssl connections, I wrote a short manual on how to achieve that:

https://hassagent.readthedocs.io/en/latest/notifications/notification-debugging-ssl/

Note that this only works with duckdns and other custom ssl solutions. You don't need to do this for nabu casa; in that case you can just the local ip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants