kopiro / homebridge-tapo-camera

Homebridge plugin for TP-Link TAPO security cameras
ISC License
119 stars 10 forks source link

Update C210 FW to 1.3.9 error message "Invalid cloud password" appears #90

Closed iamxuans closed 7 months ago

iamxuans commented 7 months ago

I updated my Tapo C210 camera to version 1.3.9. After that, the integration could no longer connect to the camera. Ihave other two C210 stay on FW 1.3.7 are fine. Could you help to fix this problem?

Error at 'getStatusAndUpdateCharacteristics'. Error: Unable to find token in response, probably your credentials are not valid. Please make sure you set your TAPO Cloud password at TAPOCamera.fetchToken (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:72:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at TAPOCamera.tokenPromise (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:96:23) at TAPOCamera.getTAPOCameraAPIUrl (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:107:19) at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:133:23 at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:228:18) at CameraAccessory.getStatusAndUpdateCharacteristics (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:228:27) at CameraAccessory.setup (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:259:7) at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraPlatform.ts:30:9

rgavril commented 7 months ago

I have the same problem, running the same firmware version : 1.3.9

As a temporary workaround I "enabled" this options for the camera:

This way the plugin avoids using the api token and ,at least, get the video stream available.

PedrooMR commented 7 months ago

Hello, I have the same issue.

FrancoisDucrot commented 7 months ago

Hi, Same problem here, any update ?

adamb3ll commented 7 months ago

1.3.9 has changed the http requests to the camera.

The request has changed from a user and password, to what looks like two login calls, the first with a cnonce receiving back a "device_confirm" that appears to be different each time, and a "key" that looks consistent. The second login then uses the same cnonce and a "digest_passwd". No idea what they use to generate that.

Following a successful logon, further requests such as enabling notifications uses:

{
  "method" : "securePassthrough",
  "params" : {
    "request" : "large alphanumeric here"
  }
}
MarrinerK commented 7 months ago

In an attempt to offer some more context, this is my experience

I have 3 C310 cameras - 2 reporting to be Hardware Version 2.0, 1 Hardware Version 1.0

One of the Version 1 cameras have auto updated its firmware to v 1.3.9 Build 231024 Rel.73362n(4555). The other to v 1.3.9 Build 231024 Rel.62920n(4555)

The Version 2 camera is on v 1.3.7 Build 230714 Rel.47798n (4555) and will not do a firmware update either manually or auto

All three are working as expected through Tapo iOS app and via NX-V on a Mac using the (unchanged) log-in details (as used by HB).

Only the two Version 1 cameras are available via HB. The console issues reported are:

[11/15/2023, 1:20:38 PM] [homebridge-tapo-camera] Error at 'getStatusAndUpdateCharacteristics'. Error: Unable to find token in response, probably your credentials are not valid. Please make sure you set your TAPO Cloud password at TAPOCamera.fetchToken (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:72:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at TAPOCamera.tokenPromise (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:96:23) at TAPOCamera.getTAPOCameraAPIUrl (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:107:19) at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:133:23 at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:228:18) at CameraAccessory.getStatusAndUpdateCharacteristics (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:228:27) at CameraAccessory.setup (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:259:7) at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraPlatform.ts:30:9 [11/15/2023, 1:20:38 PM] [homebridge-tapo-camera] Error at 'getStatusAndUpdateCharacteristics'. Error: Unable to find token in response, probably your credentials are not valid. Please make sure you set your TAPO Cloud password at TAPOCamera.fetchToken (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:72:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at TAPOCamera.tokenPromise (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:96:23) at TAPOCamera.getTAPOCameraAPIUrl (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:107:19) at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:133:23 at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:228:18) at CameraAccessory.getStatusAndUpdateCharacteristics (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:228:27) at CameraAccessory.setup (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:259:7) at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraPlatform.ts:30:9

letens commented 7 months ago

same issue here ... disabling Privacy / Alarm / Motion works a bit but error keeps on appearing

kopiro commented 7 months ago

Hello folks, I'll focus this weekend on trying to understand if there is a way to re reverse-engineer the way the token exchange works.

kopiro commented 7 months ago

Hey folks, unfortunately my camera latest firmware is still 1.3.6, there's no update available. I can try to check if someone wrote a new library that already fixes this issue and trying to replicate the same behaviour, but without a test device it's impossible for me to test it and be reactive.

MarrinerK commented 7 months ago

Update from me

The camera that was HW v2 and seemingly stuck on 1.3.7 has now updated to 1.3.9. After removing it and adding back to Home it now works through HB as expected.

Still have the error messages in the console but functionally things seem to have improved.

adppark commented 7 months ago

I also have same issue. C100 is HW v1 and fw 1.3.9 and C200 is HW v1 and fw 1.3.9 Streaming works when you click on the screen, but it returns to a no-response state. The privacy mode switch does not operate with no response. I hope this problem will be solved as soon as possible..

iamxuans commented 7 months ago

How could we help you to verify the solution?

Hey folks, unfortunately my camera latest firmware is still 1.3.6, there's no update available. I can try to check if someone wrote a new library that already fixes this issue and trying to replicate the same behaviour, but without a test device it's impossible for me to test it and be reactive.

makraip commented 7 months ago

HA guys solved the new authentication coming with 1.3.9, maybe it helps: https://github.com/JurajNyiri/HomeAssistant-Tapo-Control

Fabuloulou commented 7 months ago

Hello, Same problem with one of my TAPO C200 cameras with 1.3.9 firmware. No privacy mode changes possible with this firmware.

My second C200 is still with 1.3.6 firmware and work fine withour error.

TA2k commented 7 months ago

Here is the flow for the new firmware in python https://github.com/JurajNyiri/pytapo/blob/5e7df7d0e05065d2f04990cb1db0a2cd75d13775/pytapo/__init__.py#L301

kopiro commented 7 months ago

This is very good, thank you. I'll try to implement it tomorrow!

On Fri, 24 Nov 2023 at 23:43, TA2k @.***> wrote:

Here is the flow for the new firmware in python

https://github.com/JurajNyiri/pytapo/blob/5e7df7d0e05065d2f04990cb1db0a2cd75d13775/pytapo/__init__.py#L301

— Reply to this email directly, view it on GitHub https://github.com/kopiro/homebridge-tapo-camera/issues/90#issuecomment-1826120876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGNAFAT526PE2TS3JZQHPDYGEPKRAVCNFSM6AAAAAA7GO2T6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGEZDAOBXGY . You are receiving this because you were assigned.Message ID: @.***>

kopiro commented 7 months ago

Alright it actually looks like I can now update to 1.3.9, let's see :)

kopiro commented 7 months ago

Ongoing PR: https://github.com/kopiro/homebridge-tapo-camera/pull/94

kopiro commented 7 months ago

https://github.com/kopiro/homebridge-tapo-camera/releases/tag/v2.3.0

iamxuans commented 7 months ago

Thanks!!

Fabuloulou commented 7 months ago

Hi, After update to 2.3.1, I have this error : [homebridge-tapo-camera] Error at 'getStatusAndUpdateCharacteristics'. Error: Unknown password encryption method at TAPOCamera.getHashedPassword (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:88:13) at TAPOCamera.refreshStok (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:175:28) at processTicksAndRejections (node:internal/process/task_queues:95:5) at TAPOCamera.getAuthenticatedAPIURL (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:339:19) at /homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:419:23 at TAPOCamera.getStatus (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:559:18) at CameraAccessory.getStatusAndUpdateCharacteristics (/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:234:27) at CameraAccessory.setup (/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:265:7) at /homebridge/node_modules/homebridge-tapo-camera/src/cameraPlatform.ts:30:9

on my 2 cameras with 1.3.6 and 1.3.9 firmwares

kopiro commented 7 months ago

@Fabuloulou does this happen on both cameras? Can you share more logs after having enabled debug logs and making sure you redact sensitive informations?

Fabuloulou commented 7 months ago

yes same problem on both cameras. After activate debug in the setting for both cameras, no more log appears in homebridge console.

Capture d’écran 2023-11-29 à 13 51 00
Fabuloulou commented 7 months ago

i have a few more logs : ` [11/29/2023, 2:01:29 PM] [homebridge-tapo-camera] Error at 'getStatusAndUpdateCharacteristics'. Error: Unknown password encryption method at TAPOCamera.getHashedPassword (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:88:13) at TAPOCamera.refreshStok (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:175:28) at TAPOCamera.getAuthenticatedAPIURL (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:339:19) at /homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:419:23 at TAPOCamera.getStatus (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:559:18) at CameraAccessory.getStatusAndUpdateCharacteristics (/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:234:27) at Timeout._onTimeout (/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:212:7)

/homebridge/node_modules/homebridge-tapo-camera/node_modules/onvif/lib/events.js:309 callback.call(this, err, data, xml); ^ TypeError: callback.call is not a function at Cam. (/homebridge/node_modules/homebridge-tapo-camera/node_modules/onvif/lib/events.js:309:14) at ClientRequest. (/homebridge/node_modules/homebridge-tapo-camera/node_modules/onvif/lib/cam.js:328:4) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at processTicksAndRejections (node:internal/process/task_queues:82:21) [11/29/2023, 2:01:49 PM] [homebridge-tapo-camera] Child bridge process ended [11/29/2023, 2:01:49 PM] [homebridge-tapo-camera] Process Ended. Code: 1, Signal: null [11/29/2023, 2:01:56 PM] [homebridge-tapo-camera] Restarting Process... [11/29/2023, 2:01:58 PM] [homebridge-tapo-camera] Launched child bridge with PID 5854 [11/29/2023, 2:01:59 PM] Registering platform 'homebridge-tapo-camera.tapo-camera' [11/29/2023, 2:01:59 PM] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.3.1 child bridge successfully [11/29/2023, 2:01:59 PM] Loaded 0 cached accessories from cachedAccessories.XXXX. [11/29/2023, 2:01:59 PM] Homebridge v1.7.0 (HAP v0.11.1) (homebridge-tapo-camera) is running on port 58528. [11/29/2023, 2:02:01 PM] [homebridge-tapo-camera] Error at 'getStatusAndUpdateCharacteristics'. Error: Unknown password encryption method at TAPOCamera.getHashedPassword (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:88:13) at TAPOCamera.refreshStok (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:175:28) at processTicksAndRejections (node:internal/process/task_queues:95:5) at TAPOCamera.getAuthenticatedAPIURL (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:339:19) at /homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:419:23 at TAPOCamera.getStatus (/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:559:18) at CameraAccessory.getStatusAndUpdateCharacteristics (/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:234:27) at CameraAccessory.setup (/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:265:7) at /homebridge/node_modules/homebridge-tapo-camera/src/cameraPlatform.ts:30:9 [11/29/2023, 2:02:01 PM] Sejour CE0E is running on port 44335. [11/29/2023, 2:02:01 PM] Please add [Sejour CE0E] manually in Home app. Setup Code: XXX `

kopiro commented 7 months ago

You need to put the whole homebridge in Debug mode

Fabuloulou commented 7 months ago

I'm trying but I use docker to run homebridge and I'm very novice with docker and container. I can't find the way to start in debug mode with docker. Maybe you can help ?