eelcohn / home-assistant-ddwrt Goto Github PK
View Code? Open in Web Editor NEWDDWRT component/entity for Home Assistant
DDWRT component/entity for Home Assistant
Caused by an issue with HA seeing it as a blocking call.
2023-01-09 14:19:01.976 DEBUG (MainThread) [custom_components.ddwrt.pyddwrt] DDWrt.update_about_data: Updating about data...
2023-01-09 14:19:01.976 DEBUG (MainThread) [custom_components.ddwrt.pyddwrt] DDWrt._get_ddwrt_data: Connecting to http://192.168.0.1/About.htm
2023-01-09 14:19:01.986 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to putrequest inside the event loop. This is causing stability issues. Please report issue to the custom integration author for ddwrt doing blocking calls at custom_components/ddwrt/pyddwrt.py, line 860: response = self._session.get(
2023-01-09 14:19:01.987 DEBUG (MainThread) [custom_components.ddwrt.pyddwrt] DDWrt._get_ddwrt_data: Unable to connect to the router Connection error: Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/ddwrt/pyddwrt.py, line 860: response = self._session.get(
2023-01-09 14:19:01.988 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/config/custom_components/ddwrt/pyddwrt.py", line 860, in _get_ddwrt_data
response = self._session.get(
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.10/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.10/http/client.py", line 1293, in _send_request
self.putrequest(method, url, **skips)
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 219, in putrequest
return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 180, in protected_loop_func
check_loop(func, strict=strict)
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 168, in check_loop
raise RuntimeError(
RuntimeError: Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/ddwrt/pyddwrt.py, line 860: response = self._session.get(
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/ddwrt/pyddwrt.py", line 142, in update_about_data
self.data = self._get_ddwrt_data(url, False)
File "/config/custom_components/ddwrt/pyddwrt.py", line 909, in _get_ddwrt_data
raise(DDWrt.ExceptionUnknown(e))
custom_components.ddwrt.pyddwrt.DDWrt.ExceptionUnknown: Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/ddwrt/pyddwrt.py, line 860: response = self._session.get(
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/ddwrt/config_flow.py", line 154, in async_step_user
valid_router = router.update_about_data()
File "/config/custom_components/ddwrt/pyddwrt.py", line 145, in update_about_data
raise(DDWrt.DDWrtException("Unable to update about data: %s", e))
custom_components.ddwrt.pyddwrt.DDWrt.DDWrtException: ('Unable to update about data: %s', ExceptionUnknown(RuntimeError('Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/ddwrt/pyddwrt.py, line 860: response = self._session.get(')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 222, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 81, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
result = await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 281, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/ddwrt/config_flow.py", line 160, in async_step_user
except CannotConnect:
NameError: name 'CannotConnect' is not defined
See https://community.home-assistant.io/t/custom-component-for-dd-wrt-routers/162423/11
User reported that UPNP discovery stopped working. Possible causes:
Hi, I update my router this week and the new firmware don't work with the integration. I try all the version(17) between the 48897 and the newest version. I don't know why it don't work. The error message don't talk really. If you are able to correct the problem, it would be very appreciated. I love this integration into homeassistant. Thank you!
The camera.traffic
device isn't working and will be removed in a future release of this integration. The image is presented not as a JPG/PNG/GIF or whatever image format, but as an HTML page which is rendered in the browser.
An alternative will be to use the recorder:
component on traffic stats, and render an image using a standard lovelace card.
Hi, I've installed the integration (the custom_components folder was just there due to a previous installation of hacs).
I can't see the integration in the UI and when I try to get dd-wrt configured with the yaml I've got this error in the reboot of the server
Logger: homeassistant.setup
Source: setup.py:179
First occurred: 11:20:04 (1 occurrences)
Last logged: 11:20:04
Setup failed for ddwrt: No setup or config entry setup function defined.
tx a lot for your time
In Home Assistant 0.115.3:
2020-09-25 22:07:20 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for ddwrt doing I/O at custom_components/ddwrt/pyddwrt.py, line 448: response = self._session.get(
2020-09-25 22:07:20 WARNING (MainThread) [custom_components.ddwrt] Unable to update WAN data: list index out of range
2020-09-25 22:07:21 WARNING (MainThread) [custom_components.ddwrt] Unable to update wireless data: list index out of range
Configuration:
ddwrt:
devices:
- name: TP-LINK_Archer_C7
host: 192.168.1.1
username: !secret ddwrt_username
password: !secret ddwrt_password
ssl: true
verify_ssl: false
Hi, I want to know if is posible to merge the connected clients if the router has more than one acces point?
added to customcomponent
gone to integration and found component
entered all details
neither have worked, always just shows unknown error occurred
have tried using hostname, IP address
used multiple combinations of SSL and Certificate option
I can access fully from browser so know it is working fine
Any ideas
First thanks so much for updating and making this!!!
I'm running the latest docker image with DD-WRT v3.0-r40559 std (08/06/19) no ssl connection. If I choose integration from the menu I can get to the point where it logs and gives me the items to select. I select a subset of them, but they never populate.
Seeing the below in the error log.
Logger: homeassistant.config_entries
Source: custom_components/ddwrt/pyddwrt.py:398
First occurred: 11:08:24 AM (2 occurrences)
Last logged: 11:17:23 AM
Error setting up entry 192.168.1.1 for ddwrt
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/ddwrt/init.py", line 191, in async_setup_entry
if not await router.async_update_sensor_data():
File "/config/custom_components/ddwrt/init.py", line 382, in async_update_sensor_data
result = await self._hass.async_add_executor_job(self._router.update_wireless_data)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ddwrt/pyddwrt.py", line 398, in update_wireless_data
"uptime": elements[i + 3],
IndexError: list index out of range
tried to setup the custom component DDWRT on HA 2021.11.5 but that failed with the error:
Setup failed for ddwrt: Unable to import component: cannot import name 'VOLT' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)
Installed it via HACS and then used a simple config. No uPnP server should be used.
even the flow config on the integration page via ddwrt is not working.
Error
Config flow could not be loaded
would be great if you could have a look into that issue.
Hi, just trying your add-on, but I cant seem to get it setup.
I have copied the ddwrt folder into custom-components, the add-on is there. I have also tried via config.yaml still the same result.
The error is "Failed to setup"
Im on HA 2023.7.1 running on Ubuntu in a Docker container.
Hi eelcohn,
Today I wanted to play with your DD-WRT integration but it's not working as expected and is giving me the following error:
Error: Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble
My router is running firmware: Firmware: DD-WRT v3.0-r53339 std (08/01/23)
And this is what i see in logs:
Error setting up entry 10.0.0.1 for ddwrt
11:42:39 – (ERROR) DD-WRT (custom integration)
update_upnp_data(): invalid number of elements in pptp_leases (expected 4, found 107)
11:42:39 – (WARNING) DD-WRT (custom integration)
Unknown wireless radio status, please report this to the author: ['Inactive']
11:42:39 – (ERROR) DD-WRT (custom integration)
Extra fields in WAN data found. Please contact developer to report this warning. ({'speed_up': '0', 'speed_down': '0', 'speed_town': ' ', 'speed_sponsor': ' ', 'speed_country': ' '})
11:42:38 – (WARNING) DD-WRT (custom integration)
Unable to update router data: could not convert string to float: 'Available'
11:42:38 – (WARNING) DD-WRT (custom integration)
update_lan_data(): invalid number of elements in dhcp_leases (expected 5, found 231)
11:42:37 – (WARNING) DD-WRT (custom integration)
I guess the DD-WRT dev (BrainSlayer) included something your intergation can't handle?
Do you think you can fix this?
I've a problem :
2021-01-20 15:39:07 WARNING (MainThread) [custom_components.ddwrt] Unable to update about data: ('Unable to update router model data: %s', ExceptionTimeout(ReadTimeout(ReadTimeoutError("HTTPSConnectionPool(host='192.168.1.100', port=443): Read timed out. (read timeout=4)"))))
2021-01-20 15:39:07 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.100 (configuration.yaml) for ddwrt
{wl_mac::00:1D:7E:BD:48:EA}{wl_ssid::dd-wrt}{wl_channel::1}{wl_radio::Sans fil désactivé}{wl_xmit::200 mW}{wl_rate::54 Mbit/s}{wl_busy::}{wl_active::}{wl_quality::}{wl_ack::}{active_wireless::}{active_wds::}{assoc_count::0}{packet_info::SWRXgoodPacket=0;SWRXerrorPacket=4;SWTXgoodPacket=0;SWTXerrorPacket=90;}{uptime:: 15:47:13 up 15 min, load average: 0.00, 0.03, 0.03}{ipinfo::: Désactivé}
regards.
Hi Eelcohn, thanks for you work !
I cann´´t install the integration with HA 0.118.4 . what am I doing wrong ?
Thanks
`ogger: homeassistant.config_entries
Source: custom_components/ddwrt/pyddwrt.py:343
First occurred: 13:44:31 (3 occurrences)
Last logged: 13:55:34
Error setting up entry 192.168.27.2 for ddwrt
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/ddwrt/init.py", line 191, in async_setup_entry
if not await router.async_update_sensor_data():
File "/config/custom_components/ddwrt/init.py", line 382, in async_update_sensor_data
result = await self._hass.async_add_executor_job(self._router.update_wireless_data)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ddwrt/pyddwrt.py", line 343, in update_wireless_data
self.results.update({"wl_ack_distance": wl_ack.split("(")[1].split("m")[0]})
IndexError: list index out of range`
Model: Archer C9v1
Firmware: Firmware: DD-WRT v3.0-r45993 std (03/12/21)
Hey so first off, great work on the component, I think the integrated component is way too barebones compared to how much data can be retrieved, and I think this bridges the gap quite a bit.
So initially I wasn't able to get the component to work at all until I realized that the master didn't have the latest version. Once I used the latest branch, it did begin to work but the log spat out a bunch of warnings about active_wireless data and uPnP forward data having different numbers of elements than expected.
Didn't matter to me that much as I'm using ARP to track my devices since I'm running multiple APs. ARP data seemed to look fine but upon inspection in my devices page, I saw a whole a bunch of interfaces instead of device names. It turns out my Status_Lan.Live page has 8 elements per device instead of 4 or 5. Once I hardcoded it to 8, the devices were added fine. I'm not sure if there's a better way to detect the number of elements per device. The stock integration uses regex to match the MAC address so perhaps something with that will be the answer. I'll pull request or something if I find something good.
(On a side note, I also added a condition to make sure the amount of connections were at least 1 as the ARP table will keep devices with 0 connections, which is weird because I wouldn't consider them active)
However, all the devices are permanently marked as unavailable and I'm afraid I'm not advanced enough to understand why. I looked through the log and I couldn't find any evidence of any ddwrtdevice messages past the initial bootup. I can attach a log for you to look at if that helps. Otherwise, let me know if there's anything else I can provide.
Thanks!
When I add the config for ddwrt in the configuration.yaml the configuration does not pass the check with following error message:
Invalid config for [ddwrt]: [devices] is an invalid option for [ddwrt]. Check: ddwrt->ddwrt->0->devices. (See /config/configuration.yaml, line 62)
My config:
ddwrt:
devices:
- name: Wifi-EG
host: x.x.x.x
username: admin
password: secure_password
ssl: false
....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.