Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup errors #23

Closed
PalmMx opened this issue Sep 17, 2019 · 24 comments
Closed

Setup errors #23

PalmMx opened this issue Sep 17, 2019 · 24 comments

Comments

@PalmMx
Copy link

PalmMx commented Sep 17, 2019

I changed version to 'v1_1_71' in the config, however the component does not start.
Now I'm getting this in my log:

2019-09-17 19:47:58 ERROR (MainThread) [homeassistant.setup] Error during setup of component sector_alarm
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 39, in login
AsyncSector.Base + AsyncSector.Login, json=self._auth)
File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 497, in _request
await resp.start(conn)
File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 844, in start
message, payload = await self._protocol.read() # type: ignore # noqa
File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 588, in read
await self._waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 168, in _async_setup_component
hass, processed_config
File "/config/custom_components/sector_alarm/init.py", line 63, in async_setup
if not await async_sector.login():
File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 45, in login
return True
File "/usr/local/lib/python3.7/site-packages/async_timeout/init.py", line 45, in exit
self._do_exit(exc_type)
File "/usr/local/lib/python3.7/site-packages/async_timeout/init.py", line 92, in _do_exit
raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError

Any clue?

@tomoqv
Copy link

tomoqv commented Sep 20, 2019

Since the last two HA upgrades, Sector Alarm has setup issue for me too.

2019-09-19 22:06:51 ERROR (MainThread) [homeassistant.setup] Error during setup of component sector_alarm
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 39, in login
    AsyncSector.Base + AsyncSector.Login, json=self._auth)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 476, in _request
    timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 522, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 854, in _create_connection
    req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 974, in _create_direct_connection
    req=req, client_error=client_error)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 924, in _wrap_create_connection
    await self._loop.create_connection(*args, **kwargs))
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 981, in create_connection
    ssl_handshake_timeout=ssl_handshake_timeout)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1009, in _create_connection_transport
    await waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 168, in _async_setup_component
    hass, processed_config
  File "/config/custom_components/sector_alarm/__init__.py", line 63, in async_setup
    if not await async_sector.login():
  File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 45, in login
    return True
  File "/usr/local/lib/python3.7/site-packages/async_timeout/__init__.py", line 45, in __exit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.7/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError
2019-09-19 22:06:55 ERROR (SyncWorker_11) [homeassistant.components.onkyo.media_player] Unable to connect to receiver at 192.168.1.205
2019-09-19 22:29:59 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.548494162448] Client exceeded max pending messages [2]: 512
2019-09-19 22:29:59 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.548494162448] Client exceeded max pending messages [2]: 512
2019-09-19 22:29:59 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.548494162448] Client exceeded max pending messages [2]: 512
2019-09-19 22:29:59 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.548494162448] Client exceeded max pending messages [2]: 512
2019-09-19 22:37:45 ERROR (SyncWorker_7) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2019-09-19 23:28:01 ERROR (SyncWorker_6) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2019-09-20 06:55:28 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.548483501200] Client exceeded max pending messages [2]: 512
2019-09-20 07:12:33 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.kodi_kok fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 470, in async_update
    player_id, ["time", "totaltime", "speed", "live"]
  File "/usr/local/lib/python3.7/site-packages/jsonrpc_websocket/jsonrpc.py", line 45, in send_message
    return message.parse_response(response)
  File "/usr/local/lib/python3.7/site-packages/jsonrpc_base/jsonrpc.py", line 181, in parse_response
    raise ProtocolError(code, message, data)
jsonrpc_base.jsonrpc.ProtocolError: (-32100, 'Failed to execute method.', {'error': {'code': -32100, 'message': 'Failed to execute method.'}, 'id': 8913991150882792665, 'jsonrpc': '2.0'})
2019-09-20 07:43:40 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 275, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

@sebastian-steinmann
Copy link

They might actually have changed their api instead of just the version.

Left my computer at work, but will try to take a look tomorrow.

@loial
Copy link

loial commented Sep 25, 2019

Haven't tested this hasscomponent, but can confirm that asyncsector currently requires "v1_1_72"

@sebastian-steinmann
Copy link

Yeah, I just updated to the latest version, and then it works fine.

@sebastian-steinmann
Copy link

If we can get #20 up and running we can get rolling updates I guess?

@loial
Copy link

loial commented Sep 25, 2019

I opened mgejke/asyncsector#12 for a discussion on maybe doing this automatically in asyncsector...

@PalmMx
Copy link
Author

PalmMx commented Sep 25, 2019

During the last weekend, when I updated to 0.99.2, I got the component to work for a while. That was still version 1_1_71 then. After two restarts of HA, the error message was back again.

Today I changed version to 1_1_72, but the error remains, i.e. the component is not working for me.

@tomoqv
Copy link

tomoqv commented Sep 26, 2019

I have also changed to version to 1_1_72. After some restarts it works, after some restarts i doesn't. A bit of "hit and miss".

@tomoqv
Copy link

tomoqv commented Sep 26, 2019

Mostly "miss" actually. Several restarts today, but no working alarm setup. Also tried to change to version to 1_1_73 just to check, but not working.

@sebastian-steinmann
Copy link

Could they have added a random version?

@loial
Copy link

loial commented Sep 28, 2019

I've tried a couple of times manually playing with my asyncsector build, and it seems to consistently report v1_1_73 as current version, and using --auto seems to work correctly. A couple of timeouts, but no version errors, so I do not think random version is an issue...

I believe I saw some older treads where accounts were blacklisted because of too frequent API calls, could this be an issue?

Oh and I want to try to work on implementing the auto-feature in hass-sectoralarm, but I'm a little fuzzy on how to add a custom "asyncsector" module in my testing... You know if I can add a specific branch of my own github-repo as a dependency? Also, if it is at all practical when running hass in a docker environment?

@loial
Copy link

loial commented Sep 29, 2019

Ok so I got hass-sectoralarm working with autoversion almost without change, only a slight adjustment in init.py:

Allow async calls during init by changing line 56 from:
async_sector = AsyncSector(
to:
async_sector = await AsyncSector.create(

Also, waiting for an update to asyncsector, change REQUIREMENTS (line 20) from: 'asyncsector==0.2.0' to: 'https://github.com/loial/asyncsector/archive/feature-autoversion.zip#asyncsector==0.2.0'

And it seems to work :)

However, I'm not sure if this object is setup only once at Hass startup, or on every update? In the latter case, theres a versiin check on EVERY update, which is probably unneccessary, and I should figure out how to cache the retrieved version code...

@loial loial mentioned this issue Sep 29, 2019
@tomoqv
Copy link

tomoqv commented Sep 29, 2019

@loial I tried your changes in the init.py, but it doesn't work for me.

@loial
Copy link

loial commented Sep 29, 2019

This file has the two changes:
https://github.com/loial/hass-sectoralarm/raw/feature-autoversion-test/sector_alarm/__init__.py

Also in configuration.yaml, the version needs to be set to 'auto'

@tomoqv
Copy link

tomoqv commented Sep 29, 2019

Also in configuration.yaml, the version needs to be set to 'auto'

Like this?

sector_alarm:
  email: !secret sector_alarm_email
  password: !secret sector_alarm_password
  alarm_id: !secret sector_alarm_alarm_id
  code: !secret sector_alarm_code
  thermometers: true
  alarm_panel: true
  version: 'auto'

@loial
Copy link

loial commented Sep 29, 2019

oh, sorry, I should be specific :)
Under sector_alarm:
where you put email, password and alarm_id,
there should also be a field for version, that either needs to be specific (currently 'v1_1_73'), but with my changes, you should set this to 'auto'

@tomoqv
Copy link

tomoqv commented Sep 29, 2019

Sorry, I realized that and edited my previous comment. However, the above config didn't work with your init.py.

@loial
Copy link

loial commented Sep 29, 2019

Hmm... I'm running this in an docker environment, so it's sort of "clean" on each startup... don't know if this is different than your setup... otherwise, I have the same config as yours...

Have you tried disabling thermometers? (The response from that API is sometimes REALLY slow, and might timeout) Also, check the logs and see if there are any hints (usually the last line in a block of related error messages)

@sebastian-steinmann
Copy link

Should be able to save it in an input?
Or just do hass[DOMAIN].data ?

@tomoqv
Copy link

tomoqv commented Sep 30, 2019

Hmm... I'm running this in an docker environment, so it's sort of "clean" on each startup... don't know if this is different than your setup... otherwise, I have the same config as yours...

Have you tried disabling thermometers? (The response from that API is sometimes REALLY slow, and might timeout) Also, check the logs and see if there are any hints (usually the last line in a block of related error messages)

This is very strange. Suddenly, after a failed update from 0.99.2 to 0.99.3, Sector Alarm setup worked for me without any change of setting. I am using your init.py and the version: 'auto' setting.

@tomoqv
Copy link

tomoqv commented Oct 3, 2019

Hm, setup still fails once in a while. Could it be that the component times out when this happens? In that case, could the time waiting for response be increased?

@mgejke
Copy link
Owner

mgejke commented Oct 3, 2019

I've written before, the thermometers are really slow, try not using them.

(and I'll try to look at PR and stuff...)

@PalmMx
Copy link
Author

PalmMx commented Oct 3, 2019

I did set the thermostats to 'false' last week. It worked ONE time, i.e. one restart of HASS.
When I restarted HASS the next day the component crashed again and haven't come alive again since that.
Using version 1_1_73 nowadays.

I would be quite happy if I at least can get the correct status on the alarm.

@PalmMx
Copy link
Author

PalmMx commented Oct 4, 2019

I tried the adjusted init.py file by @loial and changed version to 'auto'.

After the first restart of HA, I got the following error in the log:

2019-10-04 19:52:05 ERROR (MainThread) [homeassistant.setup] Error during setup of component sector_alarm
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 39, in login
AsyncSector.Base + AsyncSector.Login, json=self._auth)
File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 497, in _request
await resp.start(conn)
File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 844, in start
message, payload = await self._protocol.read() # type: ignore # noqa
File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 588, in read
await self._waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 168, in _async_setup_component
hass, processed_config
File "/config/custom_components/sector_alarm/init.py", line 62, in async_setup
version=config[DOMAIN].get(CONF_VERSION))
File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 22, in create
logged_in = await self.login()
File "/usr/local/lib/python3.7/site-packages/asyncsector/asyncsector.py", line 45, in login
return True
File "/usr/local/lib/python3.7/site-packages/async_timeout/init.py", line 45, in exit
self._do_exit(exc_type)
File "/usr/local/lib/python3.7/site-packages/async_timeout/init.py", line 92, in _do_exit
raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError

However...
After another restart of HA, like 5 minutes later, it worked! No changes made.
I have thermostats set to 'false', but at least I get the correct alarm status. For now.
I assume it be gone after the next restart.

@mgejke mgejke closed this as completed Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants