Closed jonasgustavsson closed 2 months ago
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
This issue persists.
I have the same issue, fresh install HA container 2023.10.3
Logger: homeassistant.setup Source: setup.py:288 First occurred: 20:18:10 (1 occurrences) Last logged: 20:18:10
Error during setup of component tplink_lte Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tplink_lte/init.py", line 97, in async_setup await asyncio.wait(tasks) File "/usr/local/lib/python3.11/asyncio/tasks.py", line 415, in wait raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") TypeError: Passing coroutines is forbidden, use tasks explicitly.
Same here, it still has not been fixed. If anyone knows another add-on to send SMS over the TP-Link LTE Router I'm listening.
Logger: homeassistant.setup Source: setup.py:288 First occurred: 17:28:26 (1 occurrences) Last logged: 17:28:26
Error during setup of component tplink_lte Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tplink_lte/init.py", line 97, in async_setup await asyncio.wait(tasks) File "/usr/local/lib/python3.11/asyncio/tasks.py", line 425, in wait raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") TypeError: Passing coroutines is forbidden, use tasks explicitly.
Eperiencing same issue on 2023.11.3
Logger: homeassistant.setup Source: setup.py:288 First occurred: 2:42:29 PM (1 occurrences) Last logged: 2:42:29 PM Error during setup of component tplink_lte
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tplink_lte/init.py", line 97, in async_setup await asyncio.wait(tasks) File "/usr/local/lib/python3.11/asyncio/tasks.py", line 425, in wait raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") TypeError: Passing coroutines is forbidden, use tasks explicitly.
Same here
Same here, please any support?
Surprising that for a built-in integration, no one even responds to the problem!
Surprising that for a built-in integration, no one even responds to the problem!
Considering that it should be quite easy. Every integration had to have that boilerplate code fixed and I guess there's even an article on how to do it. I don't have a development environment for home assistant set up though and don't have time to fix it myself. Also, the patch submission process seems to be a bit involved.
But yeah, that's a 5 minute fix for a core developer.
But yeah, that's a 5 minute fix for a core developer.
My thoughts exactly. Interestingly enough, looking in the code repo, the init.py was updated only 2 months ago. I know its not directly linked, but maybe we could ask Marc Mueller @cdce8p (who updated the above file) to have a look at this.
Please don't tag contributors just because they change a related file at some point. E.g. I my case it was just a mypy update.
However, I did take a look and it should be a fairly simple fix. Opened #107642. I can't validate it, so if you're able feel free to test it out.
I'm really sorry for tagging you. I can't thank you enough for taking a look. Will this change make it into 2024.1.3? If not - how do I go about testing it in development? I see you've made one change to homeassistant/components/tplink_lte/init.py
cd /config
curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d tplink_lte -p 107642
It will install it as custom component. Please remove when 2024.1.3 is released
After updating it was more promising. but now it comes up with it can't find modem
Logger: custom_components.tplink_lte.notify Source: custom_components/tplink_lte/notify.py:42 Integration: TP-Link LTE First occurred: 21:23:09 (3 occurrences) Last logged: 21:24:47
No modem available
TP-Link Archer MR200 Firmware Version:1.1.0 0.9.1 v0001.0 Build 220513 Rel.40397n Hardware Version:Archer MR200 v5.3 00000001 IMEI:866501047012489
@paarak I don't have the hardware so it's a bit more difficult for me to debug. Would you mind checking if the host
address in the config is correct? Please also try a restart and / or completely removing + restart + adding the config again.
Hello @cdce8p . tp-link responds to ping and config is correct. But maybe my tp-link is not compatible. I sent an sms from the gui on tp-link and it works.
Is there a setting I have to turn on in tp-link so HA has access rights to send sms?
cd /config curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d tplink_lte -p 107642
It will install it as custom component. Please remove when 2024.1.3 is released
@maweki or any others, have you tried this fix like @paarak has - with any success? (I personally haven't tried it, I'm waiting for 2024.1.3).
@paarak Sorry but as I said, I don't have access to a TP-Link device so can test it myself. The only info I have is from looking at the source code. Maybe someone else here knows more?
But maybe my tp-link is not compatible
The readme of the underlying library only mentions that it's tested with TP-Link TL-MR6400
. Not sure if you're device would work the same.
https://github.com/andtos90/tp-connected
Thank you @cdce8p for trying to take this fix on. I was using the integration before it broke, and I still have the setup with the TP-Link TL-MR6400 hardware. It's located in my cottage many hours from where I live and doing an important job of keeping my water pipes from freezing. So I am not touching that HA instance unless I am forced to. Too much at risk. But sooner or later I will be visiting the cottage, and then I will try it out if no one else have yet. But that might be months from now unfortunately.
@paarak
Is there a setting I have to turn on in tp-link so HA has access rights to send sms?
From my memory when I did the setup: No. I think I would have added it into the docs (https://www.home-assistant.io/integrations/tplink_lte) in that case. (Even if I'm not a code I still try to contribute by improving the HA docs whenever I can).
So I do have a TP-Link TL-MR6400 with a current firmware. My router is also in a garden plot, but it's not too high stakes if something breaks. It also never worked for me, as I only set this stuff up this summer.
Anyway, I do also get the "no modem" found message with the custom component. Then I tried the original library and it seems to no longer work with the current firmware. The lib is unable to login to the router webinterface.
I don't know where we would go from there.
I am encountering the same issue with a MR500 I am first getting this error when starting HA
This error originated from a custom integration.
Logger: tp_connected.tp_connected Source: custom_components/tplink_lte/init.py:137 Integration: TP-Link LTE First occurred: 9:03:01 PM (1 occurrences) Last logged: 9:03:01 PM
Invalid encryption key request
When sending an SMS the following error appears
This error originated from a custom integration.
Logger: custom_components.tplink_lte.notify Source: custom_components/tplink_lte/notify.py:42 Integration: TP-Link LTE First occurred: 9:03:41 PM (1 occurrences) Last logged: 9:03:41 PM
No modem available
I started all over with a new config and I am now getting the following error
home-assistant | 2024-01-11 21:36:52.702 ERROR (MainThread) [homeassistant.setup] Error during setup of component tplink_lte home-assistant | Traceback (most recent call last): home-assistant | File "/usr/src/homeassistant/homeassistant/setup.py", line 332, in _async_setup_component home-assistant | result = await task home-assistant | ^^^^^^^^^^ home-assistant | File "/config/custom_components/tplink_lte/init.py", line 97, in async_setup home-assistant | await asyncio.gather(*tasks) home-assistant | File "/config/custom_components/tplink_lte/init.py", line 122, in _setup_lte home-assistant | await _login(hass, modem_data, password) home-assistant | File "/config/custom_components/tplink_lte/init.py", line 137, in _login home-assistant | await modem_data.modem.login(password=password) home-assistant | File "/usr/local/lib/python3.11/site-packages/tp_connected/tp_connected.py", line 130, in login home-assistant | await self.encryptCredentials(password, username) home-assistant | File "/usr/local/lib/python3.11/site-packages/tp_connected/tp_connected.py", line 114, in encryptCredentials home-assistant | _LOGGER.debug("ee: {0} nn: {1}".format(ee, nn)) home-assistant | ^^ home-assistant | UnboundLocalError: cannot access local variable 'nn' where it is not associated with a value
tplink_lte:
This my config:
Same issue...
Core 2024.2.1 Supervisor 2024.01.1 Operating System 11.5 Interface utilisateur 20240207.1
Here is the log details:
Logger: homeassistant.setup Source: setup.py:251 First occurred: 11:01:13 (1 occurrences) Last logged: 11:01:13
Setup failed for 'tplink_lte': Unable to import component: Exception importing homeassistant.components.tplink_lte
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 827, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
KeyError: 3
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 835, in get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.tplink_lte
Alright sounds like a js2py issue (with Python 3.12)...
https://github.com/PiotrDabkowski/Js2Py/issues/317 https://github.com/dknowles2/ha-pitboss/issues/42
I rolled back to 2024.1.6 and still have an error...
The installation works well but the "No modem" error occurs.
2024-02-10 12:09:11.843 INFO (MainThread) [tp_connected.tp_connected] http://192.168.xxxx/cgi/getParm 2024-02-10 12:09:12.064 ERROR (MainThread) [tp_connected.tp_connected] Invalid encryption key request 2024-02-10 12:09:12.073 WARNING (MainThread) [homeassistant.components.tplink_lte] Could not connect to 192.168.xxx. Will keep trying
2024-02-10 12:09:12.064 ERROR (MainThread) [tp_connected.tp_connected] Invalid encryption key request
Same issue now for me. It looks also that for TP-LINK even if its same model (ex MR6400) it also differ in its versioning. In another thread there is a custom repo that worked for MR6400 v4.x.x but doesnt work for MR6400 v5.x.x
Alright, I've now been visiting my two houses that each have a MR6400 (v 4.x.x. and v5.x.x) and updated both Home Assistant instances in each house to 2024.3.3. I have been able to run the integration before successfully with this setup, before it broke (and I opened this bug). I regret to inform you that the @cdce8p attempt to blind-fix this did not work out.
I now get a new error:
2024-03-31 09:17:15.508 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.tplink_lte
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 921, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/tplink_lte/__init__.py", line 10, in <module>
import tp_connected
File "/usr/local/lib/python3.12/site-packages/tp_connected/__init__.py", line 1, in <module>
from .tp_connected import Modem, Error
File "/usr/local/lib/python3.12/site-packages/tp_connected/tp_connected.py", line 11, in <module>
from .tp_link_encryption import tp_link_encryption
File "/usr/local/lib/python3.12/site-packages/tp_connected/tp_link_encryption.py", line 5, in <module>
from js2py.pyjs import *
File "/usr/local/lib/python3.12/site-packages/js2py/__init__.py", line 72, in <module>
from .base import PyJsException
File "/usr/local/lib/python3.12/site-packages/js2py/base.py", line 2965, in <module>
@Js
^^
File "/usr/local/lib/python3.12/site-packages/js2py/base.py", line 165, in Js
return PyJsFunction(val, FunctionPrototype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/js2py/base.py", line 1377, in __init__
cand = fix_js_args(func)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/js2py/utils/injector.py", line 27, in fix_js_args
code = append_arguments(six.get_function_code(func), ('this', 'arguments'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/js2py/utils/injector.py", line 121, in append_arguments
arg = name_translations[inst.arg]
~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 3
2024-03-31 09:17:15.561 ERROR (MainThread) [homeassistant.setup] Setup failed for 'tplink_lte': Unable to import component: Exception importing homeassistant.components.tplink_lte
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 921, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/tplink_lte/__init__.py", line 10, in <module>
import tp_connected
File "/usr/local/lib/python3.12/site-packages/tp_connected/__init__.py", line 1, in <module>
from .tp_connected import Modem, Error
File "/usr/local/lib/python3.12/site-packages/tp_connected/tp_connected.py", line 11, in <module>
from .tp_link_encryption import tp_link_encryption
File "/usr/local/lib/python3.12/site-packages/tp_connected/tp_link_encryption.py", line 5, in <module>
from js2py.pyjs import *
File "/usr/local/lib/python3.12/site-packages/js2py/__init__.py", line 72, in <module>
from .base import PyJsException
File "/usr/local/lib/python3.12/site-packages/js2py/base.py", line 2965, in <module>
@Js
^^
File "/usr/local/lib/python3.12/site-packages/js2py/base.py", line 165, in Js
return PyJsFunction(val, FunctionPrototype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/js2py/base.py", line 1377, in __init__
cand = fix_js_args(func)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/js2py/utils/injector.py", line 27, in fix_js_args
code = append_arguments(six.get_function_code(func), ('this', 'arguments'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/js2py/utils/injector.py", line 121, in append_arguments
arg = name_translations[inst.arg]
~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 3
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 296, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 894, in async_get_component
comp = self.get_component()
^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 932, in get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.tplink_lte
Considering that no maintainer has showed up during the 10 months since the bug was opened, I do not expect this to ever be fixed. In other words, I will consider this integration to be effectively dead.
I will consider this integration to be effectively dead.
What a shame. I'm pretty sure its fixable - with not a lot of work.
I have 4 of the TP-Link LTE MR6400 routers and need to get this working
GPT reken this when asked what the issue could be.
The error message indicates a problem with importing the tp_connected module, specifically within the js2py package. Here's a breakdown of what's happening:
Initial Error:
The error occurs when trying to set up the tplink_lte component in Home Assistant. The import process fails at js2py.utils.injector.py, where it tries to access an element with key 3 in name_translations. KeyError:
This happens because the key 3 is not present in the name_translations dictionary in the js2py package. Root Cause:
The error is due to the js2py package, specifically in the fix_js_args function within the injector.py file. It tries to append arguments to a function, but encounters an unexpected key. Exception Handling:
This KeyError is caught and results in an ImportError for the tplink_lte component in Home Assistant. Steps to Resolve: Check for Updates:
Ensure that both homeassistant and js2py packages are up-to-date. Sometimes, these issues are resolved in newer versions. bash Copy code pip install --upgrade homeassistant js2py Inspect js2py Source:
If the issue persists, inspect the js2py source code, particularly the fix_js_args function in the injector.py file. This might help identify why the key 3 is missing. Report Issue:
If this is a persistent bug, consider reporting it to the maintainers of the js2py library. Provide the traceback and context so they can address it in future updates. Temporary Workaround:
As a temporary workaround, you might modify the injector.py file manually to handle or avoid the KeyError. However, this is not recommended for a production environment as it can lead to other issues. Example of Manual Fix: Here’s a rough example of how you might modify the injector.py to handle the missing key:
python Copy code
def append_arguments(code, args): for inst in code.co_code: if inst.opname == 'LOAD_FAST' and inst.arg not in name_translations: name_translations[inst.arg] = 'default_value' # Provide a default value or handle appropriately ... This would prevent the KeyError by providing a default value, but it’s a hacky solution and should be used with caution.
Alternative Libraries: If the issue remains unresolved and is critical, consider using an alternative library or component that provides similar functionality. By following these steps, you should be able to either resolve the issue or at least identify the underlying problem for further action.
GPT reken this when asked what the issue could be.
the answer looks exactly like ChatGPT. Subtly wrong and completely devoid of insight.
The login-form and possibly the whole webinterface changed between router firmware versions. js2py is used to simulate some cryptographic functions that the browser would have done (https://github.com/F5OEO/tp-connected/blob/master/utility/tp_link_encryption.js) during login. Looks like key exchange to me. But as the login form and the associated crypto (and, again, the whole webinterface) changed, this can not be fixed by just updating something.
The new login form needs to be investigated and analysed, so that the human login behaviour can be simulated by the python lib.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
After upgrading from 2023.5.X to 2023.6.0, the component tplink_lte can no longer be setup. The following error is thrown when starting HA: ` Logger: homeassistant.setup Source: components/tplink_lte/init.py:97 First occurred: 16:43:07 (1 occurrences) Last logged: 16:43:07 Error during setup of component tplink_lte
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 286, in _async_setup_component result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tplink_lte/init.py", line 97, in async_setup await asyncio.wait(tasks) File "/usr/local/lib/python3.11/asyncio/tasks.py", line 415, in wait raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") TypeError: Passing coroutines is forbidden, use tasks explicitly.
I maintain two instances of HA, both connected to the a TP-Link Router each, and the stopped working after I upgraded them to 2023.6.0. Tried googeling, and found that my error is similar to https://github.com/claytonjn/hass-circadian_lighting/issues/227 - both started appearing in 2023.6.0 and states Passing coroutines is forbidden, use tasks explicitly. Judging by the comments, this seems to be a widespread issue among components as of 2023.6.0.
I've tried upgrading to latest HA, 2023.6.3, with no difference.
What version of Home Assistant Core has the issue?
2023.6.0
What was the last working version of Home Assistant Core?
2023.5.X
What type of installation are you running?
Home Assistant OS
Integration causing the issue
TP-Link LTE
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tplink_lte
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response