pantherale0 / ha-nintendoparentalcontrols

Home Assistant integration for Nintendo Switch Parental Controls
MIT License
90 stars 7 forks source link

Since 2024.3 the integration start sending the data every minute #91

Closed tonka3000 closed 8 months ago

tonka3000 commented 8 months ago

System Health details

System Information

version core-2024.2.5
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.73-haos-raspi
arch aarch64
timezone Europe/Vienna
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4826 Installed Version | 1.34.0 Stage | running Available Repositories | 1400 Downloaded Repositories | 32
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 28. Oktober 2024 um 01:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true remote_server | eu-central-1-1.ui.nabu.casa certificate_status | ready instance_id | ed631b83f7e048b2ba3caa6e594ede0c can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.0 -- | -- update_channel | stable supervisor_version | supervisor-2024.02.1 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 916.2 GB disk_used | 20.4 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Home Assistant Google Drive Backup (0.112.1), Terminal & SSH (9.9.0), Node-RED (17.0.7), File editor (5.8.0), Duck DNS (1.15.0), Samba share (12.3.0), Studio Code Server (5.15.0), SQLite Web (4.1.2), Mosquitto broker (6.4.0), ESPHome (2024.2.2), Silicon Labs Multiprotocol (2.4.4), openWakeWord (1.10.0), Mealie (v1.3.1)
Dashboards dashboards | 2 -- | -- resources | 22 views | 29 mode | storage
Recorder oldest_recorder_run | 28. Februar 2024 um 23:41 -- | -- current_recorder_run | 9. März 2024 um 09:53 estimated_db_size | 341.71 MiB database_engine | sqlite database_version | 3.44.2
Spotify api_endpoint_reachable | ok -- | --

Checklist

Nintendo Parental Controls mobile app

Describe the issue

Since upgrading the 2024.3 I have the problem that the playtime get send to the nintendo endpoint every minute. I have the mobile app of nintendo which now produce an anyoing sound every minute because a sync happend.

This did not happened before 2024.3. I like the changes from 2024.3 (minutes instead of datetime), but sometimg seems to be off.

I disabled the integration for testing and nothing was send. After enable it again it immediately send a play-time sync to the nintendo endpoint.

Reproduction steps

  1. Install 2024.3

Debug logs

2024-03-09 10:43:03.066 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 2.005 seconds (success: True)
2024-03-09 10:43:15.081 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 2.010 seconds (success: True)
2024-03-09 10:44:16.580 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 1.827 seconds (success: True)
2024-03-09 10:45:17.727 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 1.972 seconds (success: True)
2024-03-09 10:46:19.948 DEBUG (MainThread) [custom_components.nintendo_parental] Finished fetching nintendo_parental data in 2.193 seconds (success: True)

Diagnostics dump

No response

pantherale0 commented 8 months ago

Hi,

I don't think I touched how the integration pulls data in 2024.3. In fact it's always polled data from Nintendo every minute by default.

Do you have any automations running?

Thanks

tonka3000 commented 8 months ago

Hi,

Yes, I have automations but all are deactivated.

I seems that it continuously try to set an new play time.

tonka3000 commented 8 months ago

I've set now the playtime via the app and now it stopped sending notifications.

I will watch that for some days to be sure that it don't come back.

tonka3000 commented 8 months ago

I found the reason what causing the issue. When the play time is set to 0 it will send the state change every minute to the switch. Setting it to something > 0 will fix the problem. This definitely worked before 2024.3 because I set it to 0 every day in the morning via automation.

pantherale0 commented 8 months ago

Interesting, thanks for finding this.

I've updated the library to increase logging in some places in preparation for a small update to the integration which will allow us to see exactly what's going on.

Will look at this later on today.

pantherale0 commented 8 months ago

This is something I actually can't replicate. Have you got anything running that will call number.set every minute as thats the only way I can actually replicate the behaviour?

pantherale0 commented 8 months ago

Can you update to the latest version (2024.3.1) and enable debug logging and try and replicate the behaviour again please?

tonka3000 commented 8 months ago

I tested 2024.3.1 and it now works fine. Is there any way to send you the log file private. I've replaced userid and deviceid, but I'm not sure if I missed some sensitive info.

I checked your changes from 2024.3.1 and find it interesting that >> ScreenTimeEntity.async_set_native_value(value=0.0) is in the log only once and not twice 🤔.

pantherale0 commented 8 months ago

Yes, you can drop the logs here:

https://cloud.hrvy.uk/s/GECpCXALZAoaa99

pantherale0 commented 8 months ago

Also - if you are seeing that entry in the log, something is calling number.set within home assistant.

tonka3000 commented 8 months ago

Uploaded as ha_nintendo_clean.log

pantherale0 commented 8 months ago

Got it, thanks.

This looks like normal behaviour for the integration to be honest. I can't see any issues. It seems something called number.set at 14:57 but apart from that I can't see any problems with the integration itself.

tonka3000 commented 8 months ago

I see the same. If the issue come back I let you know. Thanks for the support. And thanks for this awesome integration.