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
- Update TrueNAS instance from Electric Eel (24.10.2) to Fangtooth Beta (25.04-BETA.1)
- 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
- update get_systemstats for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- update binary sensor services for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- truenas update sensor for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- truenas update sensor for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- API disconnect on failure #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Restart and reboot actions for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Snapshot actions for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Cloudsync actions for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- App update for jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Fixed adding new integration jsonrpc #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Removed compatibility for old TrueNAS version #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Fixed VM state #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Updated VM attributes #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Updated VM attributes #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Updated App attributes #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Removed passing hass object to API #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Fixed API reconnect when TrueNAS is offline on HA restart #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Log connection error only once #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Removed obsolete "method" parameter from API query #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
- Added error for DNS issue #210 — committed to tomaae/homeassistant-truenas by tomaae a year ago
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: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.
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 :
But not this one
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
Go into HACS, find the TrueNAS integration, and select redownload. Select the latest beta version and install. Works fine after that.
1.3.1 is not compatible with truenas 25, you need 1.4
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:
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.
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)
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.
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.
The new beta version works ok for me as well, except for the VM status sensor, where I had to do this change:
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
legacybranch 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:
and the same update within the api.error 500 logic