scaarup / aula

Fetches information from Aula about your children
GNU General Public License v3.0
63 stars 17 forks source link

No devices or entities when setting up #187

Open kjjordans opened 2 months ago

kjjordans commented 2 months ago

Describe the bug or problem (In Danish is OK)

I have tried to set up the integration. I have tried to set up the integration with both ticked - Add school schedules as calendar entities? - Add ugeplaner as sensor attributes? If i set up the integration without any of the options ticked, I get one entity with a message from Aula **Please answer the following** - Version of integration: 0.1.40 - Version of Home Assistant: 2024.9.1 - [ ] I have more than one child - I am only setting up one child from one school to begin with. - [ ] My children are attending different schools / institutions - I am only setting up one child from one school to begin with. **REQUIRED! Provide debug log from the integration** - Enable by adding the following to your configuration.yaml: ``` logger: default: info logs: custom_components.aula: debug [HomeAssistantAula.log](https://github.com/user-attachments/files/17133936/HomeAssistantAula.log) ``` - Restart Home Assistant - Capture all log lines (from the integration only), save it to a file and attach it to here. [HomeAssistantAula.log](https://github.com/user-attachments/files/17133936/HomeAssistantAula.log)
kjjordans commented 1 month ago

I am still having the same issue, I have downloaded the logs>

                _
     /\        | |
    /  \  _   _| | __ _
   / /\ \| | | | |/ _` |
  / ____ \ |_| | | (_| |
 /_/    \_\__,_|_|\__,_|
Aula integration, version: 0.1.42
This is a custom integration
If you have any issues with this you need to open an issue here:
https://github.com/scaarup/aula/issues
-------------------------------------------------------------------

2024-10-18 22:12:41.418 DEBUG (SyncWorker_11) [custom_components.aula.client] is_logged_in? False
2024-10-18 22:12:41.419 DEBUG (SyncWorker_11) [custom_components.aula.client] Logging in
2024-10-18 22:12:43.133 DEBUG (SyncWorker_11) [custom_components.aula.client] Trying API at https://www.aula.dk/api/v19
2024-10-18 22:12:43.179 DEBUG (SyncWorker_11) [custom_components.aula.client] API was expected at https://www.aula.dk/api/v19 but responded with HTTP 410. The integration will automatically try a newer version and everything may work fine.
2024-10-18 22:12:43.179 DEBUG (SyncWorker_11) [custom_components.aula.client] Trying API at https://www.aula.dk/api/v20
2024-10-18 22:12:43.286 DEBUG (SyncWorker_11) [custom_components.aula.client] Found API on https://www.aula.dk/api/v20
2024-10-18 22:12:43.360 ERROR (MainThread) [custom_components.aula.sensor] Unexpected error fetching sensor data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 271, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/aula/sensor.py", line 60, in async_update_data
    await hass.async_add_executor_job(client.update_data)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/aula/client.py", line 225, in update_data
    self.login()
  File "/config/custom_components/aula/client.py", line 170, in login
    self._profilecontext = self._session.get(
                           ^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
2024-10-18 22:12:43.363 DEBUG (MainThread) [custom_components.aula.sensor] Finished fetching sensor data in 1.948 seconds (success: False)
2024-10-18 22:12:43.446 DEBUG (SyncWorker_7) [custom_components.aula.client] is_logged_in? True
2024-10-18 22:12:43.447 DEBUG (SyncWorker_7) [custom_components.aula.client] Child ids and names: {}
2024-10-18 22:12:43.447 DEBUG (SyncWorker_7) [custom_components.aula.client] Child ids and institution names: {}
2024-10-18 22:12:43.447 DEBUG (SyncWorker_7) [custom_components.aula.client] Institution codes: ['253004', 'G18578']
2024-10-18 22:12:43.447 DEBUG (SyncWorker_7) [custom_components.aula.client] Child ids and presence data status: {}
2024-10-18 22:12:44.246 DEBUG (SyncWorker_7) [custom_components.aula.client] Fetching calendars...
2024-10-18 22:12:44.394 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up aula platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/aula/sensor.py", line 75, in async_setup_entry
    await hass.async_add_executor_job(client.update_data)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/aula/client.py", line 378, in update_data
    guardian = self._session.get(
               ^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
2024-10-18 22:12:44.401 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that calls async_forward_entry_setup for integration aula with title: Aula and entry_id: 01JAGM5J1GYCY41D8VB8Z5DTS2, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1. Please report this issue.
Stack (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2223, in async_forward_entry_setup
    _report_non_awaited_platform_forwards(entry, "async_forward_entry_setup")
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1192, in _report_non_awaited_platform_forwards
    report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 155, in report
    _LOGGER.warning(msg, stack_info=True)
2024-10-18 22:12:55.489 INFO (MainThread) [custom_components.aula] 
scaarup commented 1 month ago

Seems like the MU opgaver object is empty. Could this be because it is week 42 and vacation? Or what does the Aula app say? I will try to implement some error handling for it.

kjjordans commented 1 month ago

I am not sure. I had trouble setting it up a few weeks ago before the vacation.