ericpignet / home-assistant-tplink_router

TPLink router device tracker for Home Assistant
41 stars 28 forks source link

Archer AX6000 #8

Open pljda opened 4 years ago

pljda commented 4 years ago

Hi there, Seems to be working with the AX6000. At least, after i integrate your code, my router was discovered. However there is no scanning of all addresses. I can do some trials if you want, Philippe

ericpignet commented 4 years ago

Hi pljda,

Can you set debug logs in HA:

logger:
  default: info
  logs:
    custom_components.tplink_router: debug

Restart, and paste or attach the content of tplink related logs here? Do you see a file known_devices.yaml created in your HA config directory?

Eric

pljda commented 4 years ago

Hi Eric,

Hanks for your message, I will have a look but I realise that need to do some cleaning. Will keep you informed.

Philippe

On 24 Jun 2020, at 14:18, Eric Pignet notifications@github.com wrote:

Hi pljda,

Can you set debug logs in HA:

logger: default: info logs: custom_components.tplink_router: debug Restart, and paste or attach the content of tplink related logs here? Do you see a file known_devices.yaml created in your HA config directory?

Eric

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericpignet/home-assistant-tplink_router/issues/8#issuecomment-648784869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE44H6BVFHRGBZB5DJBBK3DRYHVIPANCNFSM4N5T6B3Q.

pljda commented 4 years ago

Hi, I can already forward this. If it helps

Log Details (ERROR) Logger: homeassistant.components.device_tracker Source: custom_components/tplink_router/device_tracker.py:447 Integration: Device tracker (documentation https://www.home-assistant.io/integrations/device_tracker, issues https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+device_tracker%22) First occurred: 8:26:15 PM (1 occurrences) Last logged: 8:26:15 PM

Error setting up platform legacy Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 437, in _error_catcher yield File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 519, in read data = self._fp.read(amt) if not fp_closed else b"" File "/usr/local/lib/python3.7/http/client.py", line 457, in read n = self.readinto(b) File "/usr/local/lib/python3.7/http/client.py", line 501, in readinto n = self.fp.readinto(b) File "/usr/local/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 751, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 576, in stream data = self.read(amt=amt, decode_content=decode_content) File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 541, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/usr/local/lib/python3.7/contextlib.py", line 130, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 455, in _error_catcher raise ProtocolError("Connection broken: %r" % e, e) urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 64, in async_setup_legacy self.platform.get_scanner, hass, {DOMAIN: self.config} File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/tplink_router/device_tracker.py", line 56, in get_scanner scanner = cls(config[DOMAIN]) File "/config/custom_components/tplink_router/device_tracker.py", line 83, in init self.success_init = self._update_info() File "/config/custom_components/tplink_router/device_tracker.py", line 447, in _update_info session.post(base_url, login_data, headers=header) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 578, in post return self.request('POST', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 683, in send r.content File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 829, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 754, in generate raise ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))

On 24 Jun 2020, at 14:18, Eric Pignet notifications@github.com wrote:

Hi pljda,

Can you set debug logs in HA:

logger: default: info logs: custom_components.tplink_router: debug Restart, and paste or attach the content of tplink related logs here? Do you see a file known_devices.yaml created in your HA config directory?

Eric

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericpignet/home-assistant-tplink_router/issues/8#issuecomment-648784869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE44H6BVFHRGBZB5DJBBK3DRYHVIPANCNFSM4N5T6B3Q.

pljda commented 4 years ago

Here are the info. I think that the all relate to TP-Link

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 437, in _error_catcher yield File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 519, in read data = self._fp.read(amt) if not fp_closed else b"" File "/usr/local/lib/python3.7/http/client.py", line 457, in read n = self.readinto(b) File "/usr/local/lib/python3.7/http/client.py", line 501, in readinto n = self.fp.readinto(b) File "/usr/local/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 751, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 576, in stream data = self.read(amt=amt, decode_content=decode_content) File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 541, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/usr/local/lib/python3.7/contextlib.py", line 130, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 455, in _error_catcher raise ProtocolError("Connection broken: %r" % e, e) urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 64, in async_setup_legacy self.platform.get_scanner, hass, {DOMAIN: self.config} File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/tplink_router/device_tracker.py", line 56, in get_scanner scanner = cls(config[DOMAIN]) File "/config/custom_components/tplink_router/device_tracker.py", line 83, in init self.success_init = self._update_info() File "/config/custom_components/tplink_router/device_tracker.py", line 447, in _update_info session.post(base_url, login_data, headers=header) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 578, in post return self.request('POST', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 683, in send r.content File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 829, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 754, in generate raise ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer')) 2020-06-28 03:01:24 INFO (MainThread) [hacs.repository.integration.hacs.integration] Registration complete

On 24 Jun 2020, at 14:18, Eric Pignet notifications@github.com wrote:

Hi pljda,

Can you set debug logs in HA:

logger: default: info logs: custom_components.tplink_router: debug Restart, and paste or attach the content of tplink related logs here? Do you see a file known_devices.yaml created in your HA config directory?

Eric

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericpignet/home-assistant-tplink_router/issues/8#issuecomment-648784869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE44H6BVFHRGBZB5DJBBK3DRYHVIPANCNFSM4N5T6B3Q.

GSzabados commented 4 years ago

Hi @pljda,

I am dealing with a C5400X, I have managed to make it work by modifying the script to force the C9 mode.

def get_scanner(hass, config):
    """Validate the configuration and return a TP-Link scanner."""
    for cls in [C9TplinkDeviceScanner]:
        scanner = cls(config[DOMAIN])
        if scanner.success_init:
            return scanner

    return None

Then all the error messages what you see has gone, and the known devices file has been created automatically.

Configuration.yaml

device_tracker:
  - platform: tplink_router
    host: 192.168.8.1
    username: admin
    password: encrypted_password
    interval_seconds: 60
    consider_home: 180
    new_device_defaults:
      track_new_devices: true

For password used the encrypted one as described in the readme.md.

I hope it helps!

@ericpignet, would be possible to define in the configuration which method to use for the connection?

disforw commented 3 years ago

@GSzabados I have a C5400, and your solution worked for me, thank you.

AlexandrErohin commented 9 months ago

If you are still looking for a Home Assistant Integration for Archer AX6000 - I have one https://github.com/AlexandrErohin/home-assistant-tplink-router

GSzabados commented 9 months ago

@AlexandrErohin, that looks really nice!