tomaae / homeassistant-truenas

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

[Bug] "reporting/get_data" endpoint removed in truenas 23.10+ #102

Closed Poshy163 closed 4 months ago

Poshy163 commented 1 year ago

Cant find the reporting/get_data field on the newest truenas 23.10 coiba beta, (may have moved/been renamed)

Diagnostics data

2023-08-30 17:24:51.839 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:52.169 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:52.490 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:52.812 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:53.154 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:53.509 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:53.882 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:54.243 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:54.619 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:55.081 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:55.527 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:55.928 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 192.168.1.223 unable to fetch data "reporting/get_data" (500) 2023-08-30 17:24:55.929 WARNING (SyncWorker_0) [custom_components.truenas.truenas_controller] TrueNAS 192.168.1.223 fetching following graphs failed, check your NAS: ['load', 'cputemp', 'cpu', 'arcsize', 'arcratio', 'memory', 'interface', 'interface', 'interface', 'interface', 'interface']

tomaae commented 1 year ago

could be related to https://ixsystems.atlassian.net/browse/NAS-122654 ticket is just about adding endpoints, but in code I can see they removed get_data completly https://github.com/truenas/webui/pull/8411 so this will need version detection and separate queries for 23.10

goggel commented 11 months ago

This does spam the log really bad and fills the entire disk space with RC1.

tomaae commented 11 months ago

just disable the integration, its not working anyway with RC

anto294 commented 11 months ago

Any new news? On rc.1 /reporting/netdata_get_data works fine.

tomaae commented 11 months ago

not yet, I'm busy with family issues right now

da-anda commented 11 months ago

no idea if this is related, but I also have update to 23.10 RC1 (since my OS HDD died and 22.04. had an unresolved bug with PCI passthrough to VMs). Since the integration had issues, I have removed my old configuration and created a new one. All entities have different names now and DO NOT contain the name of the server as part of their entity name anymore. So instead of sensor.truenas_temperature it is now called sensor.temperature.

tomaae commented 11 months ago

no idea if this is related, but I also have update to 23.10 RC1 (since my OS HDD died and 22.04. had an unresolved bug with PCI passthrough to VMs). Since the integration had issues, I have removed my old configuration and created a new one. All entities have different names now and DO NOT contain the name of the server as part of their entity name anymore. So instead of sensor.truenas_temperature it is now called sensor.temperature.

no, thats unrelated. but your issue will be solved in next release, most likely its already in master or as uncommited change.

redpixy commented 10 months ago

it seems in the new 23.10.0 truenas release, it's broken.

Poshy163 commented 10 months ago

Yep, as mentioned above, the maintainer is busy with family issues right now, it will be ready when its ready

LittleDonnieJ commented 10 months ago

Any new news? On rc.1 /reporting/netdata_get_data works fine.

I've tested by modifying only these 3 spots on my instance: image

and after a reboot and enabling the integration: image

Update: well at least it's not crashing my HA anymore. This doesn't return data for network and some other stats: image

noctarius commented 9 months ago

Made the same change as @LittleDonnieJ and works great! Thanks for sharing :-)

spitfire commented 9 months ago

Any new news? On rc.1 /reporting/netdata_get_data works fine.

I've tested by modifying only these 3 spots on my instance: image

and after a reboot and enabling the integration: image

Update: well at least it's not crashing my HA anymore. This doesn't return data for network and some other stats: image

Does it return anything? If it does maybe you could send a pull request, it would be a start ;)

LittleDonnieJ commented 9 months ago

Any new news? On rc.1 /reporting/netdata_get_data works fine.

I've tested by modifying only these 3 spots on my instance: image and after a reboot and enabling the integration: image Update: well at least it's not crashing my HA anymore. This doesn't return data for network and some other stats: image

Does it return anything? If it does maybe you could send a pull request, it would be a start ;)

It does return the integration back to 80% functionality. Everything seems to work except for the system data provided by the /reporting/netdata_get_data post request. I don't feel confident enough in trying to parse the rest of the data to make it a true pull request. I'm good enough having most of my personal functionality back and having tested the validity of the initial change.

tomaae commented 9 months ago

good to know that everything else works. personally, I cannot even get cobia working fully in proxmox to start testing

broyuken commented 9 months ago

What files are you updating? I don't have an api.py or a coordinator.py

noctarius commented 9 months ago

For me the filenames were truenas_coordinator.py and truenas_api.py.

raetha commented 9 months ago

Can anyone share exactly what they are updating the code to that works? I tried changing the pointer to "reporting/netdata_get_data" and I'm getting 400 errors now. So doesn't seem to be working any better for me, but assuming I just messed something up.

CaseySJ commented 9 months ago

@raetha

Screenshots below show the 3 changes to be made in 2 files:

Then restart Home Assistant.

Screenshot 2023-12-15 at 7 17 13 AM Screenshot 2023-12-15 at 7 18 02 AM
raetha commented 9 months ago

Thank you @CaseySJ! It looks like I had done the correct thing after all, nice to have confirmation. I am still seeing these errors in the HA logs:

2023-12-15 12:00:49.925 WARNING (SyncWorker_6) [custom_components.truenas.truenas_api] TrueNAS snotra.lan unable to fetch data "system/info" (no_response) 2023-12-15 12:01:45.784 WARNING (SyncWorker_4) [custom_components.truenas.truenas_api] TrueNAS snotra.lan unable to fetch data "reporting/netdata_get_data" (400)

They aren't generating as large logs as the prior error, but still once per minute it seems. May just have to wait until the component is updated to support the new version of TrueNAS Scale, unless someone has an idea on what the new 400 and no_response errors really are.

firstof9 commented 8 months ago

While researching this it looks like:

1) get_data works fine 2) the reporting_query needs to be updated for 23+

                                "start": "now-90s",
                                "end": "now-30s",

will need to be integers using unix time.

Also 'arcratio' is no longer valid.

makisHr03 commented 8 months ago

Hello, I'm new here and a bit confused. I've installed TrueNAS Scale on my server and run Home Assistant from it. I've noticed that some sensors are showing 0%. Is there a solution to fix this issue?

Thanks a lot!

tannisroot commented 8 months ago

Hello, I'm new here and a bit confused. I've installed TrueNAS Scale on my server and run Home Assistant from it. I've noticed that some sensors are showing 0%. Is there a solution to fix this issue?

Thanks a lot!

Not on Cobia, please wait for a fix for this issue to be released.

spitfire commented 8 months ago

Hello, I'm new here and a bit confused. I've installed TrueNAS Scale on my server and run Home Assistant from it. I've noticed that some sensors are showing 0%. Is there a solution to fix this issue? Thanks a lot!

Not on Cobia, please wait for a fix for this issue to be released.

This issue has been know since August, I wouldn't count on a fix being released (at least not on this repo).

tomaae commented 8 months ago

it will be released, life just sometimes can get in the way in ugly way

prajjwalburman commented 7 months ago

Okay. so I've been fiddling around with the new netdata_get_data API and seems like there has been several changes made which breaks this integration.

I've updated the controller and the sensors and got most of them working, I'll try to raise a PR if someone needs it.

Screenshot 2024-02-18 153920

raetha commented 7 months ago

Please do submit a PR, or at least share your “fixed” repo. It would be nice to grab your version and have some functionality as well as being able to help test while waiting for this repo to get the updates. Thanks for the work on this issue!

prajjwalburman commented 6 months ago

I am trying to create a PR, but seems like the master branch isnt up to date and doesnt have the truenas_controller.py file. @tomaae Can you help out here?

tomaae commented 6 months ago

I am trying to create a PR, but seems like the master branch isnt up to date and doesnt have the truenas_controller.py file. @tomaae Can you help out here?

Yea, you have to build it upon master branch, not last release. There are major changes in master branch to integrate even more tightly with HA and use its latest features. Or you can just change me diff and I will implement it into master.

mrsaxenanitin commented 6 months ago

this repo to get the updates. Thanks for the work on this issue!

I would like to request you (@prajjwalburman) to please share your updated repo or share the changes here. This will really help us to get the functionality back. Thanks Prajjwal in advance.

spitfire commented 6 months ago

this repo to get the updates. Thanks for the work on this issue!

I would like to request you (@prajjwalburman) to please share your updated repo or share the changes here. This will really help us to get the functionality back. Thanks Prajjwal in advance.

go in his profile, choose repositories tab. It's really not hard to find.

mrsaxenanitin commented 6 months ago

this repo to get the updates. Thanks for the work on this issue!

I would like to request you (@prajjwalburman) to please share your updated repo or share the changes here. This will really help us to get the functionality back. Thanks Prajjwal in advance.

go in his profile, choose repositories tab. It's really not hard to find.

Thanks for the reply @spitfire . I went ot his profile but the repo is 6 month old and the changes he mentioned is only 3 weeks old and the repo on the profile is still using the old api.

Is it possible for you to share the latest changes and help the community.

spitfire commented 6 months ago

Weird - it says last updated Feb 1, but the last commit os 6 months ago.

mrsaxenanitin commented 6 months ago

I have updated the file and zipped them.

Also, I have added few feature to get more details from the server.

image truenas.zip

makisHr03 commented 6 months ago

I have updated the file and zipped them.

Also, I have added few feature to get more details from the server.

image truenas.zip

Hi, because I am new here can you explain how I can update the integration or install your version?

mrsaxenanitin commented 6 months ago

Hi @makisHr03 ,

Just unzip the file inside custom_component folder in Home Assistant. Restart Home Assistant Goto Setting Device and services Add trunas Enter truenas server detail.

Thats it

makisHr03 commented 6 months ago

Hi @makisHr03 ,

Just unzip the file inside custom_component folder in Home Assistant. Restart Home Assistant Goto Setting Device and services Add trunas Enter truenas server detail.

Thats it

I have already to this I have this error, I am wondering if I did something wrong.

image

and with the default progress (install the truenas from hack) are working

mrsaxenanitin commented 6 months ago

Hi @makisHr03 , Just unzip the file inside custom_component folder in Home Assistant. Restart Home Assistant Goto Setting Device and services Add trunas Enter truenas server detail. Thats it

I have already to this I have this error, I am wondering if I did something wrong.

image

and with the default progress (install the truenas from hack are working)

Put the truenas server ip with port. Example: 192.168.1.254:80 Get the api key from truenas

Share your configuration screen

makisHr03 commented 6 months ago

Hi @makisHr03 , Just unzip the file inside custom_component folder in Home Assistant. Restart Home Assistant Goto Setting Device and services Add trunas Enter truenas server detail. Thats it

I have already to this I have this error, I am wondering if I did something wrong. image and with the default progress (install the truenas from hack are working)

Put the truenas server ip with port. Example: 192.168.1.254:80 Get the api key from truenas

Share your configuration screen

image

mrsaxenanitin commented 6 months ago

Hi @makisHr03 , Just unzip the file inside custom_component folder in Home Assistant. Restart Home Assistant Goto Setting Device and services Add trunas Enter truenas server detail. Thats it

I have already to this I have this error, I am wondering if I did something wrong. image and with the default progress (install the truenas from hack are working)

Put the truenas server ip with port. Example: 192.168.1.254:80 Get the api key from truenas Share your configuration screen

image

  • i have remove the api key from screenshot for security reasons

You first

  1. Delete the old truenas configuration from Home Assistant
  2. Delete truenas folder from custom_component
  3. Unzip my files
  4. Restart Home Assistant
  5. Add configuration again with port number. Default 80
  6. Check Home Assistant logs
mrsaxenanitin commented 6 months ago

Hi @makisHr03 , Just unzip the file inside custom_component folder in Home Assistant. Restart Home Assistant Goto Setting Device and services Add trunas Enter truenas server detail. Thats it

I have already to this I have this error, I am wondering if I did something wrong. image and with the default progress (install the truenas from hack are working)

Put the truenas server ip with port. Example: 192.168.1.254:80 Get the api key from truenas Share your configuration screen

image

  • i have remove the api key from screenshot for security reasons

You first

  1. Delete the old truenas configuration from Home Assistant
  2. Delete truenas folder from custom_component
  3. Unzip my files
  4. Restart Home Assistant
  5. Add configuration again with port number. Default 80
  6. Check Home Assistant logs

If this also doesn't work than install from hacs and overwrite 2 files from my zip file Coordinator Sensor

makisHr03 commented 6 months ago

I have done both of your solutions

the first one has the same error.

is the second working but I have only 15 entities i don't see the sensors (temp, load, ram ...)

image (screenshot from system category) image

and in the notification I see this error, maybe it can help you image image

mrsaxenanitin commented 6 months ago

I have done both of your solutions

the first one has the same error.

is the second working but I have only 15 entities i don't see the sensors (temp, load, ram ...)

image (screenshot from system category) image

  • also notice that the file "coordinator" does not exist in hacs file.

and in the notification I see this error, maybe it can help you image image

These logs doesn't use my integration. Share your whatsapp number @mr.saxena.nitin@gmail.com

anipad commented 6 months ago

I have done both of your solutions

the first one has the same error.

is the second working but I have only 15 entities i don't see the sensors (temp, load, ram ...)

Same behaviour here. Did you solve this issue?

makisHr03 commented 6 months ago

I have done both of your solutions the first one has the same error. is the second working but I have only 15 entities i don't see the sensors (temp, load, ram ...)

Same behaviour here. Did you solve this issue?

After the help of @mrsaxenanitin the fixed solution is this one: truenas.zip

IronicRebound77 commented 6 months ago

Thanks this worked!

mrsaxenanitin commented 6 months ago

Hello Everyone,

Seems there is some problem in terms of the usage of my zip files. Let me help you to understand.

  1. Goto your truenas ip and add /api/docs/ example: http://192.168.1.254:80/api/docs/

  2. Search "reporting/get_data" If found: extract truenas.zip truenas.zip under custom_components by the name of truenas If NOT found : Search "reporting/netdata_get_data" If found: extract truenas_netdata.zip truenas_netdata.zip under custom_components by the name of truenas If NOT found : Post here we will try to fix

broyuken commented 6 months ago

Why don’t you put your changes in a repo then so people can just pull it via hacs. Or make a PR to this repo instead of doing it the hard way that a lot of people won’t be able to figure out if they’re not an advanced user. Some people may struggle to connect to the file system of their HA if they are just used to using the gui for everything.

mrsaxenanitin commented 6 months ago

Why don’t you put your changes in a repo then so people can just pull it via hacs. Or make a PR to this repo instead of doing it the hard way that a lot of people won’t be able to figure out if they’re not an advanced user. Some people may struggle to connect to the file system of their HA if they are just used to using the gui for everything.

I do understand that this is not the right solution for the basic user but I am not having the access to the repo as I am not a developer. I am just doing this to fix my problem and I am glad that this is helpful to the community.

I would like to request @tomaae to incorporate these changes in his repo so that this will help the wider community.

There are changes in only 2 files: sensor_types.py coordinator.py

Let me know in case you need any other details from my end.

spitfire commented 6 months ago

Why don’t you put your changes in a repo then so people can just pull it via hacs. Or make a PR to this repo instead of doing it the hard way that a lot of people won’t be able to figure out if they’re not an advanced user. Some people may struggle to connect to the file system of their HA if they are just used to using the gui for everything.

I do understand that this is not the right solution for the basic user but I am not having the access to the repo as I am not a developer. I am just doing this to fix my problem and I am glad that this is helpful to the community.

I would like to request @tomaae to incorporate these changes in his repo so that this will help the wider community.

There are changes in only 2 files: sensor_types.py coordinator.py

Let me know in case you need any other details from my end.

  1. Create your own fork from this repo
  2. Modify files as needed (then you can point people at it to test)
  3. Create a pull request for it to be merged
mrsaxenanitin commented 6 months ago

Why don’t you put your changes in a repo then so people can just pull it via hacs. Or make a PR to this repo instead of doing it the hard way that a lot of people won’t be able to figure out if they’re not an advanced user. Some people may struggle to connect to the file system of their HA if they are just used to using the gui for everything.

I do understand that this is not the right solution for the basic user but I am not having the access to the repo as I am not a developer. I am just doing this to fix my problem and I am glad that this is helpful to the community. I would like to request @tomaae to incorporate these changes in his repo so that this will help the wider community. There are changes in only 2 files: sensor_types.py coordinator.py Let me know in case you need any other details from my end.

  1. Create your own fork from this repo
  2. Modify files as needed (then you can point people at it to test)
  3. Create a pull request for it to be merged

Thanks for the guidance @spitfire

I have created the new repo under my account https://github.com/mrsaxenanitin/homeassistant-truenas

I am not sure how to create a pull request. Will be a great help if you can guide me to do that.