plasticrake / tplink-smarthome-api

TP-Link Smarthome WiFi API
MIT License
1.02k stars 141 forks source link

Unhandled TCP timeout in emeter.get_realtime (3.0.0-beta.0, HS300 device) #110

Closed Bradl3y42 closed 3 years ago

Bradl3y42 commented 3 years ago

Seeing below error frequently. The timeouts are legit since the devices can be unresponsive in the official Kasa app. But they should be handled correctly. Any idea how to resolve it?

Error message: (node:8680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 836) (node:8680) UnhandledPromiseRejectionWarning: Error: TCP Timeout after 10000ms 10.10.1.233:9999 {"emeter":{"get_realtime":{}},"context":{"child_ids":["80069C4911A331F69C27154BC140F3D91D23BCD604"]}} at Timeout.setTimeout [as _onTimeout] (/mnt/unraid/bradsdata/DevOps/Git/tplink-energy-monitor_h300/node_modules/tplink-smarthome-api/lib/network/tcp-socket.js:59:36) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10)

plasticrake commented 3 years ago

Would need to see your code. Are you using a catch() or a try catch block with async/await when calling?