pantherale0 / ha-nintendoparentalcontrols

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

Integration not working for me #22

Closed Seexelas closed 8 months ago

Seexelas commented 8 months ago

System Health details

System Information

version core-2023.10.5
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.56
arch x86_64
timezone CET
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4515 Installed Version | 1.33.0 Stage | running Available Repositories | 1317 Downloaded Repositories | 9
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | October 27, 2023 at 2:00 AM relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true remote_server | us-east-1-11.ui.nabu.casa certificate_status | ready can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.0 -- | -- update_channel | stable supervisor_version | supervisor-2023.10.0 agent_version | 1.6.0 docker_version | 24.0.6 disk_total | 30.8 GB disk_used | 6.0 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | File editor (5.6.0), Terminal & SSH (9.7.1), Mosquitto broker (6.3.1), PS5 MQTT (1.3.1), EMQX (0.2.11), Advanced SSH & Web Terminal (15.1.0)
Dashboards dashboards | 2 -- | -- resources | 5 views | 2 mode | storage
Recorder oldest_recorder_run | October 13, 2023 at 10:04 AM -- | -- current_recorder_run | October 23, 2023 at 10:03 AM estimated_db_size | 11.72 MiB database_engine | sqlite database_version | 3.41.2

Checklist

Describe the issue

Hi,

I installed the integration plugin, configured my nintendo switch account, everything is reported as success.

But I have no device, no entities showing, and I found some errors in my logs.

Thanks for the help,

Reproduction steps

  1. Install the integration
  2. Restart HA
  3. Configure integration
  4. Success message
  5. Restart HA
  6. No device showing, errors in logs ...

Debug logs

https://www.swisstransfer.com/d/7a06fc7b-86c3-4096-acfd-f98dbff0f491

Diagnostics dump

I don't have one as no device is showing.

pantherale0 commented 8 months ago

Just a few notes for me

Errors to resolve:

A device is returned from the API, however the logs don't currently give enough information as to where the list index error occurs, but I'm assuming as part of this function https://github.com/pantherale0/pynintendoparental/blob/main/pynintendoparental/device.py#L112 EDIT - Increased logging with #23

Need to first add more debug logs to the module which will help get to the bottom of the error (the console I have isn't used too often so could be something I've missed).

pantherale0 commented 8 months ago

Could you update to 0.1.4b1 and test again please? I'm expecting it to fail, but there should be a lot more logs available now to find out where the problem is.

Seexelas commented 8 months ago

Hi,

Thanks for the quick help, here it is :

https://www.swisstransfer.com/d/8cba9b6d-f081-4af7-b8ac-8c047fe6060e

pantherale0 commented 8 months ago

Thank you 👍

That makes sense now, the module tries to get the daily summary for the current day (to calculate things like playing time today, disabled time, exceeded time, observations, important info and notices) however in your case it doesn't actually exist, and the latest entry is as follows:

{'deviceId': 'REDACTED', 'date': '2023-10-15', 'result': 'CALCULATING', 'playingTime': 0, 'exceededTime': None, 'disabledTime': 0, 'miscTime': 0, 'importantInfos': [], 'notices': [], 'observations': [], 'playedApps': [], 'anonymousPlayer': None, 'devicePlayers': [], 'timeZoneUtcOffsetSeconds': 7200, 'lastPlayedAt': None, 'createdAt': 1697325484, 'updatedAt': 1697345650}

So I know its directly caused by the API / Nintendo itself. What I now don't know is how your parental controls is configured for Nintendo to stop calculating daily summaries.

Is there a chance you could provide the settings set in the "Settings" page of the mobile app please? Perhaps a setting there changes the behavior.

pantherale0 commented 8 months ago

Also, updating to 0.1.4b2 should now allow the component to finish init

Seexelas commented 8 months ago

IMG_0457 IMG_0458

Here are the screenshot of settings of the app... I don't see anything special.

I did the update, tested, same behaviour but less logs in error :

https://www.swisstransfer.com/d/796436ac-ba86-4e9e-aa7d-22340d004386

Seexelas commented 8 months ago

Also if you have time :

image

There is no icon showing in front of the plugin, if you can add one please ^^

pantherale0 commented 8 months ago

thanks for the screenshots. I think its because there is no restrictions set on the device. I'll have a test later on.

RE the icon, I did try adding the switch icon into the brands repo a while back but it wasn't accepted at the repo only accepts manufacturer logos/icons, not product logos/icons. I'm yet to source a valid Nintendo icon.

https://github.com/home-assistant/brands/pull/4650

Seexelas commented 8 months ago

So I set limits for the time played and content, I have delete and reconfigured. Still the same issue :

https://www.swisstransfer.com/d/afe49719-ab0e-47ba-8b63-cad5da29ddae

pantherale0 commented 8 months ago

You would need to leave it set for Nintendo to finish calculating the daily summaries (they seem to do it on a daily basis, around midnight, but sometimes can be later, or sometimes earlier).

Seexelas commented 8 months ago

Hi pantherale0,

Now that the daily summary has arrived on my APP :

image

I reloaded the plugin, but it still want to check on the 23th for now reason :

image

Is it possible to bypass the error ? or do you know why ?

Many thanks

pantherale0 commented 8 months ago

Sorry, been tied up with work.

There are some changes made upstream that will continue setup if the requested date doesn't exist, however time reporting won't work because that is the only place the data exists.

I'll try and sort out a new version to allow platform setup to resume, and create an issue in Home Assistant instead (https://developers.home-assistant.io/docs/core/platform/repairs) that will disappear once the data is available.

pantherale0 commented 8 months ago

@Seexelas can you send another more recent log file please? I'm wondering if this might be timezone related.

Seexelas commented 8 months ago

Hi @pantherale0,

Thanks for your quick feedback.

Here are the last logs : https://www.swisstransfer.com/d/acf28cb3-38dc-46c8-93c2-1b215c2cf93c

pantherale0 commented 8 months ago

hmmm, something is really odd with this, Nintendo is still only returning up to 15th October and no later.

Can I ask what timezone you are in?

I'm not even sure if I can actually resolve this :( my own account isn't affected by this and I haven't seen any other reports like this, the only way I can think of to start figuring out whats wrong is using an account that has the problem in the first place, and test in an API debugging tool (Postman/Insomnia).

pantherale0 commented 8 months ago

Now I've just posted that, I saw you had "Switch 6" and "Switch 7" in the screenshots from the mobile app, perhaps its only one of the consoles that are impacted. I'll make changes tomorrow (had no internet connection) and get the updates released into beta asap.

samuelleung1009 commented 8 months ago

Hello, I have the same question. After successfully installing the integration, no devices and entities appear.

截屏2023-10-31 下午8 29 42 截屏2023-10-31 下午8 31 04 截屏2023-10-31 下午8 31 53 截屏2023-10-31 下午8 32 01
Seexelas commented 8 months ago

Now I've just posted that, I saw you had "Switch 6" and "Switch 7" in the screenshots from the mobile app, perhaps its only one of the consoles that are impacted. I'll make changes tomorrow (had no internet connection) and get the updates released into beta asap.

I have one switch which is on my account and is also the main account which had never been synchonized with Nintendo Parental. (which is switch 6 and 7, i've made two tests).

I have two kids who's switch is added to my application also but they have their account and we are grouped in family.

My timezone is europe/luxembourg.

pantherale0 commented 8 months ago

@Seexelas can you test the latest version I've just released please? An issue should be created instead as a way of alerting that there is a problem with the device, but as I don't have anything affected, I can't test properly myself :(

pantherale0 commented 8 months ago

Hello, I have the same question. After successfully installing the integration, no devices and entities appear. 截屏2023-10-31 下午8 29 42 截屏2023-10-31 下午8 31 04 截屏2023-10-31 下午8 31 53 截屏2023-10-31 下午8 32 01

This specific issue was fixed in a beta release I believe, try updating and reply back with the results. Will need the full logs and debug mode enabled if still an issue.

samuelleung1009 commented 8 months ago

Hello, thank you for your reply. I have updated the latest beta and restarted it, but there are also new errors.

截屏2023-10-31 下午9 45 50
Seexelas commented 8 months ago

I have indeed no more the date error, but a new error shows, below the last logs :

https://www.swisstransfer.com/d/6fb27660-31cc-468f-a537-6de622f443e8

Thanks,

pantherale0 commented 8 months ago

Hello, thank you for your reply. I have updated the latest beta and restarted it, but there are also new errors.

Ok, I need the full logs from Home Assistant, could you provide and create a new issue please as this issue is separate from this one.

pantherale0 commented 8 months ago

I have indeed no more the date error, but a new error shows, below the last logs :

https://www.swisstransfer.com/d/6fb27660-31cc-468f-a537-6de622f443e8

Thanks,

Starting to look good now (despite the new error), we're slowly getting rid of the bugs, I know what needs to be done for that error, thanks for testing so quickly 👍

pantherale0 commented 8 months ago

Ok, another update @Seexelas - can you test again please? Hopefully this one sorts it.

Seexelas commented 8 months ago

Just tested, still one error :

image

pantherale0 commented 8 months ago

can you send logs please?

Seexelas commented 8 months ago

I forgot to past the link sorry :

https://www.swisstransfer.com/d/7abbeff8-1082-40dd-a028-dde366875164

pantherale0 commented 8 months ago

No worries :)

pantherale0 commented 8 months ago

ok, new update, can you test again please?

Seexelas commented 8 months ago

With version 0.1.4b5, KO :

https://www.swisstransfer.com/d/6c7a95cb-749b-435b-a7cc-71e75b3050ea

pantherale0 commented 8 months ago

ahh my fault there, didn't set the var in the module 👎

updated, try now.

Seexelas commented 8 months ago

So yes, the package broke my HA (don't worry, it's not an issue) :

https://www.swisstransfer.com/d/9b87a635-0ce2-4f26-880a-5552191d5064

The logs are here, if I remove the integration, it starts again.

I will clean everything, reboot and retry, and i'll let you know the result.

Seexelas commented 8 months ago

So i cleaned everything, new download of the last beta, restart. Configuration of the plugin, restart.

It still not working :

https://www.swisstransfer.com/d/456e3d92-650f-48ed-b3a7-e7e5cf2ce9c1

pantherale0 commented 8 months ago

Ok, that shouldn't have happened, pulled that release and created a new one to remove the issue registry stuff for now to see if that helps.

first logs didn't even show that the integration was installed.

Seexelas commented 8 months ago

Bravo ;) many thanks, i'll keep testing.

image

Seexelas commented 8 months ago

There is one more error in the logs, I don't know if it impact something :

https://www.swisstransfer.com/d/62c79761-a485-46c3-8ff2-4d0e966e213e

image

pantherale0 commented 8 months ago

@Seexelas if the error is this one:

2023-10-31 20:11:53.326 ERROR (MainThread) [custom_components.nintendo_parental] Error fetching nintendo_parental data: ('HTTP Exception', 'HTTP Error', 401)

That can happen, basically the access token that Nintendo issues expires after 10 minutes, its purely cosmetic though and the next request to the API will refresh the token in the background.

Also - because the API is not returning any of the daily information for your account, I would expect some of the values to be reported incorrectly. Kinda need someone who has the issue, can also intercept the HTTP requests that the mobile app makes and be able to debug the pynintendoparental module to be able to resolve that.

Make sure debug logging is turned off for now though, otherwise it will spam the logs quite a bit ;)

Will close this for now :) thank you for testing where I have been unable to.