sanlike0911 / node-red-contrib-tplink-tapo-connect-api

Apache License 2.0
48 stars 20 forks source link

Enhancement: Retrieve Plug Status via p100.getDeviceInfo() ? #2

Closed kevinmarchant closed 3 years ago

kevinmarchant commented 3 years ago

Thanks for the Node - excellent !!

It would be useful to be able to query a plug's status (on or off). Might this be done via p100.getDeviceInfo() and included in the Node ?

sanlike0911 commented 3 years ago

Hi, Thank you for using "node-red-contrib-tplink-tapo-connect-api".

It will be supported in the next update.

sanlike0911 commented 3 years ago

Add "255: Get device information" to the payload input. [INPUT] msg.payload = 255

You can receive the following results: [OUTPUT] msg.payload = { device_id: xxxx, device_on: <boolean [false or true]>, <<<< true:on, false:off ..., }

You can tell if the device is on or off by getting "device_on".

kevinmarchant commented 3 years ago

Thanks !

Currently upgrading my PC so may be a few days before I can test but I appreciate the effort :-)

On 19 Aug 2021, at 16:13, sanlike @.***> wrote:

 Add "255: Get device information" to the payload input. [INPUT] msg.payload = 255

You can receive the following results: [OUTPUT] msg.payload = { device_id: xxxx, device_on: <boolean [false or true]>, <<<< true:on, false:off ..., }

You can tell if the device is on or off by getting "device_on".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

kevinmarchant commented 3 years ago

Excellent - works a treat! I've now got a button on my SteamDesk that can toggle my room lights on and off!

I'm new to Node-Red so there may well be an easier way of doing this but here's my flow. What would have been really handy is to have the Node itself have a toggle option, e.g 0 for Off, 1 for On, and "-1" for toggle state which incorporated the steps between the two http bits down into a single operation. But that's just me being lazy but thought I'd mention it in case you were thinking similar :-)

Once again, thanks for your efforts !

Capture

sanlike0911 commented 3 years ago

Thank you, too.

Thank you for your wonderful hint. I will add "toggle mode" to the next version.

What would have been really handy is to have the Node itself have a toggle option

Well then, this issue is closed. Thank you very much.