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

Не стабильно работает компонент #2

Open
tayanov opened this issue Sep 23, 2021 · 9 comments
Open

Не стабильно работает компонент #2

tayanov opened this issue Sep 23, 2021 · 9 comments

Comments

@tayanov
Copy link

tayanov commented Sep 23, 2021

При первой настройке через ГУЙ компонент заработал, на след. день сенсоры не активны.
В логе ошибки:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/tns_energo/init.py", line 228, in async_setup_entry
await api_object.async_authenticate()
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/init.py", line 270, in async_authenticate
response = await AuthorizationRequest.async_request(self, self._username, self._password)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/requests/authorization.py", line 87, in async_request
return cls.from_response(await cls.async_request_raw(on, username, password))
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 175, in from_response
return super().from_response(data, **kwargs)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 143, in from_response
return cls(**init_args) # type: ignore[call-arg]
TypeError: init() missing 1 required keyword-only argument: 'debt'

или так

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/tns_energo/init.py", line 228, in async_setup_entry
await api_object.async_authenticate()
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/init.py", line 270, in async_authenticate
response = await AuthorizationRequest.async_request(self, self._username, self._password)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/requests/authorization.py", line 87, in async_request
return cls.from_response(await cls.async_request_raw(on, username, password))
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 175, in from_response
return super().from_response(data, **kwargs)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 143, in from_response
return cls(**init_args) # type: ignore[call-arg]
TypeError: init() missing 2 required keyword-only arguments: 'controlled_by_code' and 'debt'

Каждый раз последние строки разные

@alryaz
Copy link
Owner

alryaz commented Sep 23, 2021

Не подскажете ли, помимо controlled_by_code и debt появлялись ли ещё какие-либо вариации?

Исправление могу сразу выпустить, но хотелось бы включить всевозможные варианты.

(Для контекста: эти ошибки означают, что АПИ не отдаёт какие-то данные, которые ощущались обязательными во время тестирования)

alryaz added a commit that referenced this issue Sep 23, 2021
refactor: updated underlying library version (#2)

refactor: changed several logging messages to support multilingual operation
@alryaz
Copy link
Owner

alryaz commented Sep 23, 2021

Проверьте v0.0.5, возможно это исправит Вашу проблему.

@tayanov
Copy link
Author

tayanov commented Sep 23, 2021

Setup failed for tns_energo: Unable to import component: No module named 'inter_rao_energosbyt'
откатываюсь на 0.0.4 и опять ошибка из первого поста.
снова обновляюсь на 0.0.5 и опять
Setup failed for tns_energo: Unable to import component: No module named 'inter_rao_energosbyt'

@alryaz
Copy link
Owner

alryaz commented Sep 24, 2021

В API, используемом компонентом, был допущен лишний импорт другого АПИ. Прошу прощения за данный инцидент.

Релиз снят с GitHub, сейчас будет новый.

Источник

@alryaz
Copy link
Owner

alryaz commented Sep 24, 2021

upd:
Закомментировал блок с настройками компонента, перезагрузил Home Assistant, вернул назад настройки компонента, снова перезагрузил Home Assistance...всё работает. Спасибо!

Источник

@tayanov
Copy link
Author

tayanov commented Sep 24, 2021

Logger: aiohttp.server
Source: custom_components/tns_energo/config_flow.py:111
Integration: ТНС Энерго (documentation, issues)
First occurred: 14:54:04 (2 occurrences)
Last logged: 14:54:11

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, 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 89, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/tns_energo/config_flow.py", line 111, in async_step_user
await api.async_authenticate()
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/init.py", line 270, in async_authenticate
response = await AuthorizationRequest.async_request(self, self._username, self._password)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/requests/authorization.py", line 92, in async_request
return cls.from_response(await cls.async_request_raw(on, username, password))
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 173, in from_response
return super().from_response(data, **kwargs)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 141, in from_response
return cls(**init_args) # type: ignore[call-arg]
File "", line 9, in init
_setattr('_email_and_invoice_status', __attr_converter__email_and_invoice_status(email_and_invoice_status))
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/requests/authorization.py", line 74, in _converter__email_and_kvit_status
return EmailAndKvitStatus.from_response(value)
File "/usr/local/lib/python3.9/site-packages/tns_energo_api/converters.py", line 136, in from_response
if data_field and data_field in data:
TypeError: argument of type 'NoneType' is not iterable

Заранее спасибо.

@alryaz
Copy link
Owner

alryaz commented Sep 24, 2021

@tayanov Пожалуйста, свяжитесь со мной в Telegram: @alryaz (https://t.me/alryaz)

@vlad36N
Copy link

vlad36N commented Sep 11, 2022

2022-09-11 17:24:59.808 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry XXXXXXXXXXXX for tns_energo
Traceback (most recent call last):
File "/config/custom_components/tns_energo/init.py", line 257, in async_setup_entry
accounts = await api_object.async_get_accounts_list()
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/init.py", line 311, in async_get_accounts_list
response = await GetLSListByLS.async_request(self, code)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/account.py", line 241, in async_request
return cls.from_response(response)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/converters.py", line 189, in from_response
raise ResponseException(code, msg)
tns_energo_api.exceptions.ResponseException: (110, 'Невозможно получить список управляемых счетов')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 357, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/tns_energo/init.py", line 275, in async_setup_entry + str(e)
UnboundLocalError: local variable 'e' referenced before assignment

@vlad36N
Copy link

vlad36N commented Sep 12, 2022

Эта ошибка возникла в кастомной интеграции.

Logger: homeassistant.helpers.entity
Source: custom_components/tns_energo/sensor.py:380
Integration: ТНС Энерго (documentation, issues)
First occurred: 01:28:49 (2 occurrences)
Last logged: 02:28:49

Update for sensor.tns_rostov_XXXXXXXXXXXX_meter_XXXXXXXXXXXXXXXXX fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_device_update
raise exc
File "/config/custom_components/tns_energo/_base.py", line 525, in async_update
await with_auto_auth(
File "/config/custom_components/tns_energo/_util.py", line 67, in with_auto_auth
return await async_getter(*args, **kwargs)
File "/config/custom_components/tns_energo/sensor.py", line 380, in async_update_internal
meters = await self._account.async_get_meters()
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/init.py", line 368, in async_get_meters
response = await SendIndicationsPage.async_request(self.api, self.code)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/get_send_indications_page.py", line 188, in async_request
return cls.from_response(result)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/converters.py", line 191, in from_response
return super().from_response(data, **kwargs)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/converters.py", line 159, in from_response
return cls(**init_args) # type: ignore[call-arg]
File "", line 4, in init
_setattr('counters', __attr_converter_counters(counters))
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/get_send_indications_page.py", line 156, in converter__counters
{
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/get_send_indications_page.py", line 158, in
sorted(
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/get_send_indications_page.py", line 163, in
else ZoneData.from_response(tariff_data)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/converters.py", line 159, in from_response
return cls(**init_args) # type: ignore[call-arg]
TypeError: ZoneData.init() missing 6 required keyword-only arguments: 'transmission_coefficient', 'max_indication_difference', 'can_delete', 'model', 'service_number', and 'service_name'

===============================

Эта ошибка возникла в кастомной интеграции.

Logger: homeassistant.helpers.entity
Source: custom_components/tns_energo/_util.py:72
Integration: ТНС Энерго (documentation, issues)
First occurred: 01:29:13 (2 occurrences)
Last logged: 01:29:16

Update for sensor.tns_rostov_XXXXXXXXXXXX_account fails
Update for sensor.tns_rostov_XXXXXXXXXXXX_last_payment fails
Traceback (most recent call last):
File "/config/custom_components/tns_energo/_util.py", line 67, in with_auto_auth
return await async_getter(*args, **kwargs)
File "/config/custom_components/tns_energo/sensor.py", line 254, in async_update_internal
accounts = await account.api.async_get_accounts_list(account_code)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/init.py", line 311, in async_get_accounts_list
response = await GetLSListByLS.async_request(self, code)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/account.py", line 241, in async_request
return cls.from_response(response)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/converters.py", line 189, in from_response
raise ResponseException(code, msg)
tns_energo_api.exceptions.ResponseException: (110, 'Невозможно получить список управляемых счетов')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update
await task
File "/config/custom_components/tns_energo/_base.py", line 525, in async_update
await with_auto_auth(
File "/config/custom_components/tns_energo/_util.py", line 72, in with_auto_auth
await api.async_authenticate()
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/init.py", line 295, in async_authenticate
response = await AuthorizationRequest.async_request(self, self._username, self._password)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/requests/authorization.py", line 100, in async_request
return cls.from_response(result)
File "/usr/local/lib/python3.10/site-packages/tns_energo_api/converters.py", line 189, in from_response
raise ResponseException(code, msg)
tns_energo_api.exceptions.ResponseException: (104, 'На этот номер лицевого счёта личный кабинет ещё не\xa0зарегистрирован. Вы\xa0можете зарегистрировать его прямо сейчас.')

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

3 participants