Announce: new node: @korve/node-red-convert-unit

i hope someone can use this. This node converts from one unit to another unit:

example

I've needed such a functionality for my smart plugs to convert units of energy. The conversation is done by the excellent library convert-units package.

Any thoughts on this?

Cheers

Link to node: node-red-convert-unit (node) - Node-RED

6 Likes

Looks to be quite thorough. I'm certain it will be useful to many folk. Thank you very much for your contribution. Keep em coming :slight_smile:

Hi @korve,
Thanks for contributing!!
Just one question: is there any particular reason why you decided to create a new node, instead of using my node-red-contrib-unit-converter (which is based on the same converts-units library as yours)?
Bart

2 Likes

Hi Bart, tbh. i did briefly look at this plugin and only saw that it was updated 5 years ago and assumed its abandoned. :sweat_smile: Also there was no description on the nodered flow registry.

Which energy features in your node are you using in your 'smart plug' example that you mentioned above.
Wh to kWh??

I wanted to convert from Wm to kWh. Which doesn't work currently but i hope it will work soon :slight_smile:

You could put this in a function node;

let Wm = msg.payload  // example 60000
let kWh = (Wm * (1/60))/1000
msg.payload = kWh
return msg // returns 1

Ah yes that is very annoying. I always spend a lot of free time on the documentation for my readme pages, and for some reason some of them are completely empty on flows.nodered.org. And indeed if people don't have a look at the same page on Github or npm, then they assume there is no documentation at all...
Thanks for the clarification!

Or if you don't want to get into function nodes then a Range node configured as

image