apatsufas / homebridge-tapo-p100

Homebridge TP-LINK Tapo P100 Platform Plugin
Apache License 2.0
64 stars 14 forks source link

Can't handle P110 not present #19

Closed malcsmith closed 2 years ago

malcsmith commented 2 years ago

Describe The Bug: When a device is removed from Power, causes Homebridge to SIGTERM

To Reproduce: Remove plug

Expected behavior: Log the fault and continue not SIGTERM

Logs: Dec 8 08:36:00 pi-loft homebridge[16771]: [08/12/2021, 08:36:00] [Tapo Smart Platform] 371 Error: Cannot read properties of undefined (reading 'response') Dec 8 08:36:01 pi-loft homebridge[16771]: [08/12/2021, 08:36:01] [homebridge-tapo] This plugin generated a warning from the characteristic 'Serial Number': characteristic value expected string and received undefined. See https://git.io/JtMGR for more info. Dec 8 08:36:01 pi-loft homebridge[16771]: [08/12/2021, 08:36:01] [Tapo Smart Platform] 146 Error Code: 9999, Undocumented error. Try restarting Homebridge Dec 8 08:36:01 pi-loft homebridge[16771]: [08/12/2021, 08:36:01] [Tapo Smart Platform] 357 Error Code: 9999, Undocumented error. Try restarting Homebridge Dec 8 08:36:01 pi-loft homebridge[16771]: [08/12/2021, 08:36:01] TypeError: Cannot read properties of undefined (reading 'current_power') Dec 8 08:36:01 pi-loft homebridge[16771]: at /usr/local/lib/npm/lib/node_modules/homebridge-tapo/src/platformP110Accessory.ts:106:83 Dec 8 08:36:01 pi-loft homebridge[16771]: at processTicksAndRejections (node:internal/process/task_queues:96:5) Dec 8 08:36:01 pi-loft homebridge[16771]: [08/12/2021, 08:36:01] Got SIGTERM, shutting down Homebridge...

Plugin Config:

"name": "Tapo Smart Platform", "username": "xxxxxx", "password": "xxxxxx", "devices": [ { "name": "TapoPlug1", "host": "192.168.1.110", "type": "Plug" }, { "name": "study plug monitor", "host": "192.168.1.124", "type": "PowerPlug" } ], "platform": "TapoP100"

apatsufas commented 2 years ago

Thanks for reporting this issue. Try 1.4.13-beta2, this version should fix the crash.