@craigweb said in Script to convert from Hex to Dec:

return parseInt(p.value, 16)

Thanks so much Craig, but it didnt work. please let me to explain You:

the hex data is arriving as 13:32 (it is Hex 1332, so must be in Dec Value=4194)

With your Script I got the Dec value from just the first number (Hex13 =Dec19)

this device send a string like 13:30:27:14:01:33:02:6c:02:76.

then I need to get

13:32:4194

27:14=10000

01:33=307

02:6c=620

02:76=630

After i get the values, then we will need to scale it:

4195*0,01=41,95
(10000*0.1)-1000=0

307

*0.1=30,7*

(6200.1)-40=22

(620

(630*0.1)-40=23

I understand how to define a script to multiply, but some data need to be multiply and the final result will be minus 40, for example:

Data 02:76 = Hex630= ((630*0,1)-40)=23

As you can see im in a problem, please could you support me

In advance thanks so much

Jorge G