tomaae / homeassistant-truenas

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

[Question] TrueNAS Integration Polling #30

Closed applegeeks closed 2 years ago

applegeeks commented 2 years ago

I noticed that the polling for TrueNas entity data doesn't occur very frequent. If I manually reload the integration or restart HA, the TrueNas value updates.

Question.

  1. What's the current polling interval for the TrueNas integration?
  2. Can it be manually modified/configured?
tomaae commented 2 years ago

Polling interval is 60 seconds. If its not updating, look into your HA logs for any errors.

applegeeks commented 2 years ago

@tomaae thanks for confirming. I’ll go and check the logs.

applegeeks commented 2 years ago

@tomaae Based on the logs, it is polling every 60 seconds as mentioned.

2022-06-29 19:23:36 DEBUG (SyncWorker_6) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query: cloudsync, get, {}
2022-06-29 19:23:36 DEBUG (SyncWorker_6) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query response: []
2022-06-29 19:23:36 DEBUG (SyncWorker_3) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query: replication, get, {}
2022-06-29 19:23:36 DEBUG (SyncWorker_3) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query response: []
2022-06-29 19:23:36 DEBUG (SyncWorker_1) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query: pool/snapshottask, get, {}
2022-06-29 19:23:36 DEBUG (SyncWorker_1) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query response: []
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_uptime
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_cpu_temperature
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_load_shortterm
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_load_midterm
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_load_longterm
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_cpu_usage
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_cache_size-arc_value
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_cache_size-L2_value
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_cache_ratio-arc_value
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-system_cache_ratio-L2_value
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup/files-nas
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup/ha2-disk
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup/pihole2-disk
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup-2
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup-2/backup-nas
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-dataset-backup-2/games
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-disk-ada3
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-disk-ada2
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-disk-ada1
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-disk-ada0
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-disk-ada5
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-disk-ada4
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-pool_free-648738822107063598
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-pool_free-3606036272491555606
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-pool_free-8082473567402200373
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-traffic_rx-re0
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-traffic_tx-re0
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-pool_healthy-648738822107063598
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-pool_healthy-3606036272491555606
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-pool_healthy-8082473567402200373
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-vm-3
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-vm-4
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-2
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-4
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-5
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-6
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-7
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-9
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-10
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-11
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-12
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-14
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-16
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-18
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-21
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-22
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-23
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-24
2022-06-29 19:23:36 DEBUG (MainThread) [custom_components.truenas.model] Updating entity TrueNAS-service-25
2022-06-29 19:23:40 INFO (SyncWorker_0) [root] Sending handshake.

However, the entity values and the "last updated" field for each entity does not reflect/update in the HA dashboard post the 60 second polling.

I am assuming because of the error from the log below

2022-06-29 19:18:52 DEBUG (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query: system/info, get, {}
2022-06-29 19:18:52 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 unable to fetch data (401)
2022-06-29 19:18:52 DEBUG (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 query: interface, get, {}
2022-06-29 19:18:52 WARNING (SyncWorker_0) [custom_components.truenas.truenas_api] TrueNAS 10.0.10.5 unable to fetch data (401)

I have deleted the integration and re-added it with new api keys from truenas but still get the 401 error. Any further ideas?

_I went and done the steps below

Now no longer getting the unable to fetch data (401) error but the the original issue of the "Last Updated" field on the HA dashboard indicates a last update/refresh rate of >1minute ago

tomaae commented 2 years ago

strange. cant imagine how files would get corrupted. watch it for a bit and we will see if error is cleared.

applegeeks commented 2 years ago

The unable to fetch data (401) error no longer appears after performing the steps below

I went and done the steps below delete all true nas entities delete integration restart HA and Truenas create anew api key with a different name rather than generating a new key configured HA integration

The original issue of the "Last Updated" field on the HA dashboard indicates a last update/refresh rate of >1minute ago (since the time the integration was restarted or ha was restarted).

I can see that the values are getting received and processed.

2022-06-29 19:37:36 DEBUG (SyncWorker_7) [custom_components.truenas.apiparser] Processing entry {'identifier': '{serial_lunid}WD-WM...

Just can't understand why the actual values arent being represented on the HA Dashboard (Highlighted the vm's here but even the HDD temperature,etc...shows the same aged last update time and I would think these values update more frequent than the vm status values)

image

image

applegeeks commented 2 years ago

Running HA OVA btw Version core-2022.6.7 Home Assistant OS 8.2

tomaae commented 2 years ago

last updated wont change if value is the same. that may be the reason. turn on that VM and see if it changes.

applegeeks commented 2 years ago

ok. It appears to be working and updating now. It seems the initial "unable to fetch data (401)" error I encountered may have been the original problem.

After that was fixed, the values are now updating when the value changes (as you mentioned).

Thanks again! And nice job on this integration!! Loving it

tomaae commented 2 years ago

good to hear its solved now :)