Blocky - ParseFloat and ParseInt

Is there any chance of getting ParseFloat and ParseInt added to Blocky in the future. I needed to use ParseFloat and so after building my script, I had to go back into the code and add them manually. Thank you.

You can use the inline script block for any custom code

I will use that. I did not understand it’s use. I had to go look up Blocky commands to see what I could use. I am trying to convert battery voltage to percent for devices that do not have battery percent.
Thank you

“I am trying to convert battery voltage to percent for devices that do not have battery percent.”

Do you mind sharing the use case in more details where you would need that and I can look into that whether there are other options or if weed need that?

I guess the above, when I exactly understand what you want to do, could be easily doable without a new block but let me first understand what you want.

I am monitoring the battery level on all my Zigbee devices. Many of them have battery percent as an option, but some do not. They all have battery voltage. One thing I noticed is that the percent 100 to 0 is relative to the voltage between 3 and 1.9 when the device dies. So, the thought was to use the voltage on the other devices and calculate the percent based on that.
I am using the following widget to display this on my Overview page.

uid: rlk_battery_status


Here is the script I am using to convert the voltage to percent.

There are probably far easier ways to do this, but this was my first attempt.

Thank you.

You can use the following to get the value only from that item without the quantity and then do the math

I will play with this.
Thank you

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.