Dear All,
I’m a Beginner,
From the Photovoltaic Inverter ( SolarEdge ) I get a actual power generated, via MQTT, in this format :
Of course I don’t need 4 decimal and I need to have only the integer.
What could be the simplest way to cut the decimals ?
Of course, the actual power is in W , not kW as shown in the footer …
Many Thanks in advance for any help.
Kind Regards
To cast a received value to a number, you can do Number(receivedString) or just divide by 1 receivedString / 1. But I think, javascript will try to map any given value to a number before doing the Math.round() method. If the casting fails, you will get an respective error message.
Many Thanks for prompt reply, But really I don’t know were to put this code…
no way to use some parameter in Json transformation already in use for this MQTT data ?
Or other short road to format the result ?