Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Feature Request] HMS Code mapping

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
api

Research direction

Start by inspecting the report print payload's hms array and the provided Node-RED conversion snippet. Compare the decimal attr and code values with the linked Bambu HMS-code documentation; completion criteria and the implementation location still need to be agreed because the issue does not identify a project entry point or expected API shape.

Written by the indexing model from the issue text.

Description

Wasn't sure where this would fit in the current layout, so I will give my findings here.

In the report print payload for all sensors (or a subset if the P1P as it does not send all unless pushall is invoked), there is the value hms with an array.

If it contains values, it is as such:

"hms": [
    {
        "code": "somecode",
        "attr": "somecode"
    },
    {
        "code": "somecode",
        "attr": "somecode"
    }
]

The codes and attributes are not recognizable at first, but can be mapped to errors. Both the code and attr are decimal numbers that when converted to Hex with Two's complement, then append the code after the attr and separate each set of 4 character with an underscore, it will be in the format of Bambu's official HMS code errors as per their website.

Note: Not all hms codes are documented yet.

Here is a snippet of how I convert them in nodered:

function DecimalHexTwosComplement(decimal) {
    var size = 8;
    var hexadecimal;
    if (decimal >= 0) {
        hexadecimal = decimal.toString(16);

        while ((hexadecimal.length % size) != 0) {
            hexadecimal = "" + 0 + hexadecimal;
        }

        return hexadecimal;
    } else {
        hexadecimal = Math.abs(decimal).toString(16);
        while ((hexadecimal.length % size) != 0) {
            hexadecimal = "" + 0 + hexadecimal;
        }

        var output = '';
        for (var i = 0; i < hexadecimal.length; i++) {
            output += (0x0F - parseInt(hexadecimal[i], 16)).toString(16);
        }

        output = (0x01 + parseInt(output, 16)).toString(16);
        return output;
    }
}

let template = [];
if(msg.payload.print.hms != undefined){
    for (var hms_code of msg.payload.print.hms) {
        var attr = DecimalHexTwosComplement(hms_code.attr);
        var code = DecimalHexTwosComplement(hms_code.code);
        let full_code = (attr + code).replace(/(.{4})/g, "$1_");
        full_code = full_code.substring(0, full_code.length - 1);
        let url = "https://wiki.bambulab.com/en/x1/troubleshooting/hmscode/"+full_code;
        template.push({"code": "HMS_"+full_code, "url": url});
    }
    msg.payload.print.hms = template;
}
Dominant language
No language data
Stars
684
Forks
96
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Doridian/OpenBambuAPI

All issues in Doridian/OpenBambuAPI

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.