iMicknl / ha-tahoma

Custom component for Home Assistant to interact with smart devices via Somfy TaHoma or other OverKiz based API's.
MIT License
155 stars 30 forks source link

INVALID AUTH #466

Closed Zagor4 closed 3 years ago

Zagor4 commented 3 years ago

Yesterday the integration was perfect. This morning the integration didn't work and i found an error in the log:

Logger: custom_components.tahoma.config_flow Source: custom_components/tahoma/config_flow.py:102 Integration: Somfy TaHoma First occurred: 20:07:57 (1 occurrences) Last logged: 20:07:57

invalid_auth

I deleted the integration and i try to activate another time the integration, but when i put in it my credentials i see the same error: [%key:common::config_flow::error::invalid_auth%]

With the same credentials i'm able to access in Somfy App and in the Tahomalink.com internet site.

I'm not sure the is an integration Issue, because if i reset my password, i access in the tahomalink.com internet site, i clink on Tahoma section in my profile, i have a log off and i have to reset my password if i want to access an other time in the tahomalink.com internet site !

Does Somfy have some servers's problems ??

Thanks a lot

Mariusthvdb commented 3 years ago

Saw the same today, see post in community on the latest update .

Did a restart and now all is fine again ;-)

Give it a try ?

Zagor4 commented 3 years ago

Saw the same today, see post in community on the latest update .

Did a restart and now all is fine again ;-)

Give it a try ?

What i have to restart ? The Tahoma Box ? Home Assistant ? Thanks a lot for your answer !

Mariusthvdb commented 3 years ago

Home assistant ;-)

NicolasRigo commented 3 years ago

Same here from yesterday evening. I think this has nothing to do with HA or HACS. I guess your (and mine) IP have been banned from Somfy Restfull API server. The fact it happens to some of us means they probably modified something in their config that make their API more sensitive to the number of API calls they received.

A temporary solution (which is not one on the long run) is to restart your DSL/Cable modem to obtain a new IP from your ISP provider. Of course, it won't work for those like me who have a static IP address...

Can someone confirm my hypothesis?

Best regards

Przemo-999 commented 3 years ago

U mnie to samo!!!

cdeharo commented 3 years ago

Same here, I'm not sure if our IP is banned because the Connexoon application works fine from inside my local network (same public IP address as my HA).

NicolasRigo commented 3 years ago

you are right @cdeharo I'm not sure at all. Something strange happened Today. I gave a chance by rebooting my HA instance and it doesn't change anything. Then I upgraded HA to the latest version (2021.7 published yesterday) and guess what ... Tahoma integration is working now ... I don't understand. Let see if it still works tonight.

cdeharo commented 3 years ago

Thanks but I've just updated the Connexoon firmware from the official app and restarted HA (2021.6.6) and now all works fine. I'll update HA tomorrow, but this seems solved now.

iMicknl commented 3 years ago

Thanks all for reporting. Are these issues still present? If so, please turn on debug mode and share your logs.

Updating Home Assistant or the integration doesn't help directly, however it can prevent you by getting blocked since there is a longer time out in between the tries. I will see if I can port some of the code I wrote for the core integration, to this custom component. Unfortunately it doesn't seem like we will get in to core in the coming months...

MikeLDPT commented 3 years ago

Hi... I'm having this issue now. It temporarily went away the day before yesterday after I apllied several updates and restarted, but came back today. Still happening after 2 restarts. I can't find a way to manually authenticate.

This error originated from a custom integration.

Logger: custom_components.tahoma Source: custom_components/tahoma/init.py:121 Integration: Somfy TaHoma First occurred: 17:04:07 (1 occurrences) Last logged: 17:04:07

Invalid authentication..

This is very odd @iMicknl. I saw your message to turn on debugger, and went off to do so. After doing that by updating Configuartion.yaml and another restart Somfy is working fine again.

NicolasRigo commented 3 years ago

From my side, it went away the day after the first occurence without doing anything (neither restart nor upgrade). Until now it's still working but I expect the behaviour to occur again...

iMicknl commented 3 years ago

Until now it's still working but I expect the behaviour to occur again...

Unfortunately, this issue is fully on the side of Somfy. See https://github.com/iMicknl/ha-tahoma/issues/278 for similar issues last year. We have had contact with Somfy about this last time. If this keep being an issue, I will contact them again...

alexgraupera commented 3 years ago

I have the same problem with account authentication. I updated the integration to the last version and restarted HA.

I tried to access via thaomalink.com web but I can't access. Show a message with "username or password are invalid". It also doesn't work with password reset

I only have access in accounts.somfy.com dashboard. Tomorrow I'll try to contact with Somfy

alexanderfitu commented 3 years ago

Same issue here today, specifically getting:

[%key:common::config_flow::error::invalid_auth%]

iMicknl commented 3 years ago

Please make sure to update this integration to v2.4.12! I made some changes to the way we handle 'invalid authentication'.

Sometimes Somfy will throw a BadCredentials error, which isn't related to actually bad credentials. However, our integration keeps retrying this and this can cause a temporary block by Somfy... In the new version, this will throw an error in the interface which does ask you to relogin.

alexgraupera commented 3 years ago

After reading @NicolasRigo hypothesis, I have tried connecting through a VPN, testing the login on the tahomalink.com website ... and it worked

After trying the above I have restarted HA and it has worked. What surprises me is that I had not configured HA at any time through this VPN but it has worked

Could it be the account banned for some reason, and after entering through a different IP it is unlocked?

iMicknl commented 3 years ago

@alexgraupera if you update to the latest version (see message above) and/or temporarily disable the integration, it should work in a few days...

See my explanation above.

alexgraupera commented 3 years ago

Hey @iMicknl , sorry, I did not see your message. Just now HASS fired the new version from v2.4.11 to v2.4.12 After update it and restart HA has not displayed any invalid authentication message and works fine.

Thank you so much and good job!!!

MikeLDPT commented 3 years ago

Hi @iMicknl ... I too was on an earlier version and have just had the option provided to update to v2.4.12. I'll let you know if there are issues after update. Thank you!

lambu76 commented 3 years ago

I have same issue starting from yesterday. Yesterday evening HACS advised me about a new version available (2.5) I applied and I restarted HASSIO but when I try to reconfigure the integration "Somfy Tahoma" I got the error "invalid credential" even if the same credential are working fine on website somfy-connect.com. How to solve it ?

cdeharo commented 3 years ago

Today I've had again the issue (after updating to the last versions of HA and the integration). Multiple reboots hasn't solved the issue.

After reading @NicolasRigo hypothesis, I have tried connecting through a VPN, testing the login on the tahomalink.com website ... and it worked

After trying the above I have restarted HA and it has worked. What surprises me is that I had not configured HA at any time through this VPN but it has worked

Could it be the account banned for some reason, and after entering through a different IP it is unlocked?

Inspired on this comment of @alexgraupera, I accessed the Connexoon terrace mobile app outisde my local network, and then restarted the HA and voilà it worked.

lambu76 commented 3 years ago

I have same issue starting from yesterday. Yesterday evening HACS advised me about a new version available (2.5) I applied and I restarted HASSIO but when I try to reconfigure the integration "Somfy Tahoma" I got the error "invalid credential" even if the same credential are working fine on website somfy-connect.com. How to solve it ?

Let add that somfy-connect and app are working fine in both below cases:

Currently I disabled the Somfy Tahoma integration and I will wait 24 hours for a new try from HASSIO....let's see tomorrow.

Mariusthvdb commented 3 years ago

not sure if this was already added above (quick search executed... sorry if I missed), but just for reference:

When experiencing the invalid auth, not only does the Somfy App still work as expected, but also the Google assistant connection (directly linked, so not via HA Nabucasa cloud) to the individual devices work perfectly.

Several cover groups, created in HA, which are connected over HA Nabucasa don't of course...

Underlining my stance to always keep the original and dedicated Hubs and connections next to the HA integration.... Also reason for me to never logout of the official account, because that is not where the issue lies in this case.

mstuij commented 3 years ago

I have also the problems since yesterday.

With the Somfy app everything is working correct. I have no device reboot (not HA device, not the Tahoma device). I have also not updated HA for some time.

This is the log in Home Assistant:

`Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.tahoma Source: custom_components/tahoma/coordinator.py:78 Integration: Somfy TaHoma First occurred: 29 juni 2021 10:31:31 (2012 occurrences) Last logged: 9:41:54

Unexpected error fetching device events data: Bad credentials Traceback (most recent call last): File "/config/custom_components/tahoma/coordinator.py", line 67, in _async_update_data events = await self.client.fetch_events() File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 215, in fetch_events response = await self.post(f"events/{self.event_listener_id}/fetch") File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 333, in post await self.check_response(response) File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 371, in check_response raise NotAuthenticatedException(message) pyhoma.exceptions.NotAuthenticatedException: Not authenticated

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 180, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/tahoma/coordinator.py", line 78, in _async_update_data await self.client.login() File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 95, in login response = await self.post("login", data=payload) File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 333, in post await self.check_response(response) File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 367, in check_response raise BadCredentialsException(message) pyhoma.exceptions.BadCredentialsException: Bad credentials `

iMicknl commented 3 years ago

Thanks all for your replies! Unfortunately this is not an issue on the side of the integration directly, for example this also happens with the homebridge integration. In essence it is exactly the same as last time (https://github.com/iMicknl/ha-tahoma/issues/278) and it seems our counter measures haven't been implemented in the right way.

The API will throw a 'BadCredentials' error when there is an outage. However since we think you have the right credentials, we are retrying for a few times. In the new integration update from yesterday, I made sure we are only retrying 2 times and than we ask the user to reconfigure the integration. Hopefully this will prevent this from happening next time.

I am in contact with our contact person at Somfy and he is very helpful again! ❤️ At least someone at Somfy cares about Home Assistant users.

For now, my advice to resolve this. Remove the HA integration, update to the latest version and try to add the integration again. If this throws an error, wait for a while (maybe up to a day) and try again. Users above suggested to login successfully from another IP address, which could remove the account ban.

Mariusthvdb commented 3 years ago

**

Users above suggested to login successfully from another IP address, which could remove the account ban.

**

if its of any use: I did so, turning on my Vpn connection (is a useful hack for when we get self-banned too), but this didn't solve the issue at all.

Glad you keep on working at it, and of course grateful for the assistance by Somfy! Thanks for that!

alexgraupera commented 3 years ago

if its of any use: I did so, turning on my Vpn connection (is a useful hack for when we get self-banned too), but this didn't solve the issue at all.

@Mariusthvdb after connect the Vpn connection, did you logout and login on the platform of Somfy / Tahomalink (for example web interface) from this connection? Other way, you can try to login via web into Somfy / Tahomalink with a device mobile (with mobile 3g/4g connection, no wifi) and incognito tab for example. The hypothesis is make a login using a different IP than HA connection

After trying the above, if the login was successful, restart HA. Also remember to update to the latest integration version (2.5.0) which tries to prevent this from happening

The last option, as @iMicknl comment above, is to wait while this supposed ban disappears for the account

Mariusthvdb commented 3 years ago

Not sure what the internals did, but I didn't touch the Somfy connection myself. I did force close my HA app, and reopened after which it must have connected over the new IP address.

I already have the latest now, and haven't seen the issue yet, was merely trying to help adding information. If that wasn't the correct procedure, sorry for adding useless info ;-)

golles commented 3 years ago

I also experience this issue yesterday, I could also not login into https://www.tahomalink.com/ (other Somfy sites worked fine, password reset also worked fine, but still couldn't log in). I've disabled the integration overnight and just checked and noticed I could log in again into https://www.tahomalink.com/ Now I enabled and restarted HA and it works fine :-)

I agree this isn't an issue for this component, but I suggest keeping it open for a while so people can find this with all the suggested instructions. At least, it did help me

lambu76 commented 3 years ago

I have same issue starting from yesterday. Yesterday evening HACS advised me about a new version available (2.5) I applied and I restarted HASSIO but when I try to reconfigure the integration "Somfy Tahoma" I got the error "invalid credential" even if the same credential are working fine on website somfy-connect.com. How to solve it ?

Let add that somfy-connect and app are working fine in both below cases:

  • connecting through the local network where I have HASSIO by using wifi or eth cable
  • connecting via mobile phone by using 4G network Personally I don't think it's a problem of IP blocked related to the user.

Currently I disabled the Somfy Tahoma integration and I will wait 24 hours for a new try from HASSIO....let's see tomorrow.

Quick update.

I decided to try one more time and after more or less 3 hour I reenabled the integration and automaticcaly it went back working fine...w/o doing anything else expect re-enabling it.

baggy13 commented 3 years ago

Got this error yesterday too.

Just can confirm that the only way out seems to deactivating the TaHoma Integration for more than an hour. After this I could reconfigure it successfully.

github-actions[bot] commented 3 years ago

'There hasn't been any activity on this issue recently. Is this issue still present? Please make sure to update to the latest Home Assistant version and version of this integration to see if that solves the issue. Let us know if that works for you by adding a comment 👍. This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.'

iMicknl commented 3 years ago

Let's close this issue for now. It seems that we are able to, finally, recover from this status and prompting the users to reauth.