bambu-mqtt 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 YourName
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,257 @@
1
+ Metadata-Version: 2.4
2
+ Name: bambu-mqtt
3
+ Version: 0.1.0
4
+ Summary: Bambu Lab MQTT telemetry collector with InfluxDB integration
5
+ Author: NullVanta
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/NullVanta/bambu-mqtt
8
+ Project-URL: Repository, https://github.com/NullVanta/bambu-mqtt
9
+ Project-URL: Issues, https://github.com/NullVanta/bambu-mqtt/issues
10
+ Requires-Python: >=3.14
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: paho-mqtt
14
+ Requires-Dist: cryptography
15
+ Requires-Dist: influxdb-client
16
+ Dynamic: license-file
17
+
18
+ # bambu-mqtt
19
+
20
+ **A Python-based MQTT telemetry collector for Bambu Lab 3D printers.**
21
+
22
+ `bambu-mqtt` connects to a Bambu Lab printer over its local MQTT interface using TLS, parses printer and AMS telemetry into structured Python dataclasses, and exports the collected data to InfluxDB for monitoring and visualization.
23
+
24
+ Designed for self-hosted monitoring setups using InfluxDB and Grafana.
25
+
26
+ ## Features
27
+
28
+ - Connects to Bambu Lab printers through local MQTT.
29
+ - Uses TLS certificate authentication.
30
+ - Parses MQTT status messages into structured telemetry objects.
31
+ - Tracks printer status, print progress and layer information.
32
+ - Collects nozzle, bed and chamber temperature readings.
33
+ - Monitors Wi-Fi signal strength.
34
+ - Supports multiple AMS units and their individual filament trays.
35
+ - Exports telemetry to InfluxDB.
36
+ - Uses Python logging for configurable runtime diagnostics.
37
+
38
+ ## Architecture
39
+
40
+ ```mermaid
41
+ flowchart TD
42
+ A["Bambu Lab Printer"] -->|MQTT over TLS| B["MQTT Client"]
43
+ B --> C["Telemetry Parser"]
44
+ C --> D["Python Dataclasses"]
45
+ D --> E["InfluxDB Writer"]
46
+ E --> F[("InfluxDB")]
47
+ F --> G["Grafana"]
48
+
49
+ subgraph Collector["bambu-mqtt"]
50
+ B
51
+ C
52
+ D
53
+ E
54
+ end
55
+ ```
56
+
57
+ ## Requirements
58
+
59
+ - A compatible Bambu Lab printer with local MQTT access.
60
+ - Developer mode enabled on the printer, where required.
61
+ - Python.
62
+ - An MQTT TLS certificate.
63
+ - An InfluxDB 2.x instance.
64
+ - An InfluxDB API token with write permissions.
65
+
66
+ ## Installation
67
+
68
+ Clone the repository:
69
+
70
+ ```bash
71
+ git clone https://github.com/NullVanta/bambu-mqtt.git
72
+ cd bambu-mqtt
73
+ ```
74
+
75
+ Install the project dependencies using Pipenv:
76
+
77
+ ```bash
78
+ pipenv install
79
+ ```
80
+
81
+ For development dependencies:
82
+
83
+ ```bash
84
+ pipenv install --dev
85
+ ```
86
+
87
+ ## Configuration
88
+
89
+ Before starting the collector, obtain the required printer connection information:
90
+
91
+ | Parameter | Description |
92
+ |---|---|
93
+ | Host | Printer's local IP address |
94
+ | Access code | Printer's LAN access code |
95
+ | Certificate | TLS certificate used for authentication |
96
+ | InfluxDB URL | InfluxDB server address |
97
+ | InfluxDB token | API token with bucket write access |
98
+ | InfluxDB organization | Target InfluxDB organization |
99
+ | InfluxDB bucket | Target bucket for telemetry |
100
+
101
+ The printer device ID is derived from the certificate's Common Name (CN).
102
+
103
+ Set your InfluxDB token as an environment variable:
104
+
105
+ ```bash
106
+ export INFLUXDB_TOKEN="your-influxdb-token"
107
+ ```
108
+
109
+ ## Usage
110
+
111
+ Start the collector:
112
+
113
+ ```bash
114
+ pipenv run python -m bambu_mqtt \
115
+ --host 192.168.0.240 \
116
+ --cert ./blcert.pem \
117
+ --access-code YOUR_ACCESS_CODE \
118
+ --influx-url http://localhost:8086 \
119
+ --influx-org YOUR_ORG \
120
+ --influx-bucket bambulab
121
+ ```
122
+
123
+ ### Command-line arguments
124
+
125
+ | Argument | Description |
126
+ |---|---|
127
+ | `-H`, `--host` | Printer IP address |
128
+ | `--access-code` | Printer LAN access code |
129
+ | `-c`, `--cert` | Path to the TLS certificate |
130
+ | `-l`, `--log-level` | Logging verbosity |
131
+ | `-v`, `--version` | Display application version |
132
+ | `--influx-url` | InfluxDB server URL |
133
+ | `--influx-token` | InfluxDB API token |
134
+ | `--influx-org` | InfluxDB organization |
135
+ | `--influx-bucket` | InfluxDB destination bucket |
136
+
137
+ Supported log levels:
138
+
139
+ `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
140
+
141
+ The default logging level is `INFO`.
142
+
143
+ ## Telemetry
144
+
145
+ Telemetry is normalized into structured Python dataclasses before being passed to the configured writer.
146
+
147
+ ### Printer
148
+
149
+ - Printer state
150
+ - Print progress
151
+ - Current layer
152
+ - Total layers
153
+ - Remaining print time
154
+ - Job name
155
+
156
+ ### Temperatures
157
+
158
+ - Nozzle temperature
159
+ - Nozzle target temperature
160
+ - Bed temperature
161
+ - Bed target temperature
162
+ - Chamber temperature
163
+ - Chamber target temperature, when available
164
+
165
+ ### Connectivity
166
+
167
+ - Wi-Fi signal strength
168
+
169
+ ### AMS
170
+
171
+ - AMS identifier
172
+ - AMS temperature
173
+ - Humidity
174
+ - Raw humidity
175
+ - Individual filament tray information
176
+
177
+ ### Filament trays
178
+
179
+ - Tray identifier
180
+ - Filament type
181
+ - Filament colour
182
+ - Remaining filament percentage
183
+ - Minimum and maximum nozzle temperatures
184
+ - Filament diameter
185
+ - Filament spool weight
186
+
187
+ Unavailable telemetry fields are represented as `None`.
188
+
189
+ ## InfluxDB measurements
190
+
191
+ The InfluxDB writer currently exports three measurements:
192
+
193
+ | Measurement | Contents |
194
+ |---|---|
195
+ | `printer` | Printer status, temperatures and connectivity |
196
+ | `ams` | AMS temperature and humidity |
197
+ | `ams_tray` | Individual filament tray information |
198
+
199
+ These measurements can be queried in Grafana using Flux.
200
+
201
+ ## Logging
202
+
203
+ The application uses Python's standard logging framework.
204
+
205
+ Example output:
206
+
207
+ ```text
208
+ INFO | Connected to printer
209
+ DEBUG | Subscribed to MQTT topic
210
+ INFO | Received MQTT message, parsing now
211
+ INFO | Connecting to InfluxDB
212
+ INFO | Successfully connected to InfluxDB
213
+ DEBUG | Successfully wrote 6 telemetry points
214
+ INFO | Telemetry written to InfluxDB successfully
215
+ ```
216
+
217
+ Logging verbosity can be adjusted using `--log-level`.
218
+
219
+ ## Development
220
+
221
+ The project uses Pipenv for dependency management.
222
+
223
+ Install development dependencies:
224
+
225
+ ```bash
226
+ pipenv install --dev
227
+ ```
228
+
229
+ Run the application:
230
+
231
+ ```bash
232
+ pipenv run python -m bambu_mqtt
233
+ ```
234
+
235
+ ### Code quality
236
+
237
+ The project uses:
238
+
239
+ - Black for code formatting.
240
+ - Pylint for static code analysis.
241
+
242
+ Run the checks:
243
+
244
+ ```bash
245
+ pipenv run black --check bambu_mqtt
246
+ pipenv run pylint bambu_mqtt
247
+ ```
248
+
249
+ ## Project status
250
+
251
+ `bambu-mqtt` is under active development.
252
+
253
+ The initial release focuses on local MQTT connectivity, telemetry parsing and InfluxDB integration.
254
+
255
+ ## License
256
+
257
+ See [LICENSE](LICENSE) for licensing information.
@@ -0,0 +1,240 @@
1
+ # bambu-mqtt
2
+
3
+ **A Python-based MQTT telemetry collector for Bambu Lab 3D printers.**
4
+
5
+ `bambu-mqtt` connects to a Bambu Lab printer over its local MQTT interface using TLS, parses printer and AMS telemetry into structured Python dataclasses, and exports the collected data to InfluxDB for monitoring and visualization.
6
+
7
+ Designed for self-hosted monitoring setups using InfluxDB and Grafana.
8
+
9
+ ## Features
10
+
11
+ - Connects to Bambu Lab printers through local MQTT.
12
+ - Uses TLS certificate authentication.
13
+ - Parses MQTT status messages into structured telemetry objects.
14
+ - Tracks printer status, print progress and layer information.
15
+ - Collects nozzle, bed and chamber temperature readings.
16
+ - Monitors Wi-Fi signal strength.
17
+ - Supports multiple AMS units and their individual filament trays.
18
+ - Exports telemetry to InfluxDB.
19
+ - Uses Python logging for configurable runtime diagnostics.
20
+
21
+ ## Architecture
22
+
23
+ ```mermaid
24
+ flowchart TD
25
+ A["Bambu Lab Printer"] -->|MQTT over TLS| B["MQTT Client"]
26
+ B --> C["Telemetry Parser"]
27
+ C --> D["Python Dataclasses"]
28
+ D --> E["InfluxDB Writer"]
29
+ E --> F[("InfluxDB")]
30
+ F --> G["Grafana"]
31
+
32
+ subgraph Collector["bambu-mqtt"]
33
+ B
34
+ C
35
+ D
36
+ E
37
+ end
38
+ ```
39
+
40
+ ## Requirements
41
+
42
+ - A compatible Bambu Lab printer with local MQTT access.
43
+ - Developer mode enabled on the printer, where required.
44
+ - Python.
45
+ - An MQTT TLS certificate.
46
+ - An InfluxDB 2.x instance.
47
+ - An InfluxDB API token with write permissions.
48
+
49
+ ## Installation
50
+
51
+ Clone the repository:
52
+
53
+ ```bash
54
+ git clone https://github.com/NullVanta/bambu-mqtt.git
55
+ cd bambu-mqtt
56
+ ```
57
+
58
+ Install the project dependencies using Pipenv:
59
+
60
+ ```bash
61
+ pipenv install
62
+ ```
63
+
64
+ For development dependencies:
65
+
66
+ ```bash
67
+ pipenv install --dev
68
+ ```
69
+
70
+ ## Configuration
71
+
72
+ Before starting the collector, obtain the required printer connection information:
73
+
74
+ | Parameter | Description |
75
+ |---|---|
76
+ | Host | Printer's local IP address |
77
+ | Access code | Printer's LAN access code |
78
+ | Certificate | TLS certificate used for authentication |
79
+ | InfluxDB URL | InfluxDB server address |
80
+ | InfluxDB token | API token with bucket write access |
81
+ | InfluxDB organization | Target InfluxDB organization |
82
+ | InfluxDB bucket | Target bucket for telemetry |
83
+
84
+ The printer device ID is derived from the certificate's Common Name (CN).
85
+
86
+ Set your InfluxDB token as an environment variable:
87
+
88
+ ```bash
89
+ export INFLUXDB_TOKEN="your-influxdb-token"
90
+ ```
91
+
92
+ ## Usage
93
+
94
+ Start the collector:
95
+
96
+ ```bash
97
+ pipenv run python -m bambu_mqtt \
98
+ --host 192.168.0.240 \
99
+ --cert ./blcert.pem \
100
+ --access-code YOUR_ACCESS_CODE \
101
+ --influx-url http://localhost:8086 \
102
+ --influx-org YOUR_ORG \
103
+ --influx-bucket bambulab
104
+ ```
105
+
106
+ ### Command-line arguments
107
+
108
+ | Argument | Description |
109
+ |---|---|
110
+ | `-H`, `--host` | Printer IP address |
111
+ | `--access-code` | Printer LAN access code |
112
+ | `-c`, `--cert` | Path to the TLS certificate |
113
+ | `-l`, `--log-level` | Logging verbosity |
114
+ | `-v`, `--version` | Display application version |
115
+ | `--influx-url` | InfluxDB server URL |
116
+ | `--influx-token` | InfluxDB API token |
117
+ | `--influx-org` | InfluxDB organization |
118
+ | `--influx-bucket` | InfluxDB destination bucket |
119
+
120
+ Supported log levels:
121
+
122
+ `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
123
+
124
+ The default logging level is `INFO`.
125
+
126
+ ## Telemetry
127
+
128
+ Telemetry is normalized into structured Python dataclasses before being passed to the configured writer.
129
+
130
+ ### Printer
131
+
132
+ - Printer state
133
+ - Print progress
134
+ - Current layer
135
+ - Total layers
136
+ - Remaining print time
137
+ - Job name
138
+
139
+ ### Temperatures
140
+
141
+ - Nozzle temperature
142
+ - Nozzle target temperature
143
+ - Bed temperature
144
+ - Bed target temperature
145
+ - Chamber temperature
146
+ - Chamber target temperature, when available
147
+
148
+ ### Connectivity
149
+
150
+ - Wi-Fi signal strength
151
+
152
+ ### AMS
153
+
154
+ - AMS identifier
155
+ - AMS temperature
156
+ - Humidity
157
+ - Raw humidity
158
+ - Individual filament tray information
159
+
160
+ ### Filament trays
161
+
162
+ - Tray identifier
163
+ - Filament type
164
+ - Filament colour
165
+ - Remaining filament percentage
166
+ - Minimum and maximum nozzle temperatures
167
+ - Filament diameter
168
+ - Filament spool weight
169
+
170
+ Unavailable telemetry fields are represented as `None`.
171
+
172
+ ## InfluxDB measurements
173
+
174
+ The InfluxDB writer currently exports three measurements:
175
+
176
+ | Measurement | Contents |
177
+ |---|---|
178
+ | `printer` | Printer status, temperatures and connectivity |
179
+ | `ams` | AMS temperature and humidity |
180
+ | `ams_tray` | Individual filament tray information |
181
+
182
+ These measurements can be queried in Grafana using Flux.
183
+
184
+ ## Logging
185
+
186
+ The application uses Python's standard logging framework.
187
+
188
+ Example output:
189
+
190
+ ```text
191
+ INFO | Connected to printer
192
+ DEBUG | Subscribed to MQTT topic
193
+ INFO | Received MQTT message, parsing now
194
+ INFO | Connecting to InfluxDB
195
+ INFO | Successfully connected to InfluxDB
196
+ DEBUG | Successfully wrote 6 telemetry points
197
+ INFO | Telemetry written to InfluxDB successfully
198
+ ```
199
+
200
+ Logging verbosity can be adjusted using `--log-level`.
201
+
202
+ ## Development
203
+
204
+ The project uses Pipenv for dependency management.
205
+
206
+ Install development dependencies:
207
+
208
+ ```bash
209
+ pipenv install --dev
210
+ ```
211
+
212
+ Run the application:
213
+
214
+ ```bash
215
+ pipenv run python -m bambu_mqtt
216
+ ```
217
+
218
+ ### Code quality
219
+
220
+ The project uses:
221
+
222
+ - Black for code formatting.
223
+ - Pylint for static code analysis.
224
+
225
+ Run the checks:
226
+
227
+ ```bash
228
+ pipenv run black --check bambu_mqtt
229
+ pipenv run pylint bambu_mqtt
230
+ ```
231
+
232
+ ## Project status
233
+
234
+ `bambu-mqtt` is under active development.
235
+
236
+ The initial release focuses on local MQTT connectivity, telemetry parsing and InfluxDB integration.
237
+
238
+ ## License
239
+
240
+ See [LICENSE](LICENSE) for licensing information.
File without changes