pantherale0 / ha-nintendoparentalcontrols

Home Assistant integration for Nintendo Switch Parental Controls
MIT License
72 stars 6 forks source link

Integration stopped working in 2024.2 #78

Closed jflefebvre06 closed 5 months ago

jflefebvre06 commented 5 months ago

System Health details

System Information

version core-2024.2.0b3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.1
os_name Linux
os_version 6.1.63-haos-raspi
arch aarch64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1451 Downloaded Repositories | 52
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.5.rc3 -- | -- update_channel | beta supervisor_version | supervisor-2024.01.1 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 28.5 GB disk_used | 23.4 GB healthy | true supported | true board | rpi5-64 supervisor_api | ok version_api | ok installed_addons | Samba share (12.2.0), Glances (0.21.0), Home Assistant Google Drive Backup (0.112.1), RPC Shutdown (2.4), Portainer (2.0.0), Mosquitto broker (6.4.0), AirCast (4.2.0), Terminal & SSH (9.8.1), ESPHome (2023.12.9), Zigbee2MQTT (1.35.2-1), NGINX Home Assistant SSL proxy (3.7.0), Let's Encrypt (5.0.15), File editor (5.7.0), Studio Code Server (5.15.0), MQTT Explorer (browser-1.0.3), Speedtest (1.5.0), TubesZB Zigpy-CLI Tools (0.2.2)
Dashboards dashboards | 1 -- | -- resources | 33 views | 22 mode | storage
Recorder oldest_recorder_run | 24 janvier 2024 à 10:24 -- | -- current_recorder_run | 3 février 2024 à 09:26 estimated_db_size | 1916.38 MiB database_engine | sqlite database_version | 3.44.2

Checklist

Nintendo Parental Controls mobile app

Describe the issue

Since few days, integration stop working

Logger: aiohttp.server Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421 First occurred: 12:33:25 (1 occurrences) Last logged: 12:33:25

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 223, in post return await super().post(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 345, in async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/nintendo_parental/config_flow.py", line 231, in async_step_init self._coordinator: NintendoUpdateCoordinator = self.hass.data[DOMAIN][ ^^^^^^^^^^^^^^^^^^^^^^^ KeyError: '0ccbb125a1f3ab6ffd0f1c2dbb9631d7'

Reproduction steps

1. 2. 3. ...

Debug logs

## System Information

version | core-2024.2.0b3
-- | --
installation_type | Home Assistant OS
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.12.1
os_name | Linux
os_version | 6.1.63-haos-raspi
arch | aarch64
timezone | Europe/Paris
config_dir | /config

<details><summary>Home Assistant Community Store</summary>

GitHub API | ok
-- | --
GitHub Content | ok
GitHub Web | ok
GitHub API Calls Remaining | 5000
Installed Version | 1.34.0
Stage | running
Available Repositories | 1451
Downloaded Repositories | 52

</details>

<details><summary>Home Assistant Cloud</summary>

logged_in | false
-- | --
can_reach_cert_server | ok
can_reach_cloud_auth | ok
can_reach_cloud | ok

</details>

<details><summary>Home Assistant Supervisor</summary>

host_os | Home Assistant OS 11.5.rc3
-- | --
update_channel | beta
supervisor_version | supervisor-2024.01.1
agent_version | 1.6.0
docker_version | 24.0.7
disk_total | 28.5 GB
disk_used | 23.4 GB
healthy | true
supported | true
board | rpi5-64
supervisor_api | ok
version_api | ok
installed_addons | Samba share (12.2.0), Glances (0.21.0), Home Assistant Google Drive Backup (0.112.1), RPC Shutdown (2.4), Portainer (2.0.0), Mosquitto broker (6.4.0), AirCast (4.2.0), Terminal & SSH (9.8.1), ESPHome (2023.12.9), Zigbee2MQTT (1.35.2-1), NGINX Home Assistant SSL proxy (3.7.0), Let's Encrypt (5.0.15), File editor (5.7.0), Studio Code Server (5.15.0), MQTT Explorer (browser-1.0.3), Speedtest (1.5.0), TubesZB Zigpy-CLI Tools (0.2.2)

</details>

<details><summary>Dashboards</summary>

dashboards | 1
-- | --
resources | 33
views | 22
mode | storage

</details>

<details><summary>Recorder</summary>

oldest_recorder_run | 24 janvier 2024 à 10:24
-- | --
current_recorder_run | 3 février 2024 à 09:26
estimated_db_size | 1916.38 MiB
database_engine | sqlite
database_version | 3.44.2

</details>

Diagnostics dump

No response

pantherale0 commented 5 months ago

Hi,

This seems to be a problem with Home Assistant rather than the integration as the integration is not responsible for the storage of config entries.

Have you tested on the current stable version of HA?

jflefebvre06 commented 5 months ago

Hi, thanks for the response.

After restarting HA, error disapear but now I have this one :

Error fetching nintendo_parental data: unsupported operand type(s) for -: 'datetime.timedelta' and 'int'

pantherale0 commented 5 months ago

Please can you enable debug logging, restart HA, replicate and upload them?

jflefebvre06 commented 5 months ago

Hello

Not a lot of data in debug mode

2024-02-06 15:45:59.860 ERROR (MainThread) [custom_components.nintendo_parental] Error fetching nintendo_parental data: unsupported operand type(s) for -: 'datetime.timedelta' and 'int'
2024-02-06 15:45:59.860 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 0.000 seconds (success: False)
FutureGUIs commented 5 months ago

same thing happening here, seems like a phython 3.12 update issue???

pantherale0 commented 5 months ago

Hi,

Can you enable debug logs for the module too please?

Set this in your configuration.yaml, restart, replicate the issue and send the homeassistant.log file as it is. Uploading extracts onto GitHub make it difficult to read what is going on.

Thanks

logger:
  default: info
  logs:
    custom_components.nintendo_parental: debug
    pynintendoparental: debug
jflefebvre06 commented 5 months ago

Thanks

2024-02-07 07:21:56.121 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration nintendo_parental which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-02-07 07:22:04.015 INFO (MainThread) [homeassistant.setup] Setting up nintendo_parental
2024-02-07 07:22:04.015 INFO (MainThread) [homeassistant.setup] Setup of domain nintendo_parental took 0.0 seconds
2024-02-07 07:22:05.983 DEBUG (MainThread) [pynintendoparental.authenticator] >> Init authenticator.
2024-02-07 07:22:05.983 DEBUG (MainThread) [pynintendoparental.authenticator] Refreshing access token.
2024-02-07 07:22:09.717 ERROR (MainThread) [custom_components.nintendo_parental] Error fetching nintendo_parental data: unsupported operand type(s) for -: 'datetime.timedelta' and 'int'
2024-02-07 07:22:09.717 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 0.000 seconds (success: False)
2024-02-07 07:22:11.073 INFO (MainThread) [homeassistant.components.sensor] Setting up nintendo_parental.sensor
2024-02-07 07:22:11.080 INFO (MainThread) [homeassistant.components.switch] Setting up nintendo_parental.switch
2024-02-07 07:22:11.084 INFO (MainThread) [homeassistant.components.time] Setting up nintendo_parental.time
jvandijk commented 5 months ago

I've just updated to the stable version of HA 2024.2.0 and experience it also. I've enabled debug logging, but there actually is not much debug output on the nintendo component.

2024-02-07 21:41:32.698 INFO (MainThread) [homeassistant.setup] Setting up nintendo_parental
2024-02-07 21:41:32.698 INFO (MainThread) [homeassistant.setup] Setup of domain nintendo_parental took 0.0 seconds
...
2024-02-07 21:41:36.400 DEBUG (MainThread) [pynintendoparental.authenticator] >> Init authenticator.
2024-02-07 21:41:36.400 DEBUG (MainThread) [pynintendoparental.authenticator] Refreshing access token.
...
2024-02-07 21:41:54.504 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry XXXXXXX for nintendo_parental
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 442, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nintendo_parental/__init__.py", line 32, in async_setup_entry
    coord = NintendoUpdateCoordinator(hass, nintendo_auth, entry)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nintendo_parental/coordinator.py", line 44, in __init__
    self.update_interval = config_entry.options.get(CONF_UPDATE_INTERVAL)
    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in update_interval
    self._update_interval_seconds = value.total_seconds() if value else None
                                    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'total_seconds'
pantherale0 commented 5 months ago

Looks like Home Assistant has changed the way the update interval is handled in 2024.2

https://github.com/home-assistant/core/commit/8d3f693907fa24a54544e3fd7e017c9ec5c2a652

pantherale0 commented 5 months ago

@jvandijk @jflefebvre06 @FutureGUIs could you test the latest beta release please? This should resolve the problem

https://github.com/pantherale0/ha-nintendoparentalcontrols/releases/tag/2024.2.0b0

FutureGUIs commented 5 months ago

Looks good, all the entities have shown up now.

Cows2Computers commented 5 months ago

The beta fixed it for me as well. Thanks for your work on this.

jvandijk commented 5 months ago

@pantherale0 I can confirm the fix as well. Thanks for your effort!

jflefebvre06 commented 5 months ago

Beta works fine, thanks a lot

robbert1977 commented 5 months ago

Beta solved issue thnx!