Closed CZonin closed 5 months ago
Anyone else experiencing this? Still happening as of 2024.5.3
Anyone else experiencing this? Still happening as of 2024.5.3
Yes, I am experiencing this same issue exactly as you described.
Anyone else experiencing this? Still happening as of 2024.5.3
Yes, I am experiencing this same issue exactly as you described.
Okay, glad to hear it's not something on my end. Really hope it gets fixed, I rely on this integration for a few automations.
Adding a +1 here
I was so happy when I found this, but yeah, my entities are unavailable now :(
@itchannel I don't mean to bug you, but is this integration still in development?
Yes it is I've just been ridiculously busy so haven't got round to taking a look.
When you say entities are going unavailable is it all of them including the tdarr server or just the individual nodes?
Also can you each please provide the following info:
As I'm not seeing the same issue on my instance so it's making it hard to diagnose why. Also if you have any errors in your HA logs can you please post them π
Yes it is I've just been ridiculously busy so haven't got round to taking a look.
When you say entities are going unavailable is it all of them including the tdarr server or just the individual nodes?
Also can you each please provide the following info:
- Tdarr server version
- Tdarr node version
- Home assistant version
As I'm not seeing the same issue on my instance so it's making it hard to diagnose why. Also if you have any errors in your HA logs can you please post them π
No problem!
Everything on my end is unavailable.
This started happening after updating HA to 2024.4.1 while Tdarr node + server were version 2.17.01 and has persisted to the versions above.
Pretty sure the only thing that shows in logs after enabling debug logging is:
Logger: homeassistant.config_entries
Source: config_entries.py:772
First occurred: 5:38:49 PM (1 occurrences)
Last logged: 5:38:49 PM
Error unloading entry Tdarr Server (192.168.86.214) for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 772, in async_unload
result = await component.async_unload_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 140, in async_unload_entry
return await component.async_unload_entry(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 203, in async_unload_entry
raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
Yes it is I've just been ridiculously busy so haven't got round to taking a look. When you say entities are going unavailable is it all of them including the tdarr server or just the individual nodes? Also can you each please provide the following info:
- Tdarr server version
- Tdarr node version
- Home assistant version
As I'm not seeing the same issue on my instance so it's making it hard to diagnose why. Also if you have any errors in your HA logs can you please post them π
No problem!
Everything on my end is unavailable.
* Tdarr server 2.18.02 * Tdarr node 2.18.02 * Home Assistant 2024.5.4
This started happening after updating HA to 2024.4.1 while Tdarr node + server were version 2.17.01 and has persisted to the versions above.
Pretty sure the only thing that shows in logs after enabling debug logging is:
Logger: homeassistant.config_entries Source: config_entries.py:772 First occurred: 5:38:49 PM (1 occurrences) Last logged: 5:38:49 PM Error unloading entry Tdarr Server (192.168.86.214) for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 772, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 140, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 203, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!
Interestingly you are running the exact same versions as me and mine hasn't gone unavailable in months. Is your Tdarr server always up or do you turn it off every so often?
The error seems to indicate that a config entry wasn't loaded correctly. If you have time could you please try removing the integration completely and then re-adding it.
I've also set it up on my dev instance to see if I can replicate the error in the meantime.
Also try swapping out the reload_tasks lines with:
reload_tasks = []
if len(current_entries) > 0:
for entry in current_entries:
_LOGGER.debug(entry.entry_id)
reload_tasks.append(
self._hass.config_entries.async_reload(entry.entry_id)
)
if len(reload_tasks) > 0:
await asyncio.gather(*reload_tasks)
Just added some debugging and some extra checks.
Interestingly you are running the exact same versions as me and mine hasn't gone unavailable in months. Is your Tdarr server always up or do you turn it off every so often?
Server is always up, but I have a node on a separate PC that turns on/off every day.
The error seems to indicate that a config entry wasn't loaded correctly. If you have time could you please try removing the integration completely and then re-adding it.
Did this after I first started noticing the issue, but still having the same problem.
Also try swapping out the reload_tasks lines with:
reload_tasks = [] if len(current_entries) > 0: for entry in current_entries: _LOGGER.debug(entry.entry_id) reload_tasks.append( self._hass.config_entries.async_reload(entry.entry_id) ) if len(reload_tasks) > 0: await asyncio.gather(*reload_tasks)
Just added some debugging and some extra checks.
How can I make this change on my end?
Interestingly you are running the exact same versions as me and mine hasn't gone unavailable in months. Is your Tdarr server always up or do you turn it off every so often?
Server is always up, but I have a node on a separate PC that turns on/off every day.
The error seems to indicate that a config entry wasn't loaded correctly. If you have time could you please try removing the integration completely and then re-adding it.
Did this after I first started noticing the issue, but still having the same problem.
Also try swapping out the reload_tasks lines with:
reload_tasks = [] if len(current_entries) > 0: for entry in current_entries: _LOGGER.debug(entry.entry_id) reload_tasks.append( self._hass.config_entries.async_reload(entry.entry_id) ) if len(reload_tasks) > 0: await asyncio.gather(*reload_tasks)
Just added some debugging and some extra checks.
How can I make this change on my end?
First of can you add this to your configuration.yaml so debug logging is always on for the integration
logger:
default: warning
logs:
custom_components.tdarr: debug
Second if you go to "custom_components/tdarr/init.py" then go to line 178 and swap the below code:
reload_tasks = [
self._hass.config_entries.async_reload(entry.entry_id)
for entry in current_entries
]
await asyncio.gather(*reload_tasks)
with
reload_tasks = []
if len(current_entries) > 0:
for entry in current_entries:
_LOGGER.debug(entry.entry_id)
reload_tasks.append(
self._hass.config_entries.async_reload(entry.entry_id)
)
if len(reload_tasks) > 0:
await asyncio.gather(*reload_tasks)
Then restart your HA instance. That should then log any errors to the console and hopefully we can identify what is going wrong.
On my instance it handles nodes going off/on without erroring so it's really hard to replicate currently. Also can I ask how long does it take before the sensors go unavailable?
Okay just made all of those changes, will report back.
On my instance it handles nodes going off/on without erroring so it's really hard to replicate currently. Also can I ask how long does it take before the sensors go unavailable?
It doesn't seem to be a consistent amount of time.
Getting errors on startup:
Logger: homeassistant.util.loop
Source: util/loop.py:70
First occurred: 7:06:06 PM (1 occurrences)
Last logged: 7:06:06 PM
Detected blocking call to import_module with args ('custom_components.tdarr',) in /usr/src/homeassistant/homeassistant/loader.py, line 1041: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop
Logger: homeassistant.loader
Source: loader.py:1041
First occurred: 7:06:06 PM (2 occurrences)
Last logged: 7:06:06 PM
Unexpected exception importing component custom_components.tdarr
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1041, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 991, in exec_module
File "<frozen importlib._bootstrap_external>", line 1129, in get_code
File "<frozen importlib._bootstrap_external>", line 1059, in source_to_code
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/tdarr/__init__.py", line 178
reload_tasks = []
IndentationError: unexpected indent
Logger: homeassistant.setup
Source: setup.py:322
First occurred: 7:06:06 PM (1 occurrences)
Last logged: 7:06:06 PM
Setup failed for custom integration 'tdarr': Unable to import component: Exception importing custom_components.tdarr
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1041, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 991, in exec_module
File "<frozen importlib._bootstrap_external>", line 1129, in get_code
File "<frozen importlib._bootstrap_external>", line 1059, in source_to_code
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/tdarr/__init__.py", line 178
reload_tasks = []
IndentationError: unexpected indent
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 981, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1052, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.tdarr
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1041, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 991, in exec_module
File "<frozen importlib._bootstrap_external>", line 1129, in get_code
File "<frozen importlib._bootstrap_external>", line 1059, in source_to_code
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/tdarr/__init__.py", line 178
reload_tasks = []
IndentationError: unexpected indent
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1001, in async_get_component
self._component_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 993, in async_get_component
comp = self._get_component()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1052, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.tdarr
Sounds like when you copied the code in it wasn't alignment. Please ensure it's aligned like below.
Sounds like when you copied the code in it wasn't alignment. Please ensure it's aligned like below.
Had a feeling that was it. Just fixed and it loaded properly. I'll update when I have something in logs.
Just wanted to chime in here. I'm running the same versions:
Tdarr server 2.18.02
Tdarr node 2.18.02
Home Assistant 2024.5.4
I've noticed my entities become unavailable when my PC with the Tdarr node turns off, even though the logs say it succeeded:
2024-05-23 14:51:48.227 DEBUG (MainThread) [custom_components.tdarr] 2
2024-05-23 14:51:48.227 DEBUG (MainThread) [custom_components.tdarr] Node Change Detected config reload required
2024-05-23 14:51:48.228 DEBUG (MainThread) [custom_components.tdarr] 8be0d5d6a13fd7395f5d12b18ca1b7aa
2024-05-23 14:51:48.241 DEBUG (MainThread) [custom_components.tdarr] Finished fetching tdarr data in 0.041 seconds (success: True)
My sensor entities go unavailable after this and there are no more logs. (Switch entities still work, other than the node that is disconnected)
I also have a node on a separate computer that is on a schedule. It also goes hibernates with inactivity. I tried a few things and I can replicate this error:
1) Start with everything working. 2) Set Windows to sleep mode on the computer running the separate node. 3) Wait a few minutes and everything will go unavailable. 4) Waking the PC does not resolve it. 5) Reloading the integration does not resolve it. 6) Restarting the Tdarr server does not resolve it. 7) Restarting Home Assistant brings everything back online.
I can also replicate this another way. I run Tdarr on Unraid with a container for the Tdarr server and another for the Tdarr node.
1) Start with everything working. 2) Stop the Tdarr node Docker container. 3) Wait a few minutes and everything will go unavailable. 4) Starting the node container back up does not resolve it. 5) Reloading the integration does not resolve it. 6) Restarting the Tdarr server does not resolve it. 7) Restarting Home Assistant brings everything back online.
Thanks for everyones input. I think I've finally narrowed it down.
Anyone free to try the Beta version before I tidy up and commit to Main branch.
https://github.com/itchannel/tdarr_ha/releases/tag/1.14-Beta2
Can update by setting Beta checkbox in Hacs :)
Perfect, just tested out the 1.14-Beta2 on my setup.
Followed the steps like putting the Windows PC (running the separate node) to sleep and everything.
When the PC went to sleep, only the entities related to that node became unavailable, which is exactly what I'd expect. And yep, they came back up when I woke the PC. Looks like everything's working perfectly on my end!
Perfect, just tested out the 1.14-Beta2 on my setup.
Followed the steps like putting the Windows PC (running the separate node) to sleep and everything.
When the PC went to sleep, only the entities related to that node became unavailable, which is exactly what I'd expect. And yep, they came back up when I woke the PC. Looks like everything's working perfectly on my end!
Great thanks for confirming.
1.14-Release has now been pushed live. This should fix the issue in this thread.
Over the coming days I hope to do some code refactoring if I can find time :)
Thanks for the update @itchannel ! I'll test it throughout the day and report back if there's any issues.
@itchannel One thing I've noticed so far after the new version is that it doesn't seem like the staged files sensor is updating. I don't remember this happening in the previous version.
I'm not sure if this is related to this issue. Let me know if you want me to open a new one.
@itchannel One thing I've noticed so far after the new version is that it doesn't seem like the staged files sensor is updating. I don't remember this happening in the previous version.
* I had a new file in queue, and the queue sensor updated from 0 -> 1 * I turned on my node and the file moved to staged, but the staged sensor stayed at 0 * The file finished transcoding and the queue sensor changed from 1 -> 0 * The staged sensor never changed from 0 * The space saved sensor updated with the new total space saved
I'm not sure if this is related to this issue. Let me know if you want me to open a new one.
Good spot. 1.15 should address the bug π
Closing this thread as the issue should now be resolved. If anyone encounters anymore bugs or features requests please open up a new issue.
Closing this thread as the issue should now be resolved. If anyone encounters anymore bugs or features requests please open up a new issue.
Thanks for the quick fixes, really appreciate it!
I've noticed that after updating HA to 2024.4.1 that my tdarr entities become unavailable. If I do a restart they all work for awhile but eventually all show as unavailable.
I enabled debug logging and saw this: