caseyjhol / node-red-contrib-tplink

A collection of Node-RED nodes for TP-Link Smart Home devices
https://www.npmjs.com/package/node-red-contrib-tplink-iot
MIT License
16 stars 15 forks source link

Small bug I think #49

Open iscraigh opened 3 years ago

iscraigh commented 3 years ago

I used an inject node to turn off the led msg.payload.led string true

light turned on

so naturally I changed true to false and nothing happened.

after some messing around I figured out that it needed to be a boolean true/false The instructions say it is a string but string only works for true, boolean works for both true and false. Maybe updating the instructions are all that are needed for newbies like me.

Craig

hufftheweevil commented 3 years ago

Where does the documentation say the led property can be a string?

I see that it doesn't really specify one way or the other. Perhaps clarification could be added.

iscraigh commented 3 years ago

Awsome to get a response Being a newb I read the line below as meaning I should use a text string. Clarification would be great for the rookies like myself. I appreciate your work, this is working awesome for me, HA seems to disconnect from the switches on occasion but NR and your node keep everything working great.

Controls Control a device by setting its properties.

string | Object

true | on - Turn on the device false | off - Turn off the device toggle - Switch the power state of the device. Or as an object, all properties optional: state: true | on | false | off - Set device on or off brightness: [1-100] - Set brightness, if supported temperature: [2700-6500] - Set brightness (in kelvin), if supported hsb: {hue, saturation, brightness} - Set the color, if supported led: true | false - Turn the LED on or off, if supported

iscraigh commented 3 years ago

If anyone needs someone to idiot proof their instructions, I am qualified for the job.

hufftheweevil commented 3 years ago

Ah, yes - that is referring to the whole payload value. It can be a string such as "false" - but that will turn the device off. If you want to use the more "advanced" features, such as controlling the indicator LED, you must use an object (as you are) {led: false}, but the value for the led property must be boolean.

But you're right - the documentation is not clear enough; hence why I needed to explain it here. Additionally, I see no reason why we can't catch the strings for "true" and "false" as well.

Glad it's working out for you!