Core: UPC_Connect: Receive http code 302

Created on 22 Jun 2017  路  6Comments  路  Source: home-assistant/core

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
(homeassistant) homeassistant@hassbian:~ $ hass --version
0.47.1

Python release (python3 --version):
Python 3.4.2

Component/platform:
upc_connect

Description of problem:
I have most of the time following error in log:
2017-06-22 17:08:48 WARNING (MainThread) [homeassistant.components.device_tracker.upc_connect] Receive http code 302
2017-06-22 17:08:48 WARNING (MainThread) [homeassistant.components.device_tracker.upc_connect] Can't read device from 192.168.0.1

Expected:
It should download or survive 302 :)

Problem-relevant configuration.yaml entries and steps to reproduce:

device_tracker:
  - platform: upc_connect
    password: ....
    track_new_devices: false
    interval_seconds: 120
  1. Put it to configuration
  2. Keep it running for a while
  3. 3.

Traceback (if applicable):


Additional info:

Most helpful comment

I think I have found the cause of this problem: the sessionToken is specific to the User-Agent header being used. Because the initial call to /common_page/login.html uses a different user agent than the calls to getter.xml, the calls to getter.xml have an invalid token and fail (redirect to the home page).

Also, I've noticed it's not necessary to log in to query the list of devices.

I'm working on a PR to fix the user agent issue, and remove the call to the login and logout functions, so that you no longer need to give your router password to Home Assistant when using this component.

All 6 comments

You Need restart you homeassistant to fix that. Some time on start it can not connect to box and trow this error. Wait a bit and restart your device. That is a bug but I found no sultion for it.

Yep, I did it many times.. it's working some time, but lot of the time it stop working.. any idea how to debug it?

I have the same problem. If it's any use, there are also many "Timer got out of sync" errors when this component is enabled. They disappear when I disable the component device_tracker.

This happens to me on a fresh install of Hassbian where the discovery component has only found my Ikea Tradfri lights and my Chromecast. No other components or automations have been configured yet, apart from the default ones.

2017-07-01 11:42:49 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-07-01 11:42:49 WARNING (MainThread) [homeassistant.components.device_tracker.upc_connect] Receive http code 302
2017-07-01 11:42:49 WARNING (MainThread) [homeassistant.components.device_tracker.upc_connect] Can't read device from 192.168.0.1
2017-07-01 11:42:57 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-07-01 11:43:02 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-07-01 11:43:02 WARNING (MainThread) [homeassistant.components.device_tracker.upc_connect] Receive http code 302
2017-07-01 11:43:02 WARNING (MainThread) [homeassistant.components.device_tracker.upc_connect] Can't read device from 192.168.0.1
2017-07-01 11:43:10 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

This is my configuration for the device tracker:

device_tracker:
  - platform: upc_connect
    password: xxxxxxxx

Is this any help for solving this bug?

I think I have found the cause of this problem: the sessionToken is specific to the User-Agent header being used. Because the initial call to /common_page/login.html uses a different user agent than the calls to getter.xml, the calls to getter.xml have an invalid token and fail (redirect to the home page).

Also, I've noticed it's not necessary to log in to query the list of devices.

I'm working on a PR to fix the user agent issue, and remove the call to the login and logout functions, so that you no longer need to give your router password to Home Assistant when using this component.

Cool thanks. The out of sync problem is a python34 and aiohttp/asyncio issue. Update to python3.6 (like with docker or hassio) and you system run 30% faster.

Actually, that wasn't the only problem. But I found the real root cause. I will submit the PR in a few minutes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flsabourin picture flsabourin  路  3Comments

i-am-shodan picture i-am-shodan  路  3Comments

ofuangka picture ofuangka  路  3Comments

arangates picture arangates  路  3Comments

moskovskiy82 picture moskovskiy82  路  3Comments