homeassistant-truenas: [Bug] Integration fails to connect to Fangtooth install

Describe the issue

After updating my TrueNAS to the Fangtooth Beta, the integration fails to start with the message: Failed setup, will retry: TrueNas disconnected

How to reproduce the issue

  1. Update TrueNAS instance from Electric Eel (24.10.2) to Fangtooth Beta (25.04-BETA.1)
  2. Try to use the HomeAssistant integration

Expected behavior

The integration should continue working as before.

Software versions

  • Home Assistant version: 2025.2.5
  • TrueNAS integration version: 1.3.1
  • TrueNAS version: 25.04-BETA.1

Traceback/Error logs

From the logs:

TrueNAS 192.168.1.125 unable to fetch data "reporting/get_data" (400)
TrueNAS 192.168.1.125 unable to fetch data "jail" (404)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 14
  • Comments: 239 (85 by maintainers)

Commits related to this issue

Most upvoted comments

it will still take some time, need to go over all endpoint with new api and test everything in detail. its way more work then expected.

Looks like even with the full release it’s still broken.

I been bit too busy lately, just upgraded my main nas, to have better way to test this. Hopefully I will be able to release fully featured beta next week.

It works for me on TrueNAS SCALE 25.04 after simply commenting out 4 lines in coordinator.py:

#        if self.api.connected():
#            await self.hass.async_add_executor_job(self.get_jail)
#        if self.api.connected():
#            await self.hass.async_add_executor_job(self.get_vm)

This skips the jail and vm API calls that are no longer available on SCALE, which were causing the integration to fail. Everything else (dataset, pool, system info, etc.) works as expected.

New beta has been released

lets keep on topic of official changes and testing here, please. mixing in modification on old code will just create confusion

if anyone wants to test, master already shows all data except systems stats. Getting a weird error there. HA services probably dont work yet, I didnt get to it. Also, master will work only with fangtooth right now. api type detection is not there yet. Supporting that many versions in one integration is getting bit clunky.

New beta is released and it should have everything from this thread implemented. If I missed something, let me know.

I have decided that next release wont be compatible with old truenas versions, so I can clean up the code and make it more efficient. I will keep legacy branch as suggested for old versions.

Managed to get the integration working on TrueNAS SCALE 25.04.0 by applying the following fixes to coordinator.py, based on the discussions and solutions found here

Version Detection (get_systeminfo): We modified the function to correctly identify the system as “SCALE” and parse the major/minor version from the simplified string returned by the Fangtooth API (e.g., “25.04.0”), as the “TrueNAS-SCALE-” prefix is no longer present. This ensures _is_scale and _version_major are set correctly.

System Statistics (get_systemstats) for Fangtooth (>=25.x):

Confirmed the use of the reporting/netdata_get_data endpoint. Adjusted the payload (params) structure sent to this endpoint to be a list in the format [ [list_of_graphs], {query_dictionary} ], as suggested by @boced66. Within the query_dictionary, changed the key to “query” and updated the start/end values to use epoch timestamps (integers), aligning with the findings of @TheMammen, @boced66, and @tomaae’s latest code for Fangtooth. jail and vm Endpoints: Added a check at the beginning of the get_jail and get_vm functions to return immediately if _is_scale is true and _version_major >= 25. This prevents 404 errors and other issues with these endpoints in Fangtooth, as they have been changed/removed.

With these modifications, the statistics data collection was normalized, and the connection/API errors were resolved.

coordinator.txt (replace coordinator.py with this content)

Don’t just write that, it’ll make people panic. It looks like this integration will need a rewrite or significant changes though because of this.

TrueNAS 25.04 and later uses a versioned JSON-RPC 2.0 over WebSocket API.

They’re not just removing the api and leaving us with no alternative.

HA 2025.6 (HAOS version only) downgraded websockets library for some reason to some quite old version which didnt even support keepalive. Released new beta which upgrades it again, this will fix disconnects on HAOS.

it will still take some time, need to go over all endpoint with new api and test everything in detail. its way more work then expected.

No worries. That’s why I always point out that we appreciate your efforts. This stuff is complicated, and you do it for free, for the benefit of others. So… thank you.

Unfortunately, I am not able to get it working as well. I have running an nginx proxy manager instance with a valid Let’s Encrypt Wildcard Cert that serves via an URL. Connecting to my NAS via this URL correctly works in any browser (mobile or desktop) but the TrueNAS integration is not able to verify the cert for this URL (and only this one, all other work flawlessly). Additionally, my TrueNAS instance starts revoking the API key after a few tries with different configs in the integration.

The only errors I get in the logs are the following: TrueNAS nas.sh-software.info failed to connect ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)) TrueNAS connection error (certificate_verify_failed) TrueNAS connection error ()

No, its not them directly doing it, its dependency hell.

interesting, I will test it

This one work :

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "reporting.netdata_get_data",
  "params": [ 
              [{"name":"memory"},{"name": "load"}],
              {"start":1747729386,"end":1747729416}
            ]
}

But not this one


{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "reporting.netdata_get_data",
  "params": [ 
              {
                "graphs": [{"name":"memory"},{"name": "load"}],
                "query": {"start":1747729386,"end":1747729416}
              }
            ]
}

I don’t know why

maybe it will work once I switch to using jsonrpc 2.0

I have most of it done, but I’m not able to query virt.instance.query endpoint using websocket. it works using midclt call in cli

just make it works in same conditions: TrueNAS SCALE 25.04.1 + 1.4b4 settings: ip truenas:Web Interface HTTPS Port api key unchecked verify_ssl

I’m on HA 2025.06.3 and TrueNAS integration 1.3.1. Trying to connect to a Fangtooth 25.04.1 TrueNas Community edition. This is my first time to try and make this connection. I checked the “Use SSL” and unchecked “Verify SSL” as I’m just on the OOTB self-signed cert that comes with TrueNAS.

I get no errors about SSL. Instead I get the following and it never is able to connect.

This error originated from a custom integration.

Logger: custom_components.truenas.api
Source: custom_components/truenas/api.py:117
integration: TrueNAS (documentation, issues)
First occurred: 3:06:43 PM (4 occurrences)
Last logged: 3:06:55 PM

TrueNAS <ip redacted> unable to fetch data "reporting/get_data" (400)
TrueNAS <ip redacted> unable to fetch data "jail" (404)

Go into HACS, find the TrueNAS integration, and select redownload. Select the latest beta version and install. Works fine after that.

I’m on HA 2025.06.3 and TrueNAS integration 1.3.1. Trying to connect to a Fangtooth 25.04.1 TrueNas Community edition. This is my first time to try and make this connection. I checked the “Use SSL” and unchecked “Verify SSL” as I’m just on the OOTB self-signed cert that comes with TrueNAS.

I get no errors about SSL. Instead I get the following and it never is able to connect.

This error originated from a custom integration.

Logger: custom_components.truenas.api
Source: custom_components/truenas/api.py:117
integration: TrueNAS (documentation, issues)
First occurred: 3:06:43 PM (4 occurrences)
Last logged: 3:06:55 PM

TrueNAS <ip redacted> unable to fetch data "reporting/get_data" (400)
TrueNAS <ip redacted> unable to fetch data "jail" (404)

1.3.1 is not compatible with truenas 25, you need 1.4

Only known issue right now is with custom application update sensor. Issues being raised are mostly about using unsupported truenas version and proxy problems. Not sure how to address those so they are more clear right now.

Well, I am seeing no problems with the latest beta. I hadn’t thought of redownloading and selecting a “pre-release” from the versions, which is why I asked about the status. I was expecting a normal prompt about an update, but being beta, that wouldn’t happen, so my fault…

As for update sensors, I have a functioning sensor for TrueNAS itself, and my one application (Syncthing) has a sensor as well.

Image

Image

Thanks for all your hard work…

Oh, that just affects custom apps created using json. Update sensor for apps from truenas catalog will work fine.

Uncheck verify SSL during setup.

On Sat, Jun 28, 2025, 11:33 PM Wormuth Household @.***> wrote:

wormuths left a comment (tomaae/homeassistant-truenas#210) https://github.com/tomaae/homeassistant-truenas/issues/210#issuecomment-3016265740

Yup, now I got this… SSL fails because it’s a self-signed certificate… How do I fix this, if you know? There’s a lot of SSL talk in this thread and I’m not sure if this is a different issue, or how to fix?

Any help would be appreciated…

This error originated from a custom integration.

Logger: custom_components.truenas.api Source: custom_components/truenas/api.py:89 integration: TrueNAS (documentation, issues) First occurred: 11:27:37 PM (1 occurrence) Last logged: 11:27:37 PM

TrueNAS failed to connect ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1028))

— Reply to this email directly, view it on GitHub https://github.com/tomaae/homeassistant-truenas/issues/210#issuecomment-3016265740, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY35SCQMDAN5GT24TPZP3T3F5M7LAVCNFSM6AAAAABXUO6Z6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMJWGI3DKNZUGA . You are receiving this because you commented.Message ID: @.***>

Reinstalled the integration and that fixed it. Thank you!

Can confirm b3 resolves the HA 2025.6 break

I ran into this issue as well after upgrading my systems about a week ago. I saw this was being worked on so figured I’d wait for a few updates in case everything was resolved.

I have 2 systems, both on 25.04 as of a week ago. My secondary system showed up in home assistant exactly as it used to after installing 1.4b1, but the my system didn’t, the integration loaded, but it wouldn’t pull in any sensor data.

Since upgrading to 1.4b2, the secondary system is still fine, but the integration for the main one errors with “failed setup”

Here are the logs I’m getting from the home assistant logs page, not sure if this is the best place to get them but hopefully it helps. IP redacted but it’s a standard 10. Class A.

2025-06-06 12:13:19.959 ERROR (MainThread) [custom_components.truenas.api] TrueNAS <IP>:444 failed to connect (timed out while waiting for handshake response)
2025-06-06 12:13:48.952 WARNING (SyncWorker_5) [custom_components.truenas.api] TrueNAS <IP>:444 unable to fetch data "pool.dataset.query" (sent 1009 (message too big) frame exceeds limit of 1048576 bytes; no close frame received)
2025-06-06 12:14:04.220 ERROR (MainThread) [custom_components.truenas.api] TrueNAS <IP>:444 failed to connect (timed out while waiting for handshake response)
2025-06-06 12:14:24.512 ERROR (MainThread) [custom_components.truenas.api] TrueNAS <IP>:444 failed to connect (timed out while waiting for handshake response)

yes, it will only work with TrueNAS 25+

Is there a solution for Core 13.3? Maybe older version that could be forked or sth.

Just stay on old version, its already fully featured and works fine.

Running HA 2025.5.3 and 1.4b2. The integrations works for one server but not for the other. Both servers are running Truenas 25.04.1.

For the failing process I can find (redacted IPs)

2025-06-05 10:08:36.539 WARNING (SyncWorker_5) [custom_components.truenas.api] TrueNAS x.x.x.x:44300 unable to fetch data "pool.dataset.query" (sent 1009 (message too big) frame exceeds limit of 1048576 bytes; no close frame received)
Traceback (most recent call last):
  File "/config/custom_components/truenas/api.py", line 167, in query
    self._ws.send(json.dumps(payload))
    ^^^^^^^^
AttributeError: 'TrueNASAPI' object has no attribute '_ws'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 233, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 121, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 336, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 383, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        flow, cur_step["step_id"], user_input
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 487, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/config_flow.py", line 75, in async_step_user
    conn, errorcode = await self.hass.async_add_executor_job(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        api.connection_test
        ^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/truenas/api.py", line 135, in connection_test
    self.query("system.info")
    ~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/api.py", line 204, in query
    self.disconnect()
    ~~~~~~~~~~~~~~~^^
  File "/config/custom_components/truenas/api.py", line 109, in disconnect
    self._ws.close()
    ^^^^^^^^
AttributeError: 'TrueNASAPI' object has no attribute '_ws'

This error occurs in both cases when I use host names or IP addresses.

I also have error in truenas 25.4.1, 1.4b2, ha core 2025.6.0b3. I connect to remote site with Unifi Site-magic. I don’t use ssl. I’m not sure why I’m keep getting response from 172.30.33.7.

2025-06-04 19:31:58.071 ERROR (SyncWorker_21) [custom_components.truenas.api] TrueNAS 10.40.0.100:5000 failed to connect ([SSL] record layer failure (_ssl.c:1028))
2025-06-04 19:31:58.092 WARNING (SyncWorker_21) [custom_components.truenas.api] TrueNAS 10.40.0.100:5000 unable to fetch data "system.info" ('TrueNASAPI' object has no attribute '_ws')
2025-06-04 19:31:58.093 ERROR (MainThread) [aiohttp.server] Error handling request from 172.30.33.7
Traceback (most recent call last):
  File "/config/custom_components/truenas/api.py", line 167, in query
    self._ws.send(json.dumps(payload))
    ^^^^^^^^
AttributeError: 'TrueNASAPI' object has no attribute '_ws'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 83, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 227, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 121, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 336, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 383, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        flow, cur_step["step_id"], user_input
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 487, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/config_flow.py", line 75, in async_step_user
    conn, errorcode = await self.hass.async_add_executor_job(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        api.connection_test
        ^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/truenas/api.py", line 135, in connection_test
    self.query("system.info")
    ~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/api.py", line 204, in query
    self.disconnect()
    ~~~~~~~~~~~~~~~^^
  File "/config/custom_components/truenas/api.py", line 109, in disconnect
    self._ws.close()
    ^^^^^^^^
AttributeError: 'TrueNASAPI' object has no attribute '_ws'

It was not an issue until now, since we could just go by version. But new backwards incompatible API is a major change, so this is the best. I have already created a legacy branch. Not sure if it will be needed, but we have it just in case.

Ok now it works when i use it with ssl and uncheck “Verify SSL certificate” wich i also tried every time before.

Also everything shows up now, but the VM’s all show as off. But i think thats because of the new Virualisation system?

When i try to setup the v1.4b1 it says “Unknown error occurred” and i have the same Error as avadi123.

I already did reinstall the Integration multiple times.

2025-06-02 00:50:27.195 ERROR (SyncWorker_7) [custom_components.truenas.api] TrueNAS 192.168.3.2 failed to connect ([Errno 111] Connection refused)
2025-06-02 00:50:27.197 ERROR (SyncWorker_7) [custom_components.truenas.api] TrueNAS 192.168.3.2 failed to connect ([Errno 111] Connection refused)
2025-06-02 00:50:27.197 WARNING (SyncWorker_7) [custom_components.truenas.api] TrueNAS 192.168.3.2 unable to fetch data "system.info" ('TrueNASAPI' object has no attribute '_ws')
2025-06-02 00:50:27.198 ERROR (MainThread) [aiohttp.server] Error handling request from 127.0.0.1
Traceback (most recent call last):
  File "/config/custom_components/truenas/api.py", line 166, in query
    self._ws.send(json.dumps(payload))
    ^^^^^^^^
AttributeError: 'TrueNASAPI' object has no attribute '_ws'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 77, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 233, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 121, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 336, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 383, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        flow, cur_step["step_id"], user_input
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 487, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/config_flow.py", line 79, in async_step_user
    conn, errorcode = await self.hass.async_add_executor_job(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        api.connection_test
        ^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/truenas/api.py", line 132, in connection_test
    self.query("system.info")
    ~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/api.py", line 203, in query
    self.disconnect()
    ~~~~~~~~~~~~~~~^^
  File "/config/custom_components/truenas/api.py", line 106, in disconnect
    self._ws.close()
    ^^^^^^^^
AttributeError: 'TrueNASAPI' object has no attribute '_ws'

The new beta version works ok for me as well, except for the VM status sensor, where I had to do this change:

diff --git a/custom_components/truenas/coordinator.py b/custom_components/truenas/coordinator.py
index 2b24c88..93f1742 100644
--- a/custom_components/truenas/coordinator.py
+++ b/custom_components/truenas/coordinator.py
@@ -1081,7 +1081,7 @@ class TrueNASCoordinator(DataUpdateCoordinator[None]):
                 {"name": "autostart", "type": "bool", "default": False},
                 {"name": "cores", "default": 0},
                 {"name": "threads", "default": 0},
-                {"name": "state", "source": "status/state", "default": "unknown"},
+                {"name": "state", "source": "status", "default": "unknown"},
             ],
             ensure_vals=[
                 {"name": "running", "type": "bool", "default": False},

I have yet to come up with an idea how to detect which API to use.

Since TrueNAS Core is being phased out and there’s only one Community Edition (previously called SCALE) going forward, I think it’d be a good idea to start supporting only 25.04+ in a new major version (v2.0.0) and move the existing code to a legacy branch or something like that.

All of the Diagnostics sensors look good here. The Services / and app sensors seem to be working on my instance.

Thanks for all your hard work.

more stuff to test. all sensors in system should not work. services for instances, apps and services are not working

I know all above services will work, but system sensors can be weird on various configuration.

Our hope rests with you! Cheers for the good work you’re pulling through!

all good then

check HA log for error

I haven’t set up anything SSL related for either HA or TrueNAS, so guessing that is probably my issue. Just in denial about the fact that I need to learn how it works.

new api uses ssl, json and websockets libraries. all of that is used in base HA, so there should not be any issue. just a note, iX forced SSL for new API, so unsecure connection is no longer possible. API will upgrade to wss automatically, so there is no need to reconfigure integration. But in case there are connection issues, it may be related to SSL.

I got rid of the 400 error, in get_systemstats.

elif self._is_scale and self._version_major >= 24: ==> elif self._is_scale and self._version_major == 24:

added:

elif self._is_scale and self._version_major >= 25:
    tmp_params = {
        "graphs": [
            {"name": "load"},
            {"name": "cputemp"},
            {"name": "cpu"},
            {"name": "arcsize"},
            {"name": "memory"},
        ],
        "query": {
            "start": 90,
            "end": 30,
            "aggregate": True,
        },
    }

and the same update within the api.error 500 logic