tomaae / homeassistant-truenas

TrueNAS integration for Home Assistant
Apache License 2.0
183 stars 16 forks source link

[Bug] :443 port is required when specifying host name #143

Closed TheChuckster closed 5 months ago

TheChuckster commented 7 months ago

Describe the issue

I tried multiple things: IP, domain, https:// prefix / no prefix, http:// prefix, no prefix -- all "No response from host" when setting up the integration. The magic incantation was IP:443 like so. Perhaps more feedback would be helpful? I almost gave up before trying with the :443 port. Shouldn't it default to that port? Can we have some more descriptive UI messages or feedback instructing the user to do so?

tomaae commented 7 months ago

When using SSL, you should just check SSL checkbox and it would work. All integrations work this way.

gravelfreeman commented 6 months ago

There's definitely an issue with this since the latest updates of HAOS. I had this setup and working correctly but had to disable the extension because of the logging issue. I wanted to try the temporary fix to disable warning logging but upon reactivating the extension it wouldn't connect with the exact same settings that were previously working.

2024-02-19 15:46:22.718 WARNING (SyncWorker_34) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.23:81 unable to fetch data "system/info" (403)
2024-02-19 15:46:25.107 WARNING (SyncWorker_24) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.13:81 unable to fetch data "system/info" (403)

I thought this was some API keys error so I've deleted my machines and recreated new API keys. It never worked. I'm having the same issue as @TheChuckster. Unfortunately my Scale install is on port 81/444 so the fix to use 443 doesn't work for me.

I declare this extension broken and unusable at this point. Please check it out!

TheChuckster commented 6 months ago

@gravelfreeman So use :444 as the port instead? Did you try that? If so, did it work? I'm not claiming there's a showstopper bug, I'm just asking for a much-needed UI/UX improvement. That said, if explicitly specifying :444 isn't a solution for what you're experiencing, this is a much broader issue.

Also @tomaae , this goes beyond just checking the SSL box. Even with the SSL box (which I had checked all along, because I am using SSL), I still needed to explicitly specify the :443 port in order for it to work...

I would suggest people interested in this thread spend 10 minutes of their time trying this out for themselves, you will quickly gain intuition for how this might be un-intuitive for many people. For example, in web browsers, simply specifying the https:// protocol designator is enough to not need to also specify the :443 port -- surprisingly, that isn't the case for this...

gravelfreeman commented 6 months ago

@gravelfreeman So use :444 as the port instead? Did you try that? If so, did it work? I'm not claiming there's a showstopper bug, I'm just asking for a much-needed UI/UX improvement. That said, if explicitly specifying :444 isn't a solution for what you're experiencing, this is a much broader issue.

I tried both 81 and 444 with or without http and https and/or SSL checked and unchecked.

Doesn't work, the extention is broken for me and I believe for anyone else not using the default ports which is probably a lot as many users are using Truecharts which requires the ports to be 81/444.

tomaae commented 6 months ago

@TheChuckster I have tested it and it work just fine without specifying port You are supposed to enter host, not url. That is in line with HA standard. Entering port is of course optional, that will always work. You have not specified any versions or errors, but both latest release and master version work in this way.

@gravelfreeman that is unrelated. you are using unsupported version of truenas

gravelfreeman commented 6 months ago

@gravelfreeman that is unrelated. you are using unsupported version of truenas

To all due respect the version of TrueNAS isn't a port number. Also that is a native feature of TrueNAS which this plugin supports. It's not even under Advanced Settings of TrueNAS. My version of TrueNAS isn't modified, I just updated the default ports.

I'm kindly asking you to reavaluate your statement. I can provide logs or anything you need to troubleshoot this matter.

Thank you.

tomaae commented 6 months ago
2024-02-19 15:46:22.718 WARNING (SyncWorker_34) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.23:81 unable to fetch data "system/info" (403)

I assume so by this log you included "2024-02-19 15:46:22.718 WARNING (SyncWorker_34) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.23:81 unable to fetch data "system/info" (403)", since you didnt included any other details. Looks like cobia issue. Either way, it is still unrelated to this issue. Specifying custom port always worked, but it you are certain, you can open new issue for it.

TheChuckster commented 6 months ago

@TheChuckster I have tested it and it work just fine without specifying port

Wish I would have recorded a video of my repro then...

tomaae commented 6 months ago

I have no clue how it would be even possible for you to have such issue. Way API connection is coded, it has to work reliably. I been using it that way since the start myself. If you can get it reliably replicate somehow, I will take test the same on my side. But cant imagine anything except maybe broken request library. But I find that very unlikely.

github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

MalcolmWade commented 5 months ago

Found this issue as I tried and have same issue. Getting "No response from host" using IP or fdqn with or without ssl "ticked".

Core 2024.3.1 Supervisor 2024.03.0

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] commented 5 months ago

This issue was closed because it has been stalled for 5 days with no activity.

ray73864 commented 4 months ago

Having the same issue here.

Unmodified version of TrueNAS Scale with the only change being the 2 ports from 80 to 81 and 443 to 444.

The reason for these changes is because the TrueCharts Traefik integration so that you can access your apps using subdomains, etc...

Traefik goes on port 80 and 443, which means TrueNAS has to be changed.

This is outlined here: https://truecharts.org/charts/premium/traefik/how-to/

I also tried putting :444 in with the IP and it didn't work, which means I also declare this plugin to be broken :(

gravelfreeman commented 4 months ago

Well this would finally explain my issue I guess.

tomaae commented 4 months ago

I dont use TrueCharts because of its unnecessary network complications. But changing port should definitely work fine. Try accessing API manually on that port. If that works, there should be no problem for integration to use it.

ray73864 commented 4 months ago

No issues accessing the API manually.

But everytime I try to put the ip:port in, it tells me it can't, it says 'no response from host'.

I exclusively use TrueCharts apps, I hate the TrueNAS versions, when I originally set up my server for Plex, I tried the TrueNAS version of Plex, and promptly gave up on it because it was the most painful thing to set up.

On the other hand, the TrueCharts version I got installed and up and running within minutes, compared to spending hours on the TrueNAS version.

So yeah, I'm not switching from TrueCharts, in my opinion their set up is better.

tomaae commented 4 months ago

I didnt had issues setting plex, but thats fine. its a matter of preference. in any way, it should work fine with.

Specifying port works fine, tested it on my dev VM:

2024-05-09 10:47:51.047 DEBUG (SyncWorker_3) [custom_components.truenas.api] TrueNAS 10.0.1.24:444 query: boot/get_state, get, {}
2024-05-09 10:47:51.160 DEBUG (SyncWorker_3) [custom_components.truenas.api] TrueNAS 10.0.1.24:444 query response: {'name': 'boot-pool', 'path': '/', 'status': 'ONLINE', 'scan': {'function': 'SCRUB', 'state': 'FINISHED', 'start_time': {'$date': 1714009502000}, 'end_time': {'$date': 1714009649000}, 'percentage': 99.99716281890869, 'bytes_to_process': 13869322240, 'bytes_processed': 13869715456, 'bytes_issued': 13867986944, 'pause': None, 'errors': 0, 'total_secs_left': None}, 'topology': {'data': [{'name': 'sda3', 'type': 'DISK', 'path': '/dev/sda3', 'guid': '11211159368783232901', 'status': 'ONLINE', 'stats': {'tim

I will deploy truecharts on my dev system and check that too

ray73864 commented 4 months ago

https://i.imgur.com/MJ6rghx.png

tomaae commented 4 months ago

are you sure you have valid certificate there? try disabling certificate verification

tomaae commented 4 months ago

Now I remembered another reason why I decided against truecharts. Still CPU at 100% at 2 dedicated cores after hour, still adding and at 40%. image Not sure if I will be able to test this fully.

ray73864 commented 4 months ago

Never had that issue before with CPU usage.

My CPU always sits around 10% or so, rocking a Ryzen 5600X, bare metal, no VM.

Been running this set up for over a year now.

tomaae commented 4 months ago

well, I will leave it running for now for testing purposes. Check your certificate validity, if its not valid, make sure to uncheck verification.

tomaae commented 4 months ago

Integration works just fine with truecharts and traefik installed image Tested on Dragonfish-24.04.0 Integration was on master version, which is identical with v1.3b2 at the moment.

So the issue is not related to changing ports to 81/444, nor having traefik installed. I also tested port 81 btw, everything works.

btw, it took 2.5 hours for truenas to add truecharts repository and going into apps tab will always ramp up cpu.