npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-bytes-modpackqt

v1.1.5

Published

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

Readme

node-red-contrib-bytes-modpackqt

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

npm version License: MIT

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.


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 perfectly with node-red-contrib-modbus-modpackqt — the Modbus palette outputs raw registers, this palette decodes them. Install both for the full experience.


Install

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

npm:

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

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 | DCBA | Little-endian devices, full reverse | | BE_SWAP | BADC | Byte-swap within each word | | LE_SWAP | CDAB | Word-swap (very common on older PLCs) |

If your decoded value looks like garbage, try the other word order.


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 value looks wrong, switch to LE_SWAP (older PLCs often use CDAB)

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_SWAP] → [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] → [endian-swap order=LE_SWAP width=4] → [decode-float32 BE] → [debug]

Examples

This package ships with two 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.
  • combined-with-modbus.json — full end-to-end demo combining this palette with node-red-contrib-modbus-modpackqt: read float from PLC → decode → debug; encode → write back; status bitmask; serial-number string.

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

For the combined example, also install node-red-contrib-modbus-modpackqt.


Pricing

Completely free, MIT licensed. No daily limits, no API key, no branding in node status. We make money on the Modbus palette's paid tier — this one is a gift to the community.


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 | Try another endian order — BELE_SWAP covers 99% of mismatches | | 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 (^1.0.0) in production.
  • 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

MIT — © ModPackQT. Provided "as is" without warranty of any kind. You are responsible for validating this software in your environment before any production use.