plasticrake / tplink-smarthome-api

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

Send discovery packet manually #100

Closed sbcarp closed 4 years ago

sbcarp commented 4 years ago

Is it possible to send discovery packet manually? The default discoveryInterval is 10s, I think it's good enough for normal use, but I want to send the packet immediately after calling setPowerState to devices, so that it will detect power state changes as soon as possible. Thanks!

plasticrake commented 4 years ago

if you're using setPowerState it already fires the event for the state change immediately. It doesn't have to wait for discovery. Also any time the state is queried (getPowerState, getSysInfo, getInfo etc), it will refire events for state change, you don't need to wait for discovery. I'm not certain sending discovery manually is needed.

sbcarp commented 4 years ago

if you're using setPowerState it already fires the event for the state change immediately. It doesn't have to wait for discovery. Also any time the state is queried (getPowerState, getSysInfo, getInfo etc), it will refire events for state change, you don't need to wait for discovery. I'm not certain sending discovery manually is needed.

I figured it out, thanks!