# Converting hex to decimal

**URL:** <https://discourse.nodered.org/t/converting-hex-to-decimal/49580>\
**Category:** General\
**Created:** [10 August 2021 18:48 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580 "2021-08-10T18:48:13Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [14 August 2021 10:27 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/21 "2021-08-14T10:27:49Z")

</div>

> [@zenofmud](#):
>
> {"ID":147,"TEMP":27.4,BAT":OK,"HUM":78}

This is also incorrect, the example Dick presented must be a typo as the bat and Ok have no quotes.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [14 August 2021 10:56 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/22 "2021-08-14T10:56:36Z")

</div>

Yup just another example of why you should copy/paste instead of typing it in by hand 🙃

---

<div class="post-metadata">

**Author:** ![dick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dick/32/61180_2.png) [@dick](https://discourse.nodered.org/u/dick)\
**Post date:** [14 August 2021 17:46 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/23 "2021-08-14T17:46:29Z")

</div>

E1cid and Colin  
thanks for the help till now  
this (Temp/Hum) is all right now.  
ID gives a unique number that indicates what sensor is used  
(There a Cresta in two variations, Prologue, Oregon end and Auriool).  
gr  
Dick

---

<div class="post-metadata">

**Author:** ![dick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dick/32/61180_2.png) [@dick](https://discourse.nodered.org/u/dick)\
**Post date:** [1 September 2021 15:28 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/26 "2021-09-01T15:28:59Z")

</div>

Zenofmud  
Another problem for me:  
with converting this :  
My dht11 gives 17.5 as variable value.  
with function

```auto
msg.payload = {"command":"udevice", "idx":1558, "svalue":"temp"}
return msg;

```

OR with Json -Convert between Json to Json string -  
With MQTT is it for me not possible to get the value 17.5 ° in the command line  
MQTT gives in debug

```auto
object command: "udevice", idx: 1558 svalue: "temp"

```

And i would have idx: 1558 , 17.5  
Can you give me advise  
Dick

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [1 September 2021 20:16 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/27 "2021-09-01T20:16:42Z")

</div>

If you wnt it to look like:

```auto
{ "command":"udevice", 
  "idx":1558, 
  "svalue": 17.5
}

```

Try

```auto
msg.payload = {"command":"udevice", "idx":1558};
msg.payload.svalue = temp;
return msg;

```

this assumes you have assigned the variable `temp` with the dht11 reading

---

<div class="post-metadata">

**Author:** ![dick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dick/32/61180_2.png) [@dick](https://discourse.nodered.org/u/dick)\
**Post date:** [25 September 2021 14:52 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/28 "2021-09-25T14:52:47Z")

</div>

zenofmud  
thanks for the help/info but those advice til now is not helping me for a useful result.  
I try another solution  
node-red rflink  
buying/soldering using rfload gives as example with rflink:  
20;09;Cresta;ID=3A01;TEMP=00ed;HUM=66;

In the above example, the device has 2 values, TEMP and HUM. The `msg.payload` will have `msg.payload.temp` and `msg.payload.hum`

How should i do that?  
Can you help me?  
Dick

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [25 September 2021 16:05 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/29 "2021-09-25T16:05:07Z")

</div>

You need to attach a ` debug` node - set to display the complete msg object - to the output of the node providing that data. Then open all the tabs for the debug in the sidebar and copy the results and paste it to a reply so I can see the actual data.

---

<div class="post-metadata">

**Author:** ![dick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dick/32/61180_2.png) [@dick](https://discourse.nodered.org/u/dick)\
**Post date:** [25 September 2021 17:57 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/30 "2021-09-25T17:57:54Z")

</div>

```auto
[{"id":"c564433d.73ac3","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ab899847.35ba08","type":"rflink in","z":"c564433d.73ac3","device":"","name":"","x":190,"y":160,"wires":[["c206fdab.72953"]]},{"id":"c206fdab.72953","type":"debug","z":"c564433d.73ac3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":160,"wires":[]},{"id":"cb7c81b6.5e4a9","type":"comment","z":"c564433d.73ac3","name":"20;09;Cresta;ID=3A01;TEMP=00ed;HUM=66","info":"rf load gives the data","x":310,"y":100,"wires":[]},{"id":"e1e28cae.1645b","type":"comment","z":"c564433d.73ac3","name":"rf load gives the data","info":"","x":230,"y":60,"wires":[]},{"id":"21ecc030.341aa","type":"comment","z":"c564433d.73ac3","name":"internet gives: ","info":"https://flows.nodered.org/node/node-red-contrib-rflink\n\nIn the above example, the device has 2 values, TEMP and HUM. The msg.payload will have msg.payload.temp and msg.payload.hum","x":220,"y":240,"wires":[]}]

```

Paul the problem is how do i get the data with rflink?  
rflink: [node-red-contrib-rflink (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-rflink) and the conversion? but there is no data!

or should i use a serial in node? that is another problem i think

Dick

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [25 September 2021 18:10 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/31 "2021-09-25T18:10:57Z")

</div>

I can't help you with the node-red-contrib-rflink node since I've never used it.

In addition, it hasn't been updated in over two years and the owner hasn't been responding to issues opened, This might not be the best choice.

What was wrong with the way you were doing it?

---

<div class="post-metadata">

**Author:** ![dick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dick/32/61180_2.png) [@dick](https://discourse.nodered.org/u/dick)\
**Post date:** [26 September 2021 07:02 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/32 "2021-09-26T07:02:19Z")

</div>

Paul,

Thanks

As earlier mentioned: i am trying to use all my (sensor) data -in and extern in a node-red flow.

With your (and from others) help came it to a succes

Eg

1 A splitting way of the data

2 var hum1= msg.payload[0]; var hum2= msg.payload[1]; etc the payload number increases til 46 but it works for me

3 inpute with the serial method wth two arduinos (different comports)

4 and at this moment i try another manner RFLINK (WITH the var hum1= msg.payload[0]; goes it well) this is serial in.

But i would try RFLINK NODE. (With [https://flows.nodered.org/node/node-red-contrib-rflink](https://flows.nodered.org/node/node-red-contrib-rflink)) and that stops till now.

So i am experimenting further.

As i said It is all working, but i like the experimental manner

Gr

Dick

But

Verzonden vanuit [Mail](https://go.microsoft.com/fwlink/?LinkId=550986) voor Windows

 ![40CB9955BAF74F808EE54247F63CA0FB.png](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fef13c35f1ee72514b183f47acdac7a32f4ae9a1.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 November 2021 07:02 UTC](https://discourse.nodered.org/t/converting-hex-to-decimal/49580/33 "2021-11-25T07:02:21Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/converting-hex-to-decimal/49580.md?page=1)
