# Temperature probe offset

**URL:** <https://discourse.nodered.org/t/temperature-probe-offset/53318>\
**Category:** General\
**Created:** [7 November 2021 02:32 UTC](https://discourse.nodered.org/t/temperature-probe-offset/53318 "2021-11-07T02:32:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfassier](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mfassier/32/48013_2.png) [@mfassier](https://discourse.nodered.org/u/mfassier)\
**Post date:** [7 November 2021 02:32 UTC](https://discourse.nodered.org/t/temperature-probe-offset/53318/1 "2021-11-07T02:32:03Z")

</div>

Hi all.  
I use a USB temperature and RH logger that feeds into Node Red. I managed to get as far as getting data but I'm in a pickle over the temperature probe: using the Buffer-parser, I managed to extract the proper message (unsigned 16 bit), and scale it to the proper decimal. But the value requires an offset of 200 and I can't for the life of me figure out how to do that (i.e. 206.5 is 6.5). Suggestions anyone ?

```auto
[{"id":"7f7ee85c.310b28","type":"debug","z":"3e29523c.f2b2be","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":430,"y":660,"wires":[]},{"id":"2f0aa780.499638","type":"buffer-parser","z":"3e29523c.f2b2be","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint16le","name":"Temp","offset":1,"length":-1,"offsetbit":0,"scale":"0.1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":150,"y":480,"wires":[["abfdb48d.ee6fb8","e8373125.9d18d","7f7ee85c.310b28"]]},{"id":"9678038a.6fed9","type":"function","z":"3e29523c.f2b2be","name":"Sort Temp","func":"if (msg.payload[0] == 0x3)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":150,"y":400,"wires":[["2f0aa780.499638"]]},{"id":"9d327960.37e128","type":"HIDdevice","z":"3e29523c.f2b2be","connection":"ed0429ef.63b02","name":"ELUSBRT","x":130,"y":320,"wires":[["d2aaee82.b2e62","9678038a.6fed9"],[]]},{"id":"ed0429ef.63b02","type":"HIDConfig","vid":"0x1781","pid":"0x0EC4","name":"USBELRT"}]

```

---

<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:** [7 November 2021 10:09 UTC](https://discourse.nodered.org/t/temperature-probe-offset/53318/2 "2021-11-07T10:09:56Z")

</div>

You Don't say if it is a number or string. You should be able to parseFloat() and then simply minus 200.  
e.g.

```auto
[{"id":"7f5869b8.a15148","type":"function","z":"b779de97.b1b46","name":"","func":"msg.payload = parseFloat(msg.payload) - 200;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":4880,"wires":[["3a65d71b.c994d"]]},{"id":"27002dec.65cfa2","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"206.5","payloadType":"str","x":80,"y":4860,"wires":[["7f5869b8.a15148"]]},{"id":"1fbf1bc8.3aee04","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"206.5","payloadType":"num","x":90,"y":4900,"wires":[["7f5869b8.a15148"]]},{"id":"3a65d71b.c994d","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":4880,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![mfassier](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mfassier/32/48013_2.png) [@mfassier](https://discourse.nodered.org/u/mfassier)\
**Post date:** [7 November 2021 23:34 UTC](https://discourse.nodered.org/t/temperature-probe-offset/53318/3 "2021-11-07T23:34:05Z")

</div>

I am dumbfounded by the stupidity of my own question... Thanks for indulging me with an actual, serious answer, it hurts just a bit less 🙂

---

<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:** [6 January 2022 23:34 UTC](https://discourse.nodered.org/t/temperature-probe-offset/53318/4 "2022-01-06T23:34:36Z")

</div>

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