|
| 1 | +# BambuLab Binding |
| 2 | + |
| 3 | +This addon supports connecting with BambuLab 3D printers in local mode. |
| 4 | +While cloud mode is theoretically possible, it is not supported by the addon developers. |
| 5 | + |
| 6 | +## Cloud Mode |
| 7 | + |
| 8 | +Cloud mode is possible but not officially supported by the addon developers. |
| 9 | + |
| 10 | +To use cloud mode, follow these steps: |
| 11 | + |
| 12 | +### Find Username |
| 13 | + |
| 14 | +Log in to Maker World and visit [my-preferences](https://makerworld.com/api/v1/design-user-service/my/preference) to retrieve a JSON response containing your data. |
| 15 | +The relevant field is `uid`, which represents the unique ID of your account. |
| 16 | +Use this value as the `username` in the configuration (advanced field) with the prefix `u_`. |
| 17 | + |
| 18 | +### Access Token |
| 19 | + |
| 20 | +To obtain an access token, follow these steps: |
| 21 | + |
| 22 | +1. Log in using your email and password. |
| 23 | +2. Confirm the login using a token received via email. |
| 24 | + |
| 25 | +#### Step 1: Login with Email and Password |
| 26 | + |
| 27 | +```shell |
| 28 | +curl -X POST "https://api.bambulab.com/v1/user-service/user/login" \ |
| 29 | + -H "Content-Type: application/json" \ |
| 30 | + -d '{ |
| 31 | + |
| 32 | + "password": "superduperpassword123" |
| 33 | + }' |
| 34 | +``` |
| 35 | + |
| 36 | +#### Step 2: Confirm Login with Token from Email |
| 37 | + |
| 38 | +```shell |
| 39 | +curl -X POST "https://api.bambulab.com/v1/user-service/user/login" \ |
| 40 | + -H "Content-Type: application/json" \ |
| 41 | + -d '{ |
| 42 | + |
| 43 | + "code": "123456" |
| 44 | + }' |
| 45 | +``` |
| 46 | + |
| 47 | +You will receive a long access code in the response. Copy it and use it as the `accessCode` parameter. |
| 48 | + |
| 49 | +**Note:** This access code expires after three months. When it expires, repeat the process to obtain a new one. |
| 50 | + |
| 51 | +### Hostname |
| 52 | + |
| 53 | +Use `us.mqtt.bambulab.com` as the hostname. |
| 54 | + |
| 55 | +## Supported Things |
| 56 | + |
| 57 | +- `printer`: Represents a BambuLab 3D printer. |
| 58 | + |
| 59 | +## Thing Configuration |
| 60 | + |
| 61 | +| Parameter | Type | Required | Description | |
| 62 | +|--------------|---------|----------|-------------------------------------------------------------------------------------------------| |
| 63 | +| `serial` | Text | Yes | Unique serial number of the printer. | |
| 64 | +| `scheme` | Text | No | URI scheme. (Advanced) | |
| 65 | +| `hostname` | Text | Yes | IP address of the printer or `us.mqtt.bambulab.com` for cloud mode. | |
| 66 | +| `port` | Integer | No | URI port. (Advanced) | |
| 67 | +| `username` | Text | No | `bblp` for local mode or your Bambu Lab user (starting with `u_`). (Advanced) | |
| 68 | +| `accessCode` | Text | Yes | Access code for the printer. The method of obtaining this varies between local and cloud modes. | |
| 69 | + |
| 70 | +## Channels |
| 71 | + |
| 72 | +| Channel ID | Type | Description | |
| 73 | +|---------------------------|---------------------|------------------------------------------------------------------| |
| 74 | +| `nozzle-temperature` | Temperature Channel | Current temperature of the nozzle. | |
| 75 | +| `nozzle-target-temperature` | Temperature Channel | Target temperature of the nozzle. | |
| 76 | +| `bed-temperature` | Temperature Channel | Current temperature of the heated bed. | |
| 77 | +| `bed-target-temperature` | Temperature Channel | Target temperature of the heated bed. | |
| 78 | +| `chamber-temperature` | Temperature Channel | Current temperature inside the printer chamber. | |
| 79 | +| `mc-print-stage` | String Channel | Current stage of the print process. | |
| 80 | +| `mc-percent` | Percent Channel | Percentage of the print completed. | |
| 81 | +| `mc-remaining-time` | Number Channel | Estimated time remaining for the print (in seconds). | |
| 82 | +| `wifi-signal` | WiFi Channel | Current WiFi signal strength. | |
| 83 | +| `bed-type` | String Channel | Type of the printer's heated bed. | |
| 84 | +| `gcode-file` | String Channel | Name of the currently loaded G-code file. | |
| 85 | +| `gcode-state` | String Channel | Current state of the G-code execution. | |
| 86 | +| `reason` | String Channel | Reason for pausing or stopping the print. | |
| 87 | +| `result` | String Channel | Final result or status of the print job. | |
| 88 | +| `gcode-file-prepare-percent` | Percent Channel | Percentage of G-code file preparation completed. | |
| 89 | +| `big-fan1-speed` | Number Channel | Speed of the first large cooling fan (RPM). | |
| 90 | +| `big-fan2-speed` | Number Channel | Speed of the second large cooling fan (RPM). | |
| 91 | +| `heat-break-fan-speed` | Number Channel | Speed of the heat break cooling fan (RPM). | |
| 92 | +| `layer-num` | Number Channel | Current layer being printed. | |
| 93 | +| `speed-level` | Number Channel | Current speed setting of the print job. | |
| 94 | +| `time-laps` | Boolean Channel | Indicates whether time-lapse recording is enabled. | |
| 95 | +| `use-ams` | Boolean Channel | Indicates whether the Automatic Material System (AMS) is active. | |
| 96 | +| `vibration-calibration` | Boolean Channel | Indicates whether vibration calibration has been performed. | |
| 97 | +| `led-chamber` | On/Off Command | Controls the LED lighting inside the printer chamber. | |
| 98 | +| `led-work` | On/Off Command | Controls the LED lighting for the work area. | |
| 99 | + |
| 100 | +## Full Example |
| 101 | + |
| 102 | +### `bambulab.things` Example |
| 103 | + |
| 104 | +```java |
| 105 | +Thing bambulab:printer:myprinter "My BambuLab Printer" @ "3D Printing Area" [ |
| 106 | + serial="ABC123456789", |
| 107 | + hostname="192.168.1.100", |
| 108 | + accessCode="your_access_code_here" |
| 109 | +] |
| 110 | +``` |
| 111 | + |
| 112 | +### `bambulab.items` Exmaple |
| 113 | + |
| 114 | +```java |
| 115 | +Number:Temperature NozzleTemperature "Nozzle Temperature [%.1f °C]" { channel="bambulab:printer:myprinter:nozzle-temperature" } |
| 116 | +Number:Temperature BedTemperature "Bed Temperature [%.1f °C]" { channel="bambulab:printer:myprinter:bed-temperature" } |
| 117 | +String PrintStage "Print Stage [%s]" { channel="bambulab:printer:myprinter:mc-print-stage" } |
| 118 | +Switch LedChamber "Chamber LED" { channel="bambulab:printer:myprinter:led-chamber" } |
| 119 | +``` |
| 120 | + |
| 121 | +## Actions |
| 122 | + |
| 123 | +The printer thing supports actions: |
| 124 | + |
| 125 | +```java |
| 126 | +rule "test" |
| 127 | +when |
| 128 | + /* when */ |
| 129 | +then |
| 130 | +val actions = getActions("bambulab", "bambulab:printer:as8af03m38") |
| 131 | + if(actions !==null){ |
| 132 | + // Refresh all channels |
| 133 | + actions.refreshChannels() |
| 134 | + actions.sendCommand("Pushing:1:1") |
| 135 | + } |
| 136 | +end |
| 137 | +``` |
| 138 | + |
| 139 | +### `refreshChannels` |
| 140 | + |
| 141 | +Reports the complete status of the printer. |
| 142 | +This is unnecessary for the X1 series since it already transmits the full object each time. |
| 143 | +However, the P1 series only sends the values that have been updated compared to the previous report. |
| 144 | +As a rule of thumb, refrain from executing this command at intervals less than 5 minutes on the P1P, as it may cause lag due to its hardware limitations. |
| 145 | + |
| 146 | +### `sendCommand` |
| 147 | + |
| 148 | +The `sendCommand` method expects a string command in the format: |
| 149 | + |
| 150 | +``` |
| 151 | +CommandType:Parameter1:Parameter2:... |
| 152 | +``` |
| 153 | + |
| 154 | +#### Possible Commands: |
| 155 | + |
| 156 | +| Command Type | Parameters | Description | |
| 157 | +|----------------------|------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------| |
| 158 | +| `Pushing` | `version(int)`,`pushTarget(int)` (optional) | Sends a push command. | |
| 159 | +| `Print` | `START` / `STOP` / `PAUSE` | Controls the print job. | |
| 160 | +| `ChangeFilament` | `target(int)`,`currentTemperature(int))`,`targetTemperature(int)` | Changes filament using. | |
| 161 | +| `AmsUserSetting` | `amsId(int)`,`startupReadOption(boolean)`,`trayReadOption(boolean)` | Sets AMS user settings. | |
| 162 | +| `AmsFilamentSetting` | `amsId(int)`,`trayId(int)`,`trayInfoIdx(string)`,`trayColor(string)`,`nozzleTempMin(int)`,`nozzleTempMax(int)`,`trayType(string)` | Configures filament settings. | |
| 163 | +| `AmsControl` | ` RESUME` / `RESET` / `PAUSE` | Sends an AMS control command. | |
| 164 | +| `PrintSpeed` | `SILENT` / `STANDARD` / `SPORT` / `LUDICROUS` | Adjusts print speed. | |
| 165 | +| `GCodeFile` | `filename(string)` | Loads a G-code file. | |
| 166 | +| `GCodeLine` | `userId(string)\nlines(string...)` | Sends multiple G-code lines. Lines are enter (`\n`) separated | |
| 167 | +| `LedControl` | (`CHAMBER_LIGHT` / `WORK_LIGHT`),(`ON` / `OFF` / `FLASHING`),`ledOnTime(int)?`,`ledOffTime(int)?`,`loopTimes(int)?`,`intervalTime(int)?` | Controls LED lighting. | |
| 168 | +| `System` | `GET_ACCESS_CODE` | Executes a system command. | |
| 169 | +| `IpCamRecord` | `enable(boolean)` | Starts or stops IP camera recording. | |
| 170 | +| `Info` | `GET_VERSION` | Sends a info command. | |
| 171 | +| `IpCamTimelaps` | `enable(boolean)` | Enables or disables timelapse recording. | |
| 172 | +| `XCamControl` | (`FIRST_LAYER_INSPECTOR` / `SPAGHETTI_DETECTOR`),`control(boolean)`,`printHalt(boolean)` | Controls XCam settings. | |
0 commit comments