tomaae / homeassistant-openmediavault

OpenMediaVault integration for Home Assistant
Apache License 2.0
111 stars 16 forks source link

[Bug] HA integration is not working with OMV 7 #149

Open sharn25 opened 8 months ago

sharn25 commented 8 months ago

Describe the issue

The OMV 7 version showing in all entries as unknown.

How to reproduce the issue

  1. Add the Integration.
  2. Enter the OMV server IP address and credentials.
  3. It will show some entities for assigning the area.
  4. check the status of the entities. It will be unknown.

Expected behavior

The Entities should show the values like CPU usages, RAM usages.

Screenshots

image

Software versions

akyjoe commented 8 months ago

Unable to connect with the HOST (OMV 7) from Home Assistant (2024.3.1). Upon "Submit", error message throws above the host input field "No response from host."

Is it because OMV 7 is not fully supported yet?

BebeMischa commented 8 months ago

Just for reference: yesterday I did the upgrade from OMV 6 to OMV 7 and except the CPU load (which is known bug) everything works fine here.

akyjoe commented 8 months ago

May be some permission is still missing. Steps followed were:

image

Tried, with/without SSL, verify SSL, Hostname and IP Address. Error persists.

tomaae commented 8 months ago

make sure you can access omv from your ha instance and that you are using build in admin account.

sharn25 commented 8 months ago

Hi,

I downloaded the diagnostics information, the values is being updated there.

Below Screenshots showing the change in values over time.

image

but the values under entities are still showing unknown.

tomaae commented 8 months ago

that most likely means something is crashing before entities are updated. look into your ha log.

github-actions[bot] commented 8 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.

sharn25 commented 7 months ago

Hi Everyone, I just completed the Home assistant upgrade to 2024.4.1 and tried to re-add the OMV server. But still not working. All the entities are unknown. Following error is coming in Home Assistant logs:

2024-04-06 21:49:31.137 INFO (MainThread) [homeassistant.components.sensor] Setting up openmediavault.sensor
2024-04-06 21:49:31.142 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_system_cpu_load
2024-04-06 21:49:31.152 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_system_memory
2024-04-06 21:49:31.165 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_system_uptime
2024-04-06 21:49:31.172 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_filesystem
2024-04-06 21:49:31.179 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_filesystem_2
2024-04-06 21:49:31.195 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_filesystem_3
2024-04-06 21:49:31.202 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_filesystem_4
2024-04-06 21:49:31.209 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_disk
2024-04-06 21:49:31.219 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_disk_2
2024-04-06 21:49:31.225 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.openmediavault entity: sensor.omv_disk_3
2024-04-06 21:49:31.231 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up openmediavault.binary_sensor
2024-04-06 21:49:31.238 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.openmediavault entity: binary_sensor.omv_system_update_available
2024-04-06 21:49:31.242 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.openmediavault entity: binary_sensor.omv_system_reboot_pending
2024-04-06 21:49:31.246 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.openmediavault entity: binary_sensor.omv_system_config_dirty
2024-04-06 21:50:17.313 WARNING (MainThread) [homeassistant.components.command_line] Updating Command Line Sensor Internet Usage took longer than the scheduled update interval 0:00:05
2024-04-06 21:50:37.201 WARNING (SyncWorker_36) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.43.54 unable to fetch data (500)
2024-04-06 21:50:49.462 WARNING (MainThread) [homeassistant.components.command_line] Updating Command Line Sensor Internet Usage took longer than the scheduled update interval 0:00:05
2024-04-06 21:51:42.514 WARNING (SyncWorker_28) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.43.54 unable to fetch data (500)
sejrbajer commented 7 months ago

Any info on how to fix it or what the issue is? Getting the same "unable to fetch data (500)"

sharn25 commented 7 months ago

No able to fix it. Still same issue

xxLeoxx93 commented 6 months ago

@akyjoe Did you manage to fix your issue? I'm having the same problem...

Update: Fixed it, was a network error. But I still have missing CPU Temp and CPU Usage stays at 0 :(

kdw2060 commented 5 months ago

@tomaae as I'm having the same issue I started to write my own script to make the rpc api calls. This is working fine, but one issue I do have is that I can't figure out how to keep a session alive. As you're more familiar with the OMV api and there's no official documentation (only still the old 4.0 docs): Could you please explain the process one should use to keep a login session alive?

When executing the Session.login request you get a sessionid value back in the response. I guess that with subsequent requests like the System.getInformation I need to pass this value as a header or a param? And do you need to renew this acquired sessionid every x minutes? And if so, how?

akyjoe commented 5 months ago

@akyjoe Did you manage to fix your issue? I'm having the same problem...

Update: Fixed it, was a network error. But I still have missing CPU Temp and CPU Usage stays at 0 :(

Yes, it managed to create the various entities in my HA v2024.6.2. But still no luck in updating sensor data. Here's the debug info from logger:

`This error originated from a custom integration.

Logger: custom_components.openmediavault.omv_api Source: custom_components/openmediavault/omv_api.py:302 integration: OpenMediaVault (documentation, issues) First occurred: 11:43:40 AM (58 occurrences) Last logged: 12:18:06 PM

OpenMediaVault xx.xx.xx.xx unable to fetch data (500)`

image

tomaae commented 5 months ago

@tomaae as I'm having the same issue I started to write my own script to make the rpc api calls. This is working fine, but one issue I do have is that I can't figure out how to keep a session alive. As you're more familiar with the OMV api and there's no official documentation (only still the old 4.0 docs): Could you please explain the process one should use to keep a login session alive?

When executing the Session.login request you get a sessionid value back in the response. I guess that with subsequent requests like the System.getInformation I need to pass this value as a header or a param? And do you need to renew this acquired sessionid every x minutes? And if so, how?

Yea, you need to save cookie after login in and and resend it every time. Also send in options {"updatelastaccess": True} when sending a query. Not sure what a connection timeout is tho. No documentation is really causing issues with OMV.

For disappearing entities, just look into HA log. You will see where it fails.

nasked commented 5 months ago

I have the same problem. Integration is connected with OMV without no problem. Este error se originó a partir de una integración personalizada.

Log Detail:

Registrador: custom_components.openmediavault.omv_api Fuente: custom_components/openmediavault/omv_api.py:302 integración: OpenMediaVault (documentación, problemas) Ocurrió por primera vez: 25 de junio de 2024, 01:39:54 (3599 ocurrencias) Último inicio de sesión: 15:32:58

OpenMediaVault xx.xx.xx.xx unable to fetch data (500) OpenMediaVault xx.xx.xx.xx unable to fetch data (504)

I can use Glances docker but i prefer omv ha integration. We'll wait for a while...

sezlony commented 4 months ago

just installed this integration and I can confirm, that it does not work with omv7

2024-07-15 10:00:51.689 DEBUG (SyncWorker_22) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.2 connected
2024-07-15 10:00:51.897 DEBUG (SyncWorker_8) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.2 connected
2024-07-15 10:00:51.899 DEBUG (SyncWorker_8) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.2 query: System, getInformation, {}, {'updatelastaccess': True}
2024-07-15 10:00:51.942 DEBUG (SyncWorker_8) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.2 query response: {'response': {'ts': 1721030451, 'time': 'Mon 15 Jul 2024 10:00:51 AM CEST', 'hostname': 'redacted'}, 'error': None}
2024-07-15 10:00:51.943 DEBUG (SyncWorker_8) [custom_components.openmediavault.apiparser] Processing source [{'ts': 1721030451, 'time': 'Mon 15 Jul 2024 10:00:51 AM CEST', 'hostname': 'redacted'}]
2024-07-15 10:00:51.943 DEBUG (SyncWorker_8) [custom_components.openmediavault.apiparser] Processing entry {'ts': 1721030451, 'time': 'Mon 15 Jul 2024 10:00:51 AM CEST', 'hostname': 'redacted'}
2024-07-15 10:00:51.945 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry OMV for openmediavault
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/openmediavault/__init__.py", line 34, in async_setup_entry
    await controller.async_hwinfo_update()
  File "/config/custom_components/openmediavault/omv_controller.py", line 150, in async_hwinfo_update
    await self.hass.async_add_executor_job(self.get_hwinfo)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/openmediavault/omv_controller.py", line 244, in get_hwinfo
    if int(self.data["hwinfo"]["version"].split(".")[0]) > 5:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'unknown'
tomaae commented 4 months ago

can you post debugs?

sharn25 commented 4 months ago

Attached the debug logs. 2024-07-23_OMV_debug.log

kdw2060 commented 4 months ago

~~ For those that run a HA installation that allows for the installation of add-ons: you can try the workaround omvConsumer script I made (because sadly still experiencing this issue with the integration) via my api consumer add-on.

Upon installing the add-on a file called example-omvConsumer.js should be found in the share folder of your Home Assistant installation. You need to fill in your url, username and password for OMV on lines 12-14. If wanted you can adapt the different api-calls further down in the file to your liking as well. Next set example-omvConsumer or whatever name you gave the file in the api consumer add-on configuration.

If all works well you will get a bunch of sensors starting with omv_ that contain the OMV information in a data attribute. You need knowledge of HA's templating syntax to use that data. Either use a template string (e.g. {{states['sensor.omv_info'].attributes.data.uptime}}) directly inside a card or create template sensors / helpers to translate a data attribute value to a sensor if you need this for the card you want to use.

btw, I cannot provide support, I presume you're familiar with HA templating and some javascript ~~

UPDATE/EDIT Actually, forget all off the above. Feel stupid to not have tested this earlier. To get my workaround script to work I needed to create a bridge network in OMV because HA is running inside a VM. Creating that bridge network also solved the issue with the integration because of course it ran into the same issue of not being able to communicate outside the VM otherwise. I guess this might be the root cause for other users here too.

Consult the OMV-extras manual section on creating a br0 bridge network

sezlony commented 4 months ago

meanwhile I managed to install it (did nothing differently than before) and works fine!

only problem is that CPU load constantly shows 0%, although loadavarage1/5/15 attributes have their respective values

github-actions[bot] commented 3 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.

sharn25 commented 3 months ago

Hi Everyone, My issue was resolved.

I did reinstallation of OMV and it started working

Thanks

sezlony commented 3 months ago

I did reinstallation of OMV and it started working

does the CPU load sensor work also?

rofo69 commented 3 months ago

I'm running latest HA (2024.8.2) and OMV HACs verision 1.4.2. It kinda works. Every 60 seconds I see a tiny blip in my entity history with the correct value, but it only last about a second or so, before the entity goes to unavailable for the remaining 59 seconds:-

image

I can work around it by creating a template sensor to hide the unavailable ones, but would be far less work to see if this can be fixed ;)

FuturamaPhill commented 3 months ago

was this issue ever resolved? I still get the "no response from host" when trying to setup in HA

Arie046 commented 2 months ago

Hello

I cannot connect to OMV with HA

Error Message:

ome Assistant Core 2024-08-24 10:27:29.348 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry OMV for openmediavault

File “/config/custom_components/openmediavault/omv_controller.py”, line 150, in async_hwinfo_update

File “/config/custom_components/openmediavault/omv_controller.py”, line 244, in get_hwinfo

2024-08-24 11:21:53.275 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry OMV for openmediavault

File “/config/custom_components/openmediavault/omv_controller.py”, line 150, in async_hwinfo_update

File “/config/custom_components/openmediavault/omv_controller.py”, line 244, in get_hwinfo

2024-08-24 11:22:03.695 DEBUG (SyncWorker_10) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.10 connected

2024-08-24 11:22:03.704 DEBUG (SyncWorker_10) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.10 query: System, getInformation, {}, {‘updatelastaccess’: True}

2024-08-24 11:22:03.787 DEBUG (SyncWorker_10) [custom_components.openmediavault.omv_api] OpenMediaVault 192.168.1.10 query response: {‘response’: {‘ts’: 1705660847, ‘time’: ‘Fri Jan 19 10:40:47 2024’, ‘hostname’: ‘cameraopslag’}, ‘error’: None}

2024-08-24 11:22:03.788 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry OMV for openmediavault

File “/config/custom_components/openmediavault/omv_controller.py”, line 150, in async_hwinfo_update

File “/config/custom_components/openmediavault/omv_controller.py”, line 244, in get_hwinfo

WhyNine commented 2 months ago

I also have the Error 500 issue. I have just installed OMV on one device (Raspberry Pi) and have HA running in a container on a second device (another Pi), on the same network. When configuring the plug-in, it won't accept the hostname of the Pi but is happy with the IP address. I assume that this means that it can communicate with the Pi. But all the entities are Unavailable.

WhyNine commented 2 months ago

I also have the Error 500 issue. I have just installed OMV on one device (Raspberry Pi) and have HA running in a container on a second device (another Pi), on the same network. When configuring the plug-in, it won't accept the hostname of the Pi but is happy with the IP address. I assume that this means that it can communicate with the Pi. But all the entities are Unavailable.

In the log, I can see that OMV is communicating with my server ok and retrieving some information. But it stops after a series of queries wih the last one being: query: Smart, getAttributes, {'devicefile': '/dev/sda'}, {'updatelastaccess': True} OMV then reports "unable to fetch data (500)"

github-actions[bot] commented 1 month 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.

fumantsu commented 1 month ago

bump

iceluci0 commented 4 weeks ago

Any news about this issue? I'm able to add the OMV component using MY_IP:9443 and reading the log with debug enabled, a lots of values are collected (I can see lots of DEBUG (SyncWorker_14) [custom_components.openmediavault.apiparser] Processing entry {... }

After all these events a few sensor should be updated:

2024-11-02 18:56:52.499 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-system_cpuUsage
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-system_memUsage
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-system_uptimeEpoch
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-disk-nvme0n1
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-disk-sda
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-system_pkgUpdatesAvailable
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-system_rebootRequired
2024-11-02 18:56:52.500 DEBUG (MainThread) [custom_components.openmediavault.model] Updating entity OMV-system_configDirty

In the end, only an infinite list of 2024-11-02 18:57:52.511 WARNING (SyncWorker_25) [custom_components.openmediavault.omv_api] OpenMediaVault MY_IP:9443 unable to fetch data (500)

Surrogard commented 6 days ago

I had the same problem and the reason was me. I added a ssl certificate and enabled forcing ssl/tls. Setting up the HA addon with ssl but disabling certificate check (it's a self signed one) fixed it. The CPU load is still constantly 0% even though OMV shows usage