dubocr / homebridge-tahoma

Homebridge plugin for TaHoma, Connexoon, Cozytouch, Energeasy Connect.
Apache License 2.0
133 stars 42 forks source link

Bad credentials --> Tahomaplugin crashes Homebridge #360

Closed flipse27 closed 2 years ago

flipse27 commented 2 years ago

Hi, i am using this Plugin for years without any issues. Since appr. 2-3months, I receive several issues regarding bad credentials.

This often happens after restarting homebridge (due to change of configurations). The complete plugin crashes my homebridge start. Most of the time, I have to wait 24hours and functionality comes back.

Loggin into tahomalink.com webpage with my phone works, using the Tahoma app works fine as well, but login to tahomalink.com from MacBook is not working fine --> error on server side.

Login to https://dev.duboc.pro/tahoma works fine as well.

What do you think happens here? How can I avoid crashing homebridge although login error to Tahoma (without disabling Tahoma plugin). When I disable Tahoma plugin, I can run homebridge, but after reactivating, all of my devices from Tahoma needs to be reassigned to my HomeKit and rooms and automations (I definitely need to avoid this)

Logfile Entry: [2/27/2022, 7:56:10 AM] [Tahoma] API client will be locked for 60 hours because of bad credentials or temporary service outage. You can restart plugin to force login retry. [2/27/2022, 7:56:10 AM] [Tahoma] API client will be locked for 60 hours because of bad credentials or temporary service outage. You can restart plugin to force login retry. [2/27/2022, 7:56:10 AM] [Tahoma] Bad credentials [2/27/2022, 7:56:10 AM] [Tahoma] Retry in 60 sec... [2/27/2022, 7:56:10 AM] UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Bad credentials". [2/27/2022, 7:56:11 AM] Got SIGTERM, shutting down Homebridge...

Config: "platforms": [ { "name": "Tahoma", "service": "tahoma", "user": xxxx, "password": "xxx", "exposeScenarios": true, "platform": "Tahoma" },

Thanks for your help

github-actions[bot] commented 2 years ago

Thank you for using Homebridge TaHoma plugin.

Please follow these step to obtain better support :

  1. Execute available commands (on,off,T°,mode,etc...) from official app (TaHoma/Cozytouch/etc.)
  2. Report your config by browsing https://dev.duboc.pro/tahoma
  3. Search issues with title corresponding to your device widget name (see picture below). If no opened issue, rename your issue with this widget name.
  4. Provide your bridge last 4 digits (number visible as SETUP-XXXX-XXXX-XXXX at step 2.) Widget

Thank you.

PrzemyslawKlys commented 2 years ago

I have the same problem with the exception that my HomeBridge doesn't crash:

[3/20/2022, 10:28:40 AM] [TaHoma] API client will be locked for 60 hours because of bad credentials or temporary service outage. You can restart plugin to force login retry.
[3/20/2022, 10:28:40 AM] [TaHoma] Polling error - Bad credentials

Restart helps and Tahoma works again.

luk4s commented 2 years ago

Same issue as @PrzemyslawKlys

[3/24/2022, 2:50:02 PM] [TaHoma] API client will be locked for 60 hours because of bad credentials or temporary service outage. You can restart plugin to force login retry.
[3/24/2022, 2:50:02 PM] [TaHoma] Polling error - Bad credentials

Restart helps... Its happened approx 3times in week... I restarting homebridge once a day by cron, but it seems it not helps. Irregularly it stuck on this error randomly 🙂

my setup - 4last digits: 6180

romanbody commented 2 years ago

Hi, similar issue, but restart does not help. I am not able to change IP address of router from my provider. Is it possible to reset this information on server/api side?

rubenstolk commented 2 years ago

Same issue. Whatever happens, it should not crash the Homebridge!

blmyr commented 2 years ago

1015BE00-0FAC-4A14-9D37-F1447465B539

Same problem, done a fresh homebridge setup yesterday and today is stopped working. Credentials are correct.

piejanssens commented 2 years ago

Might be related https://github.com/iMicknl/ha-tahoma/issues/289 Update: probably related 😄 ping @dubocr /setup is called every 30s it seems. In the link above you can find a mail from Somfy asking not to call that endpoint other than to setup new devices.

gymrat801 commented 2 years ago

1015BE00-0FAC-4A14-9D37-F1447465B539

Same problem, done a fresh homebridge setup yesterday and today is stopped working. Credentials are correct.

Did you find a resolution to your problem? I set up a new TaHoma account today and right off the bat I get this error message. I verified my password on the somfysystems.com page (TaHoma Account link), and I am able to login to my TaHoma iOS app and run my shades from there. However, my credentials do not work on tahomalink.com (I get "An error has occurred on the server" message, as opposed to "Incorrect login or password" when I use credentials I know are bad).

The thing that seems odd to me, based on what I'm reading about this error, is that I can't login to tahomalink.com from my MacBook (which is where my HomeBridge server is and therefore has the same IP as HomeBridge is reporting to the API), but I also can't login from my mobile while over my cell network, which is a completely different IP. This seems almost like a disconnect between the credentials systems at Somfy, plus the API block as discussed in this thread.

gymrat801 commented 2 years ago

For those of you working on this plugin or anyone who finds this thread, homebridge-connexoon just released an update today that isn't suffering from these connection issues. Previously they didn't support TaHoma USA, but by adding that today, I'm finally able to login successfully and everything is operational. I still can't even login to tahomalink.com, but homebridge-connexoon works. Check it out.

evenh commented 2 years ago

I'm also seeing this in my logs.

dubocr commented 2 years ago

Hi,

/setup refresh are made every 30 minutes (not seconds) except if user change refreshPeriod configuration. As this plugin take care of requesting backend sparingly, API lock are often result of server outage or too many homebridge restart. If users receive this kind of email from Somfy, I'm interested to be notified.

As I understand, API lock error is often (very often or always) followed by home bridge crash due to uncaught error on this plugin. Causing a restart, then an API ban.

I have made some improvement on uncaught error to avoid homebridge restart. This must fix consequent issues.

Please upgrade to latest release and I'm interested by any feedback (even if I'm not very prompt to answer). As I no longer have any equipment, it's quite difficult (impossible) for me to test.

Thank you.

rubenstolk commented 2 years ago

Latest doesn't install...

make: Entering directory '/usr/lib/node_modules/homebridge-tahoma/node_modules/mdns/build'
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_sd.o
In file included from ../src/dns_sd.cpp:1:
../src/mdns.hpp:32:10: fatal error: dns_sd.h: No such file or directory
 #include <dns_sd.h>
          ^~~~~~~~~~
compilation terminated.
make: *** [dns_sd_bindings.target.mk:180: Release/obj.target/dns_sd_bindings/src/dns_sd.o] Error 1
make: Leaving directory '/usr/lib/node_modules/homebridge-tahoma/node_modules/mdns/build'
PrzemyslawKlys commented 2 years ago

Btw. I had this issue for a very long time on Synology docker. Once I've moved my Homebridge to a VM on a server the issue stopped happening for a longer while. Now I noticed it came back again (not on latest release as I've not yet added it for testing).

rubenstolk commented 2 years ago

Solved by running:

sudo apt-get install libavahi-compat-libdnssd-dev

PrzemyslawKlys commented 2 years ago

During update via UX

USER: homebridge
DIR: /usr/local
CMD: sudo -E -n npm install -g homebridge-tahoma@2.2.23

(#################⠂) ⠋ reify:homebridge-tahoma: timing reifyNode:node_modules/homebridge-
> mdns@2.7.2 install
> node-gyp rebuild

gyp ERR! build error ⠧ reify:moment: timing reifyNode:node_modules/homebridge-tahoma Comp
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:10:17)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:18
gyp ERR! stack     at new Promise (<anonymous>)
gyp ERR! stack     at step (/usr/local/lib/node_modules/npm/node_modules/which/which.js:54:21)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:71:22
gyp ERR! stack     at new Promise (<anonymous>)
gyp ERR! stack     at subStep (/usr/local/lib/node_modules/npm/node_modules/which/which.js:69:33)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:80:22
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! System Linux 5.4.0-124-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/homebridge-tahoma/node_modules/mdns
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok 
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/homebridge-tahoma/node_modules/mdns
npm ERR! command failed
npm ERR! command sh /tmp/install-075c0f5d.sh

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/homebridge/.npm/_logs/2022-09-02T12_44_07_238Z-debug-0.log

Operation failed. Please review log for details.
PrzemyslawKlys commented 2 years ago

Ok installed make, G++ and it worked.

[9/2/2022, 12:50:47 PM] Registering platform 'homebridge-tahoma.Tahoma'
[9/2/2022, 12:50:47 PM] [TaHoma] Loaded homebridge-tahoma v2.2.23 child bridge successfully
[9/2/2022, 12:50:47 PM] Loaded 21 cached accessories from cachedAccessories.0E6B9EEB2A2F.
[9/2/2022, 12:50:47 PM] Homebridge v1.5.0 (HAP v0.10.2) (TaHoma) is running on port 48393.
[9/2/2022, 12:50:47 PM] [TaHoma] API client will be locked for 60 seconds because of bad credentials or temporary service outage. You can restart plugin to force login retry (not recommanded except if you think your credentials are wrong).
[9/2/2022, 12:50:47 PM] [TaHoma] Error 401 Bad credentials (AUTHENTICATION_ERROR)
[9/2/2022, 12:50:47 PM] [TaHoma] Retry in 60 sec...
[9/2/2022, 12:50:47 PM] [TaHoma] Fail to load lang file: Error 401 Bad credentials (AUTHENTICATION_ERROR)
dubocr commented 2 years ago

Thanks for you feedback.

Sorry for the installation issues, mdns lib was added to support Local API on TaHoma and Switch. This is optional but not the dependency.

PrzemyslawKlys commented 2 years ago

Another update to newer version:

image

dubocr commented 2 years ago

Another update to newer version:

image

Strange as the is no more dependency change in latest one. May last build break smthg even if it succeed. I'll publish a new version with another mdns lib in the evening. Hope it will help.

dubocr commented 2 years ago

Release 2.2.25 already deployed.

PrzemyslawKlys commented 2 years ago

Was much faster to install. No errors noticed.

alexrcd commented 8 months ago

Hi Romain,

Sorry for reopening this thread, I have exactly the same problem with the last est version, running a TaHoma classic interface, no way to get connected even tho my credentials are working on the TaHoma classic and web interface. Any clue ?

Thanks,

Alex