tomaae / homeassistant-truenas

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

[Bug] Integration does not display all values. #148

Closed derpate1989 closed 5 months ago

derpate1989 commented 6 months ago

Describe the issue

Integration does not display all values.

Screenshots

Bildschirmfoto 2024-03-14 um 08 09 26

Software versions

derpate1989 commented 6 months ago

Bildschirmfoto 2024-03-14 um 08 12 45

on Truenas WebUI I see all values

ozzy071988 commented 5 months ago

I have this problem too

obraz obraz

LeandroSQ commented 5 months ago

Same here, I was using this extension a while ago and it was working normally. On this fresh installation I can't see CPU loads anymore.

andreheuer commented 5 months ago

I do have the same issue on my installation

donkeysmood commented 5 months ago

Same issue here. Seems like only uptime and free space is working.

image

Software versions

HA v2024.3.3 TrueNAS-SCALE-23.10.2 TrueNAS Integration 1.2.5

Logging

Log report 1 This error originated from a custom integration.

Logger: custom_components.truenas.truenas_api Source: custom_components/truenas/truenas_api.py:111 integration: TrueNAS (documentation, issues) First occurred: 8:10:18 PM (48 occurrences) Last logged: 8:41:20 PM

TrueNAS 192.168.68.86 unable to fetch data "reporting/get_data" (422)

Log report 2 Logger: homeassistant.const Source: helpers/deprecation.py:205 First occurred: 8:10:20 PM (3 occurrences) Last logged: 8:10:20 PM

DATA_GIBIBYTES was used from truenas, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfInformation.GIBIBYTES instead, please create a bug report at https://github.com/tomaae/homeassistant-truenas/issues DATA_KIBIBYTES was used from truenas, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfInformation.KIBIBYTES instead, please create a bug report at https://github.com/tomaae/homeassistant-truenas/issues TEMP_CELSIUS was used from truenas, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please create a bug report at https://github.com/tomaae/homeassistant-truenas/issues

andreheuer commented 5 months ago

I also had a look into the log and I found the following error which appears several times: 2024-03-31 12:26:45.575 WARNING (SyncWorker_58) [custom_components.truenas.truenas_api] TrueNAS nas unable to fetch data "reporting/get_data" (422)

So I tried to call this API endpoint using the same parameters as the integration and I received the following error in the REST API Browser:

500 Internal Server Error
Server got itself in trouble 

This seems to be the issue, why the integration is not fetching the data (cpu usage, memory, arc cache etc.). Then, I checked the middleware.log on my TrueNAS-SCALE-23.10.2. This was logging the following error:

[2024/04/03 08:55:23] (ERROR) aiohttp.server.log_exception():403 - Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/restful.py", line 597, in parse_rest_json_request
    body = await req.json()
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/aiohttp/web_request.py", line 671, in json
    return loads(body)
           ^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 4 column 1 (char 49)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/aiohttp/web_middlewares.py", line 108, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/restful.py", line 521, in on_method
    return await do(method, req, resp, authenticated_credentials, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/restful.py", line 683, in do
    request_body, error = await self.parse_rest_json_request(req, resp)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/restful.py", line 598, in parse_rest_json_request
    except json.decoder.JSONDecodeError as e:
           ^^^^^^^^^^^^
AttributeError: module 'middlewared.client.ejson' has no attribute 'decoder'

I could not further pin it down yet, but I try to find out some more details.

andreheuer commented 5 months ago

Found #102 with a long discussion on this...so this is a duplicate

tomaae commented 5 months ago

yes, this is a duplicate