hgross / node-red-contrib-tuya-smart

NodeRED nodes to get data from tuya smart devices (like smart plugs, bulbs, ...).
MIT License
43 stars 14 forks source link

Add option to set the request #2

Closed mattjgalloway closed 5 years ago

mattjgalloway commented 5 years ago

In the tuyapi you can set the parameter of the get() call to change what is returned. This adds the option to the node to set this. In doing so, you can get the power for a certain device for example.

mattjgalloway commented 5 years ago

@hgross Don't merge this yet. I need to do some more work on it. I'll finish it soon though :-). I need to make it more robust.

mattjgalloway commented 5 years ago

@hgross This should be good now. I did error checking on the JSON, which stopped any rogue things happening.

So basically what this does is it allows you to get more than just the "state" of the device. I have some electrical plugs which allow reading the current, power & voltage. I am sniffing the power and shoving it into my energy monitoring system (OpenEnergyMonitor) via node-red.

Let me know if you're happy to make this change, and if you want changes to match style / whatever then I can do that.