Antoni-Czaplicki/vulcan-for-hassio

Niedostępność encji w HA 2022.9.1

Closed this issue · 4 comments

Po aktualizacji HA do najnowszej wersji tj. 2022.9.1 wszystkie encje stały się niedostępne.

Błędy w logu

Logger: homeassistant.components.sensor
Source: custom_components/vulcan/fetch_data.py:244
Integration: Sensor (documentation, issues)
First occurred: 16:18:54 (2 occurrences)
Last logged: 16:32:56

Error while setting up vulcan platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/vulcan/sensor.py", line 104, in async_setup_entry
"message": await get_latest_message(client),
File "/config/custom_components/vulcan/fetch_data.py", line 244, in get_latest_message
async for message in await client.data.get_messages(messagebox.global_key):
File "/usr/local/lib/python3.10/site-packages/vulcan/data/_message.py", line 73, in get
yield Message.load(message)
File "/usr/local/lib/python3.10/site-packages/vulcan/model/_serializable.py", line 49, in load
return to_model(cls, data)
File "/usr/local/lib/python3.10/site-packages/related/functions.py", line 104, in to_model
value = cls(**value)
File "", line 21, in init
__attr_validator_read_date(self, __attr_read_date, self.read_date)
File "/usr/local/lib/python3.10/site-packages/attr/validators.py", line 35, in call
raise TypeError(
TypeError: ("'read_date' must be <class 'vulcan.model._datetime.DateTime'> (got None that is a <class 'NoneType'>).", Attribute(name='read_date', default=NOTHING, validator=<instance_of validator for type <class 'vulcan.model._datetime.DateTime'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({'key': 'DateRead'}), type=<class 'vulcan.model._datetime.DateTime'>, converter=<related.converters.to_child_field..ChildConverter object at 0x7f8889e62fb0>, kw_only=False, inherited=False, on_setattr=None), <class 'vulcan.model._datetime.DateTime'>, None)

W HA widoczne są lekcje w kalendarzu. Niestety nie wiem czy się aktualizują czy są to jeszcze wpisy sprzed aktualizacji HA.

W logu pojawiły się kolejne błędy pochodzące z integracji:

Logger: homeassistant.helpers.entity
Source: helpers/aiohttp_client.py:52
First occurred: 9 września 2022 22:07:02 (1 occurrences)
Last logged: 9 września 2022 22:07:02

Update for calendar.vulcan_calendar_julia_kokot 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/vulcan/calendar.py", line 124, in async_update
events = await get_lessons(self.client, type_="list")
File "/config/custom_components/vulcan/fetch_data.py", line 13, in get_lessons
async for lesson in await client.data.get_changed_lessons(
File "/usr/local/lib/python3.10/site-packages/vulcan/data/_lesson.py", line 158, in get
data = await api.helper.get_list(
File "/usr/local/lib/python3.10/site-packages/vulcan/_api_helper.py", line 96, in get_list
return await self._api.get(url, query, **kwargs)
File "/usr/local/lib/python3.10/site-packages/vulcan/_api.py", line 162, in get
return await self._request("GET", url, body=None, **kwargs)
File "/usr/local/lib/python3.10/site-packages/vulcan/_api.py", line 126, in _request
response = await r.json()
File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
return await super().json(*args, loads=loads, **kwargs)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://lekcjaplus.vulcan.net.pl/dabrowagornicza/006320/api/mobile/schedule/changes/byPupil?unitId=13&pupilId=36042&periodId=15026&dateFrom=2022-09-09&dateTo=2022-09-09&lastId=-2147483648&pageSize=500&lastSyncDate=1970-01-01%2000%3A01%3A00')

Wiem o tym błędzie, okazało się że Vulcan klasycznie nie przestrzega zasad swojego API i będzie wymagana jeszcze jedna zmiana w API

Zobacz najnowszą wersję

Teraz wszystko działa jak należy.
Dziękuję