kopiro / homebridge-tapo-camera

Homebridge plugin for TP-Link TAPO security cameras
ISC License
131 stars 12 forks source link

Toggle accessories are not working after updating from v2.3.4 to v2.4.1 #151

Closed Kiran-B closed 1 month ago

Kiran-B commented 3 months ago

Describe Your Problem:

I am using this plugin to expose two of the Tapo C320WS cameras to Apple Home. The integration was working fine until I decided to update the plugin from v2.3.4 to v2.4.1.

Post update the Cameras continue to list in Apple Home and the video feed is also streamed. But all the camera accessories(like the eyes, alarm) are non-responsive.

Important Note: When I attempted to perform an update to v2.4.1, it suggested that I update Node to v20.16.0. My home bridge was running on Node v18 LTS. So I updated homebridge to the latest version using hb-config GUI. The log read: Unpacking homebridge (1.3.4) over (1.1.6) ... But the Node version remained at v20.15.0. So I update Node using hb-config GUI. The log read: Updating Node.js from v20.15.0 to v20.16.0.... Once I updated Node to v20.16.0, I performed the plugin update from the Homebridge web UI.

I see two distinct errors in the Homebridge logs.

Logs:

[05/08/2024, 15:42:44] [CAMERA_NAME] Error when retrieving data Error: Invalid device confirm
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:213:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:349:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:429:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:612:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:205:28)

and

[05/08/2024, 15:43:29] [homebridge-tapo-camera] This plugin threw an error from the characteristic 'On': Unhandled error thrown inside read handler for characteristic: Invalid device confirm. See https://homebridge.io/w/JtMGR for more info.

Plugin Config:

{
    "cameras": [
        {
            "name": "Name1",
            "ipAddress": "192.168.x.y",
            "username": "redacted_email",
            "password": "redacted_password",
            "streamUser": "redacted_username",
            "streamPassword": "redacted_password",
            "debug": true
        },
        {
            "name": "Name2",
            "ipAddress": "192.168.x.z",
            "username": "redacted_email",
            "password": "redacted_password",
            "streamUser": "redacted_username",
            "streamPassword": "redacted_password",
            "debug": true
        }
    ],
    "_bridge": {
        "username": "redacted_string_that_looks_like_MAC_address",
        "port": 33593
    },
    "platform": "tapo-camera"
}

Screenshots:

UnresponsiveControls

Environment:

lebence commented 3 months ago

same here

Suzuhana commented 3 months ago

Seeing same errors

Kiran-B commented 3 months ago

I updated to version v2.4.3 with a hope for a fix for this issue. It resulted in a plugin crash. Makes me wonder whether there is any config issue at my end? Here are the logs:

[09/08/2024, 08:50:21] [homebridge-tapo-camera] Launched child bridge with PID 11462
[09/08/2024, 08:50:21] Registering platform 'homebridge-tapo-camera.tapo-camera'
[09/08/2024, 08:50:21] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.4.3 child bridge successfully
[09/08/2024, 08:50:22] Loaded 0 cached accessories from cachedAccessories.0xxxExxxFxxx.
[09/08/2024, 08:50:22] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-tapo-camera) is running on port 33xx3.
[09/08/2024, 08:50:22] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[09/08/2024, 08:50:22] [CAMERA_NAME] is running on port 32xx7.
[09/08/2024, 08:50:22] Please add [CAMERA_NAME] manually in Home app. Setup Code: xxx-xx-xxx
[09/08/2024, 08:50:22] [CAMERA_NAME] is running on port 38xx3.
[09/08/2024, 08:50:22] Please add [CAMERA_NAME] manually in Home app. Setup Code: xxx-xx-xxx
Error: Invalid device confirm
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:213:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:340:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:348:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:429:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:612:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:204:26)
[09/08/2024, 08:50:23] [homebridge-tapo-camera] Child bridge process ended
[09/08/2024, 08:50:23] [homebridge-tapo-camera] Process Ended. Code: 1, Signal: null
[09/08/2024, 08:50:30] [homebridge-tapo-camera] Restarting Process...
[09/08/2024, 08:50:31] [homebridge-tapo-camera] Launched child bridge with PID 11xxx
[09/08/2024, 08:50:31] Registering platform 'homebridge-tapo-camera.tapo-camera'
[09/08/2024, 08:50:31] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.4.3 child bridge successfully
[09/08/2024, 08:50:31] Loaded 0 cached accessories from cachedAccessories. 0xxxExxxFxxx.
[09/08/2024, 08:50:31] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-tapo-camera) is running on port 33xx3.
[09/08/2024, 08:50:31] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[09/08/2024, 08:50:32] CAMERA_NAME is running on port 39xx1.
[09/08/2024, 08:50:32] Please add [CAMERA_NAME] manually in Home app. Setup Code: xxx-xx-xxx
[09/08/2024, 08:50:32] CAMERA_NAME is running on port 33xx7.
[09/08/2024, 08:50:32] Please add [CAMERA_NAME] manually in Home app. Setup Code: xxx-xx-xxx
Error: Invalid device confirm
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:213:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:340:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:348:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:429:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:612:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:204:26)
[09/08/2024, 08:50:33] [homebridge-tapo-camera] Child bridge process ended
kopiro commented 2 months ago

Hello! The fact you're getting Error: Invalid device confirm means something is off. In order to do this, I must add additional logging.

I'll do it in next release and once you update post the logs again.

kopiro commented 2 months ago

Please update to https://github.com/kopiro/homebridge-tapo-camera/releases/tag/v2.4.5

Kiran-B commented 2 months ago

Thanks @kopiro .

Here are the logs from plugin v2.4.5:

[28/08/2024, 07:03:18] [Homebridge UI] Running Command: npm install --save homebridge-tapo-camera@2.4.5
[28/08/2024, 07:03:23] [homebridge-tapo-camera] Restarting Process...
[28/08/2024, 07:03:24] [homebridge-tapo-camera] Restarting child bridge...
[28/08/2024, 07:03:24] [homebridge-tapo-camera] Child bridge process ended
[28/08/2024, 07:03:24] [homebridge-tapo-camera] Process Ended. Code: null, Signal: SIGTERM
[28/08/2024, 07:03:31] [homebridge-tapo-camera] Restarting Process...
[28/08/2024, 07:03:32] [homebridge-tapo-camera] Launched child bridge with PID 16842
[28/08/2024, 07:03:32] Registering platform 'homebridge-tapo-camera.tapo-camera'
[28/08/2024, 07:03:32] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.4.5 child bridge successfully
[28/08/2024, 07:03:32] Loaded 0 cached accessories from cachedAccessories.XXXX.
[28/08/2024, 07:03:32] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-tapo-camera) is running on port 33593.
[28/08/2024, 07:03:32] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[28/08/2024, 07:03:33] Portico XXXX is running on port 36919.
[28/08/2024, 07:03:33] Please add [Portico XXXX] manually in Home app. Setup Code: 555-xx-123
[28/08/2024, 07:03:33] West XXXX is running on port 46563.
[28/08/2024, 07:03:33] Please add [West XXXX] manually in Home app. Setup Code: 555-xx-123
[28/08/2024, 07:03:33] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1387 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:629:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:220:28)
[28/08/2024, 07:03:33] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1368 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:629:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:220:28)
[28/08/2024, 07:03:34] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1366 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
[28/08/2024, 07:03:34] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1366 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
[28/08/2024, 07:03:34] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1366 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
[28/08/2024, 07:03:34] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1366 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
[28/08/2024, 07:03:34] [West] Error getting status: Error: StokRefresh: Temporary Suspension: Try again in 1366 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:293:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:357:7)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:365:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:446:23
[28/08/2024, 07:03:34] [homebridge-tapo-camera] This plugin generated a warning from the characteristic 'On': characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics. See https://homebridge.io/w/JtMGR for more info.
[28/08/2024, 07:03:34] [homebridge-tapo-camera] This plugin generated a warning from the characteristic 'On': characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics. See https://homebridge.io/w/JtMGR for more info.

Note that Apple Home is able to stream from both cameras:

[28/08/2024, 07:08:01] [West] [West] Starting video stream: native x native, native fps, ??? kbps (AAC-eld)
[28/08/2024, 07:08:06] [West] [West] Stopped video stream.
[28/08/2024, 07:08:06] [West] [Portico] Starting video stream: native x native, native fps, ??? kbps (AAC-eld)
[28/08/2024, 07:08:12] [West] [Portico] Stopped video stream.
Kiran-B commented 2 months ago

Logs from plugin v2.4.9:

With the latest version of the plugin, it just keeps crashing:

[28/08/2024, 06:59:33] [Homebridge UI] Running Command: npm install --save homebridge-tapo-camera@2.4.9
[28/08/2024, 06:59:43] [homebridge-tapo-camera] Restarting child bridge...
[28/08/2024, 06:59:43] Got SIGTERM, shutting down child bridge process...
[28/08/2024, 06:59:46] [West] Error when retrieving data Error: Invalid device confirm
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:213:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:349:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:429:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:612:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:205:28)
[28/08/2024, 06:59:46] [West] Error when retrieving data Error: Invalid device confirm
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:213:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TAPOCamera.getAuthenticatedAPIURL (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:349:19)
    at /var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:429:23
    at TAPOCamera.getStatus (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:612:26)
    at CameraAccessory.getStatusAndNotify (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/cameraAccessory.ts:205:28)
[28/08/2024, 06:59:48] [homebridge-tapo-camera] Child bridge process ended
[28/08/2024, 06:59:48] [homebridge-tapo-camera] Process Ended. Code: 143, Signal: null
[28/08/2024, 06:59:55] [homebridge-tapo-camera] Restarting Process...
[28/08/2024, 06:59:56] [homebridge-tapo-camera] Launched child bridge with PID 16401
[28/08/2024, 06:59:57] Registering platform 'homebridge-tapo-camera.tapo-camera'
[28/08/2024, 06:59:57] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.4.9 child bridge successfully
[28/08/2024, 06:59:57] Loaded 0 cached accessories from cachedAccessories.XXXX.
[28/08/2024, 06:59:57] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-tapo-camera) is running on port 33593.
[28/08/2024, 06:59:57] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

Error: Invalid device confirm
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:333:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[28/08/2024, 06:59:58] [homebridge-tapo-camera] Child bridge process ended
[28/08/2024, 06:59:58] [homebridge-tapo-camera] Process Ended. Code: 1, Signal: null
[28/08/2024, 07:00:05] [homebridge-tapo-camera] Restarting Process...
[28/08/2024, 07:00:06] [homebridge-tapo-camera] Launched child bridge with PID 16420
[28/08/2024, 07:00:06] Registering platform 'homebridge-tapo-camera.tapo-camera'
[28/08/2024, 07:00:06] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.4.9 child bridge successfully
[28/08/2024, 07:00:06] Loaded 0 cached accessories from cachedAccessories.XXXX.
[28/08/2024, 07:00:06] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-tapo-camera) is running on port 33593.
[28/08/2024, 07:00:06] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

Error: refreshStok: Temporary Suspension: Try again in 1781 seconds
    at TAPOCamera.refreshStok (/var/lib/homebridge/node_modules/homebridge-tapo-camera/src/tapoCamera.ts:359:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[28/08/2024, 07:00:07] [homebridge-tapo-camera] Child bridge process ended
[28/08/2024, 07:00:07] [homebridge-tapo-camera] Process Ended. Code: 1, Signal: null
[28/08/2024, 07:00:14] [homebridge-tapo-camera] Restarting Process...
[28/08/2024, 07:00:15] [homebridge-tapo-camera] Launched child bridge with PID 16439
[28/08/2024, 07:00:16] Registering platform 'homebridge-tapo-camera.tapo-camera'
[28/08/2024, 07:00:16] [homebridge-tapo-camera] Loaded homebridge-tapo-camera v2.4.9 child bridge successfully
[28/08/2024, 07:00:16] Loaded 0 cached accessories from cachedAccessories.XXXX.
[28/08/2024, 07:00:16] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-tapo-camera) is running on port 33593.
[28/08/2024, 07:00:16] 
Kiran-B commented 2 months ago

I am using two cameras. They are both Tapo C320WS. They are named Portico and West. Both have the same version of the hardware firmware. The only difference in their usage is that Portico has a SD card in it while the West does not. So Local Recording is OFF in the camera named West. Could this be an issue?

kopiro commented 2 months ago

Update: you may be affected by this issue. Please follow this guide on how to fix it.

Kiran-B commented 2 months ago

Thanks @kopiro . I will see whether I can block the internet and update.

But everything was working until 3 weeks ago when I was using the plug-in v2.3.4. The issue surfaced once I updated the plugin to v2.4.1.

kopiro commented 2 months ago

Okay, that seems strange, yes. I did have done a bit of refactoring involving device confirmation. If you have time, we can try couple of things over Discord - you can find me there as kopiro91