# "TypeError: Cannot read property 'toString' of undefined"

**URL:** <https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064>\
**Category:** General\
**Created:** [22 May 2021 05:12 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064 "2021-05-22T05:12:52Z")\
**Posts on this page:** 16\
**Page:** 2

<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:** [23 May 2021 12:19 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/21 "2021-05-23T12:19:39Z")

</div>

I’ll get back to you in a bit. I have an 8 month old asleep on my chest.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 May 2021 12:30 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/22 "2021-05-23T12:30:25Z")

</div>

@swanside

send me a copy of the output from your modbus node

Add a debug node here  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/0/20a9c3e48cfece78f72ca96b70ff249642a05186.png)

& set to show complete message  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/abb11be871a5e2281c352eabab46faaf26ca5970.png)

then click "copy value" on the object in the debug window  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7dab2306bdb8db792b7ce33809ff11cf5a250c48.png)

and paste it into a reply between ````` backticks.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 May 2021 13:26 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/23 "2021-05-23T13:26:47Z")

</div>

When you get a chance to send a copy of your modbus message (as requested in my previous post) I will show you how to change this...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7ca8e314db1ff94206ecb177584d8e61c5bd41ca.png)

  

### into this...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/0/20dec26e0ca3a6bfc5c91c79a2212d810ddc3ac2.png)

```auto
[{"id":"1c1f2a8f.ec9285","type":"function","z":"6d01e3e4.6003b4","name":"modbus data (simulated)","func":"msg.responseBuffer = { \n \"data\": [3067, 135, 5244, 0, 2760, 190, 5244, 0, 2760, 1, 0, 0, 0, 0, 0, 0, 0], \n \"buffer\": Buffer.from([11, 251, 0, 135, 20, 124, 0, 0, 10, 200, 0, 190, 20, 124, 0, 0, 10, 200, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2130,"y":780,"wires":[["78acbacb.8326a4"]]},{"id":"d2509826.7e7458","type":"inject","z":"6d01e3e4.6003b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":2080,"y":720,"wires":[["1c1f2a8f.ec9285"]]},{"id":"30eef1da.d3dc3e","type":"debug","z":"6d01e3e4.6003b4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2450,"y":660,"wires":[]},{"id":"78acbacb.8326a4","type":"buffer-parser","z":"6d01e3e4.6003b4","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"SolarVoltage","offset":0,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"SolarCurrant","offset":2,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int32be","name":"SolarPower","offset":4,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"BatteryVoltage","offset":8,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"BatteryCurrant","offset":10,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int32be","name":"BatteryPower","offset":12,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"LoadVoltage","offset":16,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"LoadCurrant","offset":18,"length":1,"offsetbit":0,"scale":"/ 100","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":2210,"y":840,"wires":[["30eef1da.d3dc3e","a2a3fce8.faef6","ca93dd3e.17247","5549bbda.a33264","9245dcaf.db116","a007ba18.f83b18","8640147a.9e1de8","7fa59870.f678c8","35a35bc1.d3ab74"]]},{"id":"a2a3fce8.faef6","type":"ui_text","z":"6d01e3e4.6003b4","group":"3bf43a81.2b807e","order":2,"width":0,"height":0,"name":"SolarVoltage","label":"Solar Voltage (V)","format":"{{msg.payload.SolarVoltage}}","layout":"col-center","x":2450,"y":720,"wires":[]},{"id":"ca93dd3e.17247","type":"ui_text","z":"6d01e3e4.6003b4","group":"3bf43a81.2b807e","order":1,"width":0,"height":0,"name":"SolarCurrant","label":"Solar Currant (A)","format":"{{msg.payload.SolarCurrant}}","layout":"col-center","x":2450,"y":760,"wires":[]},{"id":"5549bbda.a33264","type":"ui_text","z":"6d01e3e4.6003b4","group":"92374fdb.9d242","order":2,"width":5,"height":1,"name":"BatteryVoltage","label":"Battery Voltage (V)","format":"{{msg.payload.BatteryVoltage}}","layout":"col-center","x":2460,"y":840,"wires":[]},{"id":"9245dcaf.db116","type":"ui_text","z":"6d01e3e4.6003b4","group":"92374fdb.9d242","order":1,"width":5,"height":1,"name":"BatteryCurrant","label":"Battery Currant (A)","format":"{{msg.payload.BatteryCurrant}}","layout":"col-center","x":2460,"y":880,"wires":[]},{"id":"8640147a.9e1de8","type":"ui_text","z":"6d01e3e4.6003b4","group":"d0e60a67.4d8d6","order":1,"width":5,"height":1,"name":"LoadCurrant","label":"Load Currant (A)","format":"{{msg.payload.LoadCurrant}}","layout":"col-center","x":2450,"y":1000,"wires":[]},{"id":"a007ba18.f83b18","type":"ui_text","z":"6d01e3e4.6003b4","group":"d0e60a67.4d8d6","order":2,"width":5,"height":1,"name":"LoadVoltage","label":"Load Voltage (V)","format":"{{msg.payload.LoadVoltage}}","layout":"col-center","x":2450,"y":960,"wires":[]},{"id":"7fa59870.f678c8","type":"ui_text","z":"6d01e3e4.6003b4","group":"92374fdb.9d242","order":5,"width":5,"height":1,"name":"BatteryPower","label":"Battery Power (W)","format":"{{msg.payload.BatteryPower}}","layout":"col-center","x":2460,"y":920,"wires":[]},{"id":"35a35bc1.d3ab74","type":"ui_text","z":"6d01e3e4.6003b4","group":"3bf43a81.2b807e","order":3,"width":0,"height":0,"name":"SolarPower","label":"Solar Power (W)","format":"{{msg.payload.SolarPower}}","layout":"col-center","x":2450,"y":800,"wires":[]},{"id":"3bf43a81.2b807e","type":"ui_group","name":"Solar Information","tab":"28c10730.74ad38","order":1,"disp":true,"width":5,"collapse":true},{"id":"92374fdb.9d242","type":"ui_group","name":"Battery Information","tab":"28c10730.74ad38","order":2,"disp":true,"width":5,"collapse":false},{"id":"d0e60a67.4d8d6","type":"ui_group","name":"DC Load Information","tab":"28c10730.74ad38","order":3,"disp":true,"width":5,"collapse":false},{"id":"28c10730.74ad38","type":"ui_tab","name":"Solar PV Equipment","icon":"dashboard","disabled":false,"hidden":false}]

```

  

### or this if you prefer...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/23f846fdbcfd191f6679326b4ca1b0637c7e19a0.png)

```auto
[{"id":"86b69c2.13b806","type":"buffer-parser","z":"6d01e3e4.6003b4","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"SolarVoltage","offset":0,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"SolarCurrant","offset":2,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int32be","name":"SolarPower","offset":4,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"BatteryVoltage","offset":8,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"BatteryCurrant","offset":10,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int32be","name":"BatteryPower","offset":12,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"LoadVoltage","offset":16,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"LoadCurrant","offset":18,"length":1,"offsetbit":0,"scale":"/ 100","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":true,"fanOutMultipleResult":true,"setTopic":true,"outputs":8,"x":2230,"y":1240,"wires":[["34e923b2.b70ddc"],["9a7c954e.630648"],["8a9b8518.d2c828"],["47bf6dd3.0d5914"],["5f356d06.8ec164"],["a138ac27.5e428"],["2c61bd87.973f32"],["b0357751.cec228"]]},{"id":"34e923b2.b70ddc","type":"ui_text","z":"6d01e3e4.6003b4","group":"3bf43a81.2b807e","order":2,"width":0,"height":0,"name":"SolarVoltage","label":"Solar Voltage (V)","format":"{{msg.payload}}","layout":"col-center","x":2450,"y":1100,"wires":[]},{"id":"9a7c954e.630648","type":"ui_text","z":"6d01e3e4.6003b4","group":"3bf43a81.2b807e","order":1,"width":0,"height":0,"name":"SolarCurrant","label":"Solar Currant (A)","format":"{{msg.payload}}","layout":"col-center","x":2450,"y":1140,"wires":[]},{"id":"47bf6dd3.0d5914","type":"ui_text","z":"6d01e3e4.6003b4","group":"92374fdb.9d242","order":2,"width":5,"height":1,"name":"BatteryVoltage","label":"Battery Voltage (V)","format":"{{msg.payload}}","layout":"col-center","x":2460,"y":1220,"wires":[]},{"id":"5f356d06.8ec164","type":"ui_text","z":"6d01e3e4.6003b4","group":"92374fdb.9d242","order":1,"width":5,"height":1,"name":"BatteryCurrant","label":"Battery Currant (A)","format":"{{msg.payload}}","layout":"col-center","x":2460,"y":1260,"wires":[]},{"id":"b0357751.cec228","type":"ui_text","z":"6d01e3e4.6003b4","group":"d0e60a67.4d8d6","order":1,"width":5,"height":1,"name":"LoadCurrant","label":"Load Currant (A)","format":"{{msg.payload}}","layout":"col-center","x":2450,"y":1380,"wires":[]},{"id":"2c61bd87.973f32","type":"ui_text","z":"6d01e3e4.6003b4","group":"d0e60a67.4d8d6","order":2,"width":5,"height":1,"name":"LoadVoltage","label":"Load Voltage (V)","format":"{{msg.payload}}","layout":"col-center","x":2450,"y":1340,"wires":[]},{"id":"8a9b8518.d2c828","type":"ui_text","z":"6d01e3e4.6003b4","group":"3bf43a81.2b807e","order":3,"width":0,"height":0,"name":"SolarPower","label":"Solar Power (W)","format":"{{msg}}","layout":"col-center","x":2450,"y":1180,"wires":[]},{"id":"a138ac27.5e428","type":"ui_text","z":"6d01e3e4.6003b4","group":"92374fdb.9d242","order":5,"width":5,"height":1,"name":"BatteryPower","label":"Battery Power (W)","format":"{{msg.payload}}","layout":"col-center","x":2460,"y":1300,"wires":[]},{"id":"d3fcfa11.a265b8","type":"function","z":"6d01e3e4.6003b4","name":"modbus data (simulated)","func":"msg.responseBuffer = { \n \"data\": [3067, 135, 5244, 0, 2760, 190, 5244, 0, 2760, 1, 0, 0, 0, 0, 0, 0, 0], \n \"buffer\": Buffer.from([11, 251, 0, 135, 20, 124, 0, 0, 10, 200, 0, 190, 20, 124, 0, 0, 10, 200, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2130,"y":1140,"wires":[["86b69c2.13b806"]]},{"id":"ee7de627.aef7b8","type":"inject","z":"6d01e3e4.6003b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":2080,"y":1080,"wires":[["d3fcfa11.a265b8"]]},{"id":"3bf43a81.2b807e","type":"ui_group","name":"Solar Information","tab":"28c10730.74ad38","order":1,"disp":true,"width":5,"collapse":true},{"id":"92374fdb.9d242","type":"ui_group","name":"Battery Information","tab":"28c10730.74ad38","order":2,"disp":true,"width":5,"collapse":false},{"id":"d0e60a67.4d8d6","type":"ui_group","name":"DC Load Information","tab":"28c10730.74ad38","order":3,"disp":true,"width":5,"collapse":false},{"id":"28c10730.74ad38","type":"ui_tab","name":"Solar PV Equipment","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [23 May 2021 13:39 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/24 "2021-05-23T13:39:58Z")

</div>

Cheers pal.

```auto
{"topic":"livestats","messageId":"60aa5b1e01097b3a141c90af","payload":[3829,107,4104,0,2755,149,4104,0,2755,0,0,0,2755,0,0,0,1295,1923],"queueLengthByUnitId":{"unitId":2,"queueLength":0},"queueUnitId":2,"unitId":2,"modbusRequest":{"unitid":2,"fc":4,"address":12544,"quantity":18,"emptyMsgOnFail":false,"keepMsgProperties":false,"messageId":"60aa5b1e01097b3a141c90af"},"responseBuffer":{"data":[3829,107,4104,0,2755,149,4104,0,2755,0,0,0,2755,0,0,0,1295,1923],"buffer":[14,245,0,107,16,8,0,0,10,195,0,149,16,8,0,0,10,195,0,0,0,0,0,0,10,195,0,0,0,0,0,0,5,15,7,131]},"_msgid":"80ecd545.37ef48"}

```

---

<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:** [23 May 2021 15:00 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/25 "2021-05-23T15:00:27Z")

</div>

@swanside Your `switch` is testing msg.parts.index but checking for `strings` but msg.parts.index is a `numeric`. In addition, instead of checking for 10 and 11 you check for E and F.

However the real issue is the `join`. The msgs passed to the join have a msg.parts.index of 2 and 3. Then you join them into an array and it does what you have told it to do. It sticks those two msgs into the array at position 2 and 3 but since an array atarts at 0, you get an array with two undefined entries.

While there might be other ways to fix this, you could add a change node to the output of switch 2 and set msg.part.index to 0 and another change node to the output of switch 3 and set msg.part.index to 1

Note: this issue will also crop up in the other `join` nodes after the switch.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 May 2021 15:31 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/26 "2021-05-23T15:31:54Z")

</div>

For that data, from what I can see from your flow, these are the values i get...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/078f10e2106d2c83dca71d04cf77f1d352a5139d.png)

Do they ↑ look correct?

  

Do you have a manual or specification - something like...

| register | name | type | example value | unit |
| --- | --- | --- | --- | --- |
| 3100 | Solar voltage | int16 x100 | 38.2 | v |
| 3101 | Solar current | int16 x100 | 1.0 | v |
| 3102 | etc | etc | etc | etc |
| 3103 | etc | etc | etc | etc |

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [23 May 2021 17:03 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/27 "2021-05-23T17:03:19Z")

</div>

Yep. They doo look right.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/10b6fbda69b6156178b30bb0b9d76f52e739bf04.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/cede603a567d556077c2839ecca43cf914f88fa7.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9b48c819f18f1fbec51224ae3610219ef9ee0b2d.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/31a741949f87f40eb204c4ff727e9656ae071725.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fde590327cea86919732e45ac4e149268c6e9e04.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 May 2021 18:01 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/28 "2021-05-23T18:01:10Z")

</div>

Hi, looking at those screenshots, I doubt what I or you have was correct.

- You are reading 18 values from modbus address 0x3100 - you will never reach values in 3200 or 3300 range.
- Address 310C (Load voltage) is actually at decimal address 12556 (in the 12th element of the array)
- Also, addresses 3102/3103 were being arranged as Big Endian (i believe they should be Little Endian)

Anyhow, I will show you how to use buffer-parser to get all the values you need.

NOTE ON BUFFER-PARSER:  
If you READ a `quantity` of 18 values from from modbus address 0x3100 (AKA address 12544) then you will get 18 INT16 values from 0x3100 ~ 0x3112 - in terms of a buffer, that is 36 bytes.  
the first 2 bytes will be the value of 0x3100. Bytes 2&3 will be the value of address 0x3101 etc

In the below example, you can see address 3102 is found in the buffer at BYTE 4 and it is set to be read as an INT32LE

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/34ece29cff90344901718cf6774c214ec957ddae.png)

Below is an export of the buffer parser with columns set to match your documentation (for the items in address range 0x3100) - you will need to do a separate 2nd and 3rd modbus read for addresses 0x3200 and 0x3300 + fill in the buffer parser as I have shown

```auto
[{"id":"6db47ce1.1a1c04","type":"buffer-parser","z":"6d01e3e4.6003b4","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"SolarVoltage","offset":0,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"SolarCurrant","offset":2,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int32le","name":"SolarPower","offset":4,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"LoadVoltage","offset":20,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"LoadCurrant","offset":22,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int32le","name":"LoadPower","offset":24,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"BatteryTemperature","offset":34,"length":1,"offsetbit":0,"scale":"/ 100","mask":""},{"type":"int16be","name":"CaseTemperature","offset":36,"length":1,"offsetbit":0,"scale":"/ 100","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":true,"fanOutMultipleResult":true,"setTopic":true,"outputs":8,"x":2210,"y":760,"wires":[["30eef1da.d3dc3e"],[],[],[],[],[],[],[]]}]

```

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [24 May 2021 07:13 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/29 "2021-05-24T07:13:18Z")

</div>

Thank you.  
I really appreciate that, will give me something to work on now.  
Thanks again  
Paul.

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [24 May 2021 07:20 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/30 "2021-05-24T07:20:34Z")

</div>

Just one more thing.. Sorry about this, but getting a scale.matchall is not a function on the buffer?  
Thanks

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/daeafc99f89bf97289647880c44f8d02f90ba5c3.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 May 2021 07:25 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/31 "2021-05-24T07:25:02Z")

</div>

What version node are you running?

Open a terminal, enter `node -v`

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [24 May 2021 08:28 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/32 "2021-05-24T08:28:47Z")

</div>

Sorry pal. Yep just ran a full upgrade.  
When I ran this  
node -v I got v10.24.0  
npm -v I got 5.8.0

Ran this `bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)`

node -v I got v12.22.1  
npm -v I got 6.14.12

I then got an error on the buffer, something about offset needs to be \>0 and less than 34 received 36, so I deleted the last offset and now I am getting values.  
Thank you so much for your help. Will expand on this now to get everything.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d95710e7f1a9586bc344fc97077d2b6492dfffee.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9e8f4209f976dc84548db6b36d8d56890326befc.png)

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [24 May 2021 11:23 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/33 "2021-05-24T11:23:17Z")

</div>

So, and sorry ask, but When I am reading a L and a H, such as in this, I have 0x3304 (13060 Dec) and 0x3305 (13061 Dec) But the Buffer Start Byte for 3304 I am guessing will be 8, and as its an int32, it will pick up the L and the H as it is displaying 7.68 which I would say is Wattage? Have I got this or am I completely off track?  
Cheers  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/897a17b64c1ff1892fb12f75ef99350739fedfa5.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/7467a5b2eb0dc5f97ffaeff24a624d032c5fcfba.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c93ceaff01d36b4946654b2ff6eccd465cdda3d.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 May 2021 11:38 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/34 "2021-05-24T11:38:14Z")

</div>

If you read (for example) a `quantity` of `18` values from modbus address 0x3300 then yes, your spreadsheet table is correct and 0x3304 will be at byte 8. By asking buffer-parser to read an int32le/be (4 bytes) starting at `offset` 8 you WILL get the registers 0x3304 and 0x3305

Is that what you are asking?

---

<div class="post-metadata">

**Author:** ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)\
**Post date:** [24 May 2021 11:40 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/35 "2021-05-24T11:40:36Z")

</div>

It was. Thanks. Starting to get my head around it now. Cheers

---

<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:** [23 July 2021 11:41 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064/36 "2021-07-23T11:41:15Z")

</div>

Closed on 23 July 2021 11:41 UTC

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

[Previous page](https://discourse.nodered.org/t/typeerror-cannot-read-property-tostring-of-undefined/46064.md?page=1)
