Closed mattjgalloway closed 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.
@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.
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.