node-red-contrib-bytes-modpackqt 2.0.2

Universal byte / register decoder + encoder palette for Node-RED. Decode and encode int16, uint16, int32, uint32, float32, float64, strings, and bitmasks from any Buffer or numeric array — Modbus registers, MQTT payloads, raw TCP/UDP, BLE, LoRaWAN, file p

npm install node-red-contrib-bytes-modpackqt

node-red-contrib-bytes-modpackqt

Universal byte / register decoder + encoder palette for Node-RED. By ModPackQT.

npm version License: Free-to-use proprietary

Current release license: free to use under proprietary terms restricting modification and redistribution. Normal configuration and your own Node-RED flows are permitted. Review LICENSE for the full terms.

Decode and encode int16, uint16, int32, uint32, float32, float64, strings, and bitmasks from any Buffer or numeric array — Modbus registers, MQTT payloads, raw TCP/UDP, BLE, LoRaWAN, file parsing.

One node per type. Drop, wire, done.

Start here: Setup, both palettes and copy/download examples · Bytes on the Flow Library · ModPackQT web console · ModPackQT Desktop

Use Bytes on its own, or pair with Modbus

Need Install
Decode/encode Buffer, byte arrays or register arrays from MQTT, TCP/UDP, BLE, files or mock inputs Bytes only — no Modbus package, account or key required
Talk to a Modbus device or run a local simulator with raw words/coils ModPackQT Modbus only
Read/write Modbus engineering values such as float32 Both palettes — Modbus handles transport, Bytes handles conversion

Why this exists

Most binary-protocol packages bake decoding into the protocol itself (one giant node with a giant dropdown) or leave you writing a Function node every time. This palette gives you specialized blocks you can drop next to any source — Modbus, MQTT, TCP, BLE, file — and chain together cleanly.

[modbus master read FC3 qty=2] → [decode-float32 ABCD] → [debug]
[mqtt in: bytes]                → [decode-int32 LE]    → [if > 100] → [alert]
[ui slider]                     → [encode-float32 ABCD] → [modbus master write FC16]

Pairs with node-red-contrib-modbus-modpackqt — the Modbus palette outputs raw registers, this palette decodes them. Install both when you need Modbus transport; neither package requires the other for standalone use.


Install

Palette manager: Menu → Manage palette → Install → search bytes-modpackqt.

npm:

cd ~/.node-red
npm install node-red-contrib-bytes-modpackqt@latest

To install or update both in the same Node-RED user directory:

cd ~/.node-red
npm install node-red-contrib-modbus-modpackqt@latest node-red-contrib-bytes-modpackqt@latest

Use your actual Node-RED user directory if it is not ~/.node-red. Restart Node-RED using your normal launch method after installation/update; uninstalling first is not required. Review the included proprietary license terms before upgrading.


Nodes

Decoders (8)

Node Output Width
decode-int16 signed integer 1 register / 2 bytes
decode-uint16 unsigned integer 1 register / 2 bytes
decode-int32 signed integer 2 registers / 4 bytes
decode-uint32 unsigned integer 2 registers / 4 bytes
decode-float32 IEEE float 2 registers / 4 bytes
decode-float64 IEEE double 4 registers / 8 bytes
decode-string string (UTF-8 / ASCII / Latin-1) variable
decode-bitmask array of booleans 1 register → 16 bits

Encoders (6)

Node Input Output
encode-int16 number(s) register array
encode-uint16 number(s) register array
encode-int32 number(s) 2-register groups
encode-uint32 number(s) 2-register groups
encode-float32 number(s) 2-register groups
encode-float64 number(s) 4-register groups

Utility

Node Purpose
endian-swap Re-order bytes / words in a register array

Endianness, made simple

Every multi-byte node has an Endian dropdown:

Option Order When to use
BE (default) ABCD Most modern PLCs, default Modbus
LE CDAB Reverse 16-bit word order; keep bytes within each word
BE_SWAP BADC Byte-swap within each word
LE_SWAP DCBA Reverse both word and byte order

The table shows four-byte values. For eight-byte values, LE reverses all four 16-bit words; LE_SWAP reverses words and bytes. For a single 16-bit value, all non-BE options swap its two bytes. Earlier editor labels incorrectly described some options; labels are corrected here without changing their stored enum values or conversion behavior. Match the actual wire order, not a vendor's ambiguous use of the word "little-endian".


Input formats accepted

Decoder nodes accept any of:

  • msg.payload = Buffer → used as-is
  • msg.payload = array of 16-bit integers → treated as Modbus registers (default)
  • msg.payload = array of bytes (0–255) → set Source to Byte array

Output is a single value (one input element) or an array (multiple).


Cookbook

Combined with the Modbus palette

Read a temperature float from a PLC — the most common Modbus pattern:

[inject every 5s] → [modbus master read FC3 addr=100 qty=2] → [decode-float32 BE] → [debug]
  • [16828, 0] → 23.5
  • If the map specifies CDAB, use LE (reversed word order).

Send a setpoint back — encode + write:

[inject 23.5] → [encode-float32 BE] → [modbus master write FC16 addr=200]

Decode a 32-bit energy meter (kWh):

[master read FC3 addr=300 qty=2] → [decode-uint32 LE] → [debug]
// payload = 1234567 (kWh)

Parse a 16-bit status register into 16 booleans:

[master read FC3 addr=50 qty=1] → [decode-bitmask] → [function: payload[3] ? "fault" : "ok"]

Read a device serial number / nameplate string:

[master read FC3 addr=10 qty=8] → [decode-string BE encoding=utf8 trim=true] → [debug]
// payload = "SN-2025-A0042"

Mirror MQTT setpoints to PLC:

[mqtt in topic=plant/setpoint] → [encode-float32 BE] → [modbus master write FC16 addr=200]

Bridge PLC values to MQTT:

[poll every 1s] → [master read FC3 addr=100 qty=2] → [decode-float32 BE] → [mqtt out topic=plant/temp]

With other protocols (no Modbus needed)

Decode an MQTT byte payload (e.g. from a Sparkplug device):

[mqtt in] → [decode-int32 LE source=bytes] → [debug]

Decode a TCP/UDP frame from custom hardware:

[tcp in] → [decode-float64 BE source=bytes] → [debug]

Decode a BLE characteristic (Buffer payload):

[ble in] → [decode-uint16 LE source=bytes] → [debug]

Fix word order on incoming data, then decode:

[some source: CDAB] → [endian-swap endian=LE width=4] → [decode-float32 BE] → [debug]

Examples

This package ships with three example flows under examples/:

  • decoder-recipes.json — six standalone patterns showing every decoder/encoder with mock inject sources (no PLC needed). Great for learning what each node does.
  • binary-payloads.json — standalone raw byte-array, actual Buffer, CDAB word-order and float32 encoder samples. Represents MQTT/TCP/BLE input without opening network connections or needing a broker. Expected decoded float: 23.5; encoded registers: [16828,0].
  • combined-with-modbus.json — install both palettes, Deploy and wait for listening status, then click Inject. A local standalone Slave Server at 127.0.0.1:15023 stores two words, a Master Read retrieves them over real TCP, and Bytes decodes 23.5. A second manual path encodes/writes 42.5 via FC16 and verifies it through FC3 readback.

Node-RED → Menu → Import → Examples → node-red-contrib-bytes-modpackqt.

No PLC, broker, account or key is needed for these demos. The combined flow has no startup triggers or automatic polling and binds only to loopback; it also starts the local console probe listener. If port 15023 is occupied, change both Slave Server and Target Device ports. A float32 occupies two registers: keep both read and FC16 write Quantity set to 2.

The online example guide offers the actual packaged JSON to copy/download, with requirements and expected results. For raw Modbus-only and dynamic-coil recipes, open Import → Examples → node-red-contrib-modbus-modpackqt after installing the companion.


Pricing

Free to use under proprietary terms. No daily limits, no API key, no branding in node status. Modification and redistribution are restricted; normal configuration and your own flows remain permitted. See LICENSE.


Pairs perfectly with

  • node-red-contrib-modbus-modpackqt — embedded Modbus master + slave server (the natural pairing — most users install both)
  • Standard mqtt in / tcp in / serial in / udp in nodes
  • Anything that emits a Buffer or numeric array

Troubleshooting

Issue Solution
Decoded value looks like garbage Confirm source type and wire order: BE=ABCD, LE=CDAB, BE_SWAP=BADC, LE_SWAP=DCBA for 32-bit values
decode-string returns scrambled text Some PLCs swap character pairs — switch Endian to LE
Encoder output is the wrong length Multi-byte types output groups: int32 → 2 regs, float64 → 4 regs. Check your write FC accepts that quantity.
Bitmask returns more bits than expected Set the Bits field to truncate (e.g. 8 for first byte only)

Reporting bugs & getting updates

  • Bugs / feature requests: use our contact page.
  • Security issues: report privately via the security page.
  • Updates are never automatic. Node-RED's palette manager will show "update available" when we publish a new version. Pin a major version (^2.0.0) in production. Review the included license terms before upgrading to a new major version.
  • Changelog: the CHANGELOG.md file is shipped inside this package. Decoders and encoders shipped today will keep producing the same output for the same input forever — that's a stability promise.

Links


License & disclaimer

This release is free-to-use proprietary — © ModPackQT. See LICENSE. Third-party licenses remain applicable. Provided "as is" without warranty of any kind. You are responsible for validating this software in your environment before any production use.

Node Info

Version: 2.0.2
Updated 2 weeks, 6 days ago
License: SEE LICENSE IN LICENSE
Rating: 5.0 3

Categories

Actions

Rate:

Downloads

31 in the last week

Nodes

  • decode-int16
  • decode-uint16
  • decode-int32
  • decode-uint32
  • decode-float32
  • decode-float64
  • decode-string
  • decode-bitmask
  • encode-int16
  • encode-uint16
  • encode-int32
  • encode-uint32
  • encode-float32
  • encode-float64
  • endian-swap

Keywords

  • node-red
  • bytes
  • buffer
  • decoder
  • encoder
  • modbus
  • modbus-decoder
  • float32
  • float64
  • int16
  • int32
  • uint16
  • uint32
  • bitmask
  • endianness
  • endian-swap
  • modpackqt
  • iiot
  • mqtt
  • ble
  • lorawan

Maintainers