gcobb321 / icloud3_v3

iCloud3 v3, Development Version - This Repo/Version is used for development and testing of new and updated features. It is not the official release of iCloud3 v3, .
MIT License
169 stars 13 forks source link

Still not working #367

Open Eifel-Joe opened 2 weeks ago

Eifel-Joe commented 2 weeks ago

iCloud3 ist still not working for me.

Since the problem with Apple started i did every update for icloud3. Actually running on 3.1.3. It works for a few hours and then stops. iCloud3 says not logged into Apple account and i'm not able to log in again. I have to delete everything, wait a few hours and reconfigure icloud3 from scratch to start working again. But only for a few hours until it says again not logged in.

I do not know to do now.

image

gcobb321 commented 2 weeks ago

Check the Event Log for status and error messages. Request a verification code after logging in I in the Update Apple Username/Password screen. Look at the log file before that message and look for error response codes from Apple. 200is Ok, 401= invalid password, 409=valid password, see if there is anything enter a password SRP request.

Eifel-Joe commented 2 weeks ago

Logfile told me 409, password valid. Thats what i expected. But login used a long time and the window told me an error occured. Nothing in the logfile.

After completly deleting everything of icloud3 in the ui and the rest by hand from the config-directory, i installed the integration again. At first it had the same behavor. After one more hour i had no problems anymore and could log in within a half minute, requested a new code, send the code and everything worked as expected again.

This is what i'm doing for the last three days. Everything is fine and on the next mornig the complete integration won't work. And all i get from the logs is a password valid code, but in the configuration-window of icloud3 it says not logged in and when i try to log in with definitfly correct password the red circle moves for at leat 15 minutes and nothing goes on. It is stuck.

gcobb321 commented 2 weeks ago

It has to be something related to Apple doing something related to your account. Do you have another account you could try (spouse) to see if that is what is going on. I know there are others with valid passwords that could not let log in. See here for info on that.

Go to Configure Settings > Page 2 > Format Parameters screen and set Log Level to ‘Debug’. Then restart HA. Do what you need to do so it is running.

When it locks up again at midnight and stops working, zip the icloud-0.log and send to geekstergary@gmail.com. Also zip the icloud3-1.log and send to geekstergary@gmail.com in a different email.

I’ll look at them and see if I can tell what is going on.

Eifel-Joe commented 1 week ago

I will do as you told me. What i can say by now, is that i don't think it has something to be with my password. Of course the whole integration got stuck this night. But as far as i can read the logs, icloud3 can still log in or is logged in but it gets no more data from icloud. Problems start aroud the time, my router does a new connection to my ISP to prevent a cut off from the ISP during worktime. Of course icloud3 wants exactly during this time new data but don't get them. Since this time all data are old and then around 3 hours later the integration gets stuck. I have to restart icloud3, but for now it does not go further than stage 1 and i'm not able to do anything.

During this day i will setup icloud3 again. But i have to wait a few hours before i can do this. I will send you the logs tomorrow.

And please forgive me for my bad english. I'm german but i will do my best. 😉

gcobb321 commented 1 week ago

I think there is another user with the same issue of a router restart at midnight. This was my reply. See his issue here

It does look like another HA Integration also gets disconnected when your router is rebooted and the http cannot connect with its data source. To fix this, you will need to restart HA after your router is rebooted. I would create an automation to restart HA using the home_assistant.restart Action with the time you want it to restart. There are probably examples in the HA docs.

Eifel-Joe commented 1 week ago

Ok, i'll try. But this problem first occurred now with the Apple icloud "problem". My router has always disconnects at night and there is no new integration in my system for last 2 month.

JtwoA commented 1 week ago

Ok, i'll try. But this problem first occurred now with the Apple icloud "problem". My router has always disconnects at night and there is no new integration in my system for last 2 month.

Yes, but Apple changed how they're authenticating and the router restarts may be aggravating their new methods.

Eifel-Joe commented 1 week ago

Just read the other issue. With a simple restart of HA i can not fix the problem.

Also the whole icloud integration won't do anything. After a few hours icloud3 says that i'm not logged in. When i try log in again it won't do anything visible for at least 15 minutes and then it says an error occured. In the log it see code 409, which you told it is valid password. This is the point when i completly removed the integration the last few days. Also everything in all directorys. After a normal installtion through HACS i just configure icloud3 and everything is working fine again.

At next i will set the debug log and try to automate a restart after reconnect the ISP. If it will fail again i send you the logs tommorrow.

@JtwoA This may be a reason, but why does the integration stall after a few hours.

JtwoA commented 1 week ago

but why does the integration stall after a few hours.

Because Apple is doing something with the login TTL? I don't know. I know from my day job that Apple has been messing with the ciphers. TOO much change happening.

Eifel-Joe commented 1 week ago

@gcobb321 Send the logs to you this morning.

Still same problem as every morning for me. What i did is to pause location tracking before disconnection to my ISP by an automation. After reconnection i did an automated restart of HA. Since then icloud3 was not able to log in my account and stops working. Even if i try to log in through the configuration window of icloud3 nothing happens. I stuck in this window with a rotation blue circle in the lower right corner of the window and quits after at least 5 minutes with the message "Unknown error occurred".

Eifel-Joe commented 1 week ago

Because Apple is doing something with the login TTL? I don't know. I know from my day job that Apple has been messing with the ciphers. TOO much change happening.

Ok, i don't know much about those things but if something has changed it should be changed the whole time and not only in morning after a restart of HA. When i'm back from work in the evening and after deleting everything from my system to reinstall icloud3 an reconfigure everything works again. If something has changed, it should also be changed at this time. But no, i can log in, get my verification code and can send it back. Even my devices can be tracked. This whole procedure doesn't make sense. It looks just as they change something every morning and change back in the evening. And looking at other people using icloud3, it seems they are just changing for me. 😅

gcobb321 commented 1 week ago

@Eifel-Joe It is not necessary to delete the iCloud3 integration and readd it. All that does is to reinstall the same code you just removed. What exactly are you deleting? icloud3 directory which contains the configuration parameters? _icloud3.appleacct which contains the Apple cookies and session info? Deleting the cookies and session info causes your password to be reversed instead of using the existing trust tokens.

If it is only happening for you (and maybe someone else) and you both are rebooting your router at midnight, that would make me think that is the root cause of the problem. Can you reboot it at a different time?

Eifel-Joe commented 1 week ago

@gcobb321 I delete everything you mentioned. Otherwise i can not log in. I tried different scenarios, but no one works except that one with deleting all. Can't understand it either because same code ist reinstalled.

My router is rebooting between 4-5am german time. I think that has to be UTC+2. I can try somewhere between 1-4am, maybe 5-6am also. Otherwise my wife...... You know smarthome and women sometimes can be difficult because of the wife acceptence factor. 😅

Eifel-Joe commented 1 week ago

@gcobb321 Because of deleting icloud3.apple_acct i now understand why it takes such a long time before it will work again. But without deleting i'm still unable to log in. Thats the point when the integration stucks and the unknown error occures.

gcobb321 commented 1 week ago

I never received the Log files you sent. Could you send them again.

Eifel-Joe commented 1 week ago

@gcobb321 They are out again. I send them at geekstergary@gmail.com

gcobb321 commented 1 week ago

I have looked at the files and, yes, everything is fine until the pause, router reset, restart. Here is the 11-13

05:01:51 _INIT_  Setting up iCloud3 v3.1.3
11-13 05:01:56 _INIT_  Verify Apple Account Username/Password
11-13 05:02:17 _INIT_ ENGLER_JOERG, POST, REQUEST,  VALIDATE_USERNAME_PASSWORD/541
—   items={'url': 'setup.icloud.com/setup/authenticate/engler_joerg@…………', 'retry': 0, 'data': None, 'json': None}
—   headers={'Authorization': 'Basic ……E1LSs='}
11-13 05:18:05 _INIT_  ENGLER_JOERG, POST, RESPONSE, VALIDATE_USERNAME_PASSWORD/541 
—   items={'code': 409, 'ok': False}
11-13 05:18:05 _INIT_  engler_joerg, Validate Username/Password Results, Valid-True

At 05:02:17, iCloud3 sends a request to Apple to verify your password At 05:18:06, iCloud3 receives the response that the password is valid.

It took 16 minutes between when the request was sent to when the response was received. This normally happens immediately. During that time, HA probably shut down iCloud3 thinking it had stopped running. There are probably errors in the home-assistant.log file around this time.

  1. Set Log Level to Debug on Configure Settings > Format Parameters screen . This is better than the Debug-auto reset since it does not get reset to Info at midnight.
  2. Restart HA

When it locks up again, go to HA Settings > System > Logs and look for any errors by any programs around or after the reset time.

Have you tried rebooting your HA server(Raspberry Pi?) after the router reset instead of just restarting HA . Maybe it is having problems connecting it the router/internet after the reset. There is an HA Action hassio.host_reboot, that might do that. I have never used it but it might do something.

Eifel-Joe commented 1 week ago

@gcobb321 I will change the log level in the configuration screen.

I also had tried to reboot in the past, but it was the same as a restart. icloud3 don't work again. Im running HA as a VM on Proxmox for several month now. As hardware i use a NUC. I assigned 4 cores and 8 GB of RAM for HA. Newer had any issues with this setup. This Proxmox server is integrated in an Unifi network. This connection is stable. WAN comes from my DSL router AVM FritzBox. This is a seperated network which i can not change because of my ISP. At the logs of my router i can see that connection is broken for just 2 seconds on 11-13 at 4:34am. So connection was stable at the time icloud3 request to authenticate. But everytime i break connection i get a new IP from my ISP. Static IP is nothing common here in germany. In my private networks i have static IP on IPv4. But i also have IPv6 on both networks. FritzBox and Unifi. I will try to lookup if the ipV6 on my HA also changes at the point of reconnection. As far as i know they are more or less assigned by the ISP. Disable of IPv6 is not an option because i also use Thread at my home. Could this be the problem since Apple has changed things?

This night was the same. After a reboot of HA this morning it now tells me, that there is a problem with icloud3. It needs to be a new authentification. When i click on that this window shows up. image I requested the verfication code which i get immediatly and even icloud3 didn't stuck this morning. I send it back to Apple and now icloud3 works again.

This was the first time. But in the past i tried with restart HA instead of reboot.

Eifel-Joe commented 1 week ago

I've just done some reading about my DSL connection being disconnected at night. This seems to be a relic from the past, when ISPs still carried out forced disconnections every 24 hours. This function within the FritzBox is therefore only used to determine this time yourself.

I will therefore deactivate the time-controlled disconnection today, as a forced disconnection by the ISP only takes place every 180 days in order to reassign the IP addresses.

If everything is still working tomorrow morning, this would possibly support my theory that it is related to the new IPv6 addresses.

Eifel-Joe commented 1 week ago

After I implemented what I just wrote, the FritzBox restarted, so that I got new IP addresses again. Both IPv4 and IPv6 from my ISP. After that, icloud3 stopped working. So I rebooted HA again and icloud3 started, but there was another error and it froze. Here is the extract from the log. image

Interestingly, at this point HA still had the same IPv6 addresses as before. After another reboot, HA got more IPv6 addresses and icloud3 started as if nothing had ever happened. No errors, all entities are updated and correct.

To me it looks like it has something to do with the IPv6 addresses. The system only gets new addresses assigned after a reboot, or rather it gets them through the new connection to the router.

Eifel-Joe commented 1 week ago

Ok, thats strange. About 1.5 hours later now, icloud3 stucks again. image

A new reboot of HA did fix it. But no new IPv6 addresses are assigned to my System.

I could not find other error in the logs of HA at that time.

Eifel-Joe commented 1 week ago

So no problems this morning. I did a manual reconnection to my ISP and boom, no more data from icloud. No other probs in my system. I rebooted HA so it gets a new IPv6 and everything is running fine again without any relogin or something else.

HA never had the IPv4 or IPv6 from my ISP in the last 3 month since i switch my homenetwork to Unifi behind my AVM router and never had problems. Even now it does not know them. Probs first started as Apple has changed the log in, so in my opinion it has something to do with the IPv6 of the HA system because that is the only thing that changes after a reconnection to my ISP on my HA. @gcobb321 is there some logging that i can provide to you to confirm this? Or maybe for those people who wrote the new log in code?

GerdRuetten commented 1 week ago

@Eifel-Joe Why does your router restart at all? Is this a forced reconnect from your ISP? Which router model do you use?

Eifel-Joe commented 1 week ago

@GerdRuetten My router does not restart. In the past ISP's in germany did a forced disconnect every 24 hours. I guess you are german so i think you know it. It's long time ago. Because of that there is a relic configuration in routers that you can force the disconnection into a time you want the disconnection so it doesn't bother you because it does that at sleeptime. I still had this configuartion in my DSL router because i just forgot it. I changed the router many times but never reconfigured them. I just used backup configurations for the new ones. But because things changed ISP's don't do this anymore. Just only all 180 days, because they have to renew the IP addresses.

Since i disabled this configuration on my router i do not have any problems anymore with icloud3. i always used AVM FritzBox routers. Actual i use FritzBox 7490.

Because in my private network nothing changes after a ISP reconnection but the IPv6 prefix an because of that also the IPv& of my HA system, i think the Apple login now has something to do with these IPv6 address. HA only gets this new IPv6 address after reboot which is a normal behavor. With this new and correct IPv6 the login work again. So i guess the login has something to do with that. Without the new IPv6 for HA icloud3 has still the old one for log in and this is the point when it stucks on my system.