homebridge-brother-printer 0.0.0-stage → 0.2.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,50 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 - 2026-11-03
4
+
5
+ ### Added
6
+ - Color lasers: toner per color, drum per color, belt, fuser, laser unit and paper feed kits.
7
+ - Inkjets: ink per color and the ink waste box. Toner wording becomes Ink.
8
+ - The battery shows the lowest color, and turns low when any color reaches the threshold by
9
+ either reading, or when the printer flags low toner.
10
+ - Toner / ink tiles: one per color on color printers.
11
+ - SNMP v1 for older printers (`snmpVersion`, automatic by default).
12
+ - Printers that report no levels (older and ink tank models) get no battery instead of 0%.
13
+ - Warnings in the log when the drum or another part nears end of life.
14
+ - Problem log lines name the condition (cover open, paper jam...).
15
+ - Page count from mono + color counts on inkjets that don't report a total.
16
+
17
+ ### Changed
18
+ - Status text is decoded in the printer's character set, so non-English displays read
19
+ correctly. Problems and printing rely on language-neutral status codes first.
20
+ - Model and serial also read from Brother's own records, for printers without the
21
+ standard ones; page count falls back to the Printer MIB.
22
+ - When coarse levels tie (they move in 10% steps), the finer reading picks the lowest
23
+ color, so the battery names the color that is actually running out.
24
+ - Tested against SNMP captures from 14 Brother models.
25
+
26
+ ## 0.1.4 - 2026-11-03
27
+
28
+ First public release.
29
+
30
+ ### Added
31
+ - Printing state as an occupancy sensor, from `hrPrinterStatus` and the printer's display.
32
+ - Printer Problem contact sensor that opens on a jam, open cover, empty tray or other error.
33
+ Apple Home doesn't show Status Fault on occupancy sensors.
34
+ - Toner % as a battery level with a configurable low threshold, read from Brother's own
35
+ SNMP records rather than the standard Printer MIB.
36
+ - No Response in the Home app while the printer can't be reached, recovering when it answers.
37
+ - Optional toner tile (humidity sensor) and optional drum-life battery.
38
+ - Page count as a custom characteristic.
39
+ - `brother-printer-probe` command to check what a printer reports.
40
+ - Settings screen, tests and linting.
41
+
42
+ ### Changed
43
+ - Drum life is off by default: Home shows one battery per accessory and was showing the
44
+ drum instead of the toner. The drum is still read and warned about in the log.
45
+ - Settings screen no longer reports a validation error for the blank printer row it adds.
46
+ Rows without a host are ignored, with a warning only if they were filled in.
47
+
48
+ ## 0.1.3 - 2026-11-03
49
+
50
+ Private pre-releases (0.1.0 to 0.1.3), tested on an MFC-L2750DW.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Manuel Zamfir
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,174 @@
1
- # Temporary Holding Version
1
+ # homebridge-brother-printer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://badgen.net/npm/v/homebridge-brother-printer)](https://www.npmjs.com/package/homebridge-brother-printer)
4
+ [![license](https://badgen.net/github/license/zmanuel1234/homebridge-brother-printer)](LICENSE)
5
+
6
+ Shows a Brother laser or inkjet printer in HomeKit: whether it's printing, whether it
7
+ needs attention, and how much toner or ink is left. Everything is read locally over SNMP,
8
+ with no cloud or Brother account.
9
+
10
+ Generic AirPrint/IPP plugins can't show real toner levels on many Brother printers,
11
+ because the standard Printer MIB only reports "some remaining". Brother's own SNMP
12
+ records carry the actual percentages shown on the printer's web page, and this plugin
13
+ reads those.
14
+
15
+ Each printer gets these sensors:
16
+
17
+ - **Printer** (occupancy sensor): Detected while a job prints. Use it in automations.
18
+ - **Printer Problem** (contact sensor): Open on a jam, open cover, empty tray or other
19
+ error. Turn on notifications for it in the Home app.
20
+ - **Toner / Ink** (battery level on the Printer accessory): the toner or ink %, with Home's
21
+ native low-battery alert at or below your threshold. On color printers it shows the
22
+ lowest color, so the alert fires when any color runs low.
23
+ - **Toner / ink tiles** (optional humidity sensors): the level as a number on its own tile,
24
+ one per color on color printers.
25
+
26
+ While the printer can't be reached, all of them show No Response.
27
+
28
+ ## Requirements
29
+
30
+ - A Brother printer with SNMP. Tested on a real **MFC-L2750DW**, and against SNMP
31
+ captures from these models (from the [brother](https://github.com/bieniu/brother)
32
+ library, which Home Assistant's Brother integration uses):
33
+
34
+ | Kind | Models | What's read |
35
+ |---|---|---|
36
+ | Mono laser | MFC-L2750DW, HL-L2340DW, DCP-L2540DN, DCP-7070DW, DCP-1618W | Toner, drum |
37
+ | Color laser | DCP-L3550CDW, DCP-9020CDW | Toner per color, drums, belt, fuser, paper feed kit |
38
+ | Inkjet | MFC-J680DW, MFC-J5110DW, DCP-J132W, DCP-T735DW, MFC-5490CN | Ink per color, ink waste box |
39
+ | Older / ink tank | HL-2270DW, HL-5350DN, MFC-T910DW | Status, problems, page count; these don't report levels |
40
+
41
+ Other Brother models generally use the same records. Reports, with the probe output
42
+ below, are welcome.
43
+ - SNMP turned on in the printer's web page: **Network → Protocol → SNMP** (v1/v2c,
44
+ read-only is enough). The default community is `public`.
45
+ - A fixed address for the printer: reserve its IP in your router, or use its mDNS
46
+ hostname (for example `brn3c2af4919dfc.local`).
47
+ - Homebridge 1.6 or later (including 2.x), Node.js 18, 20, 22 or 24.
48
+
49
+ ## Installation
50
+
51
+ Search for **Brother Printer** in the Homebridge UI's Plugins tab, or run:
52
+
53
+ ```bash
54
+ npm install -g homebridge-brother-printer
55
+ ```
56
+
57
+ Running it as a child bridge is recommended.
58
+
59
+ ## Configuration
60
+
61
+ Set it up in the plugin's settings screen, or in `config.json`:
62
+
63
+ ```json
64
+ {
65
+ "platform": "BrotherPrinter",
66
+ "printers": [
67
+ {
68
+ "name": "Printer",
69
+ "host": "10.0.4.150"
70
+ }
71
+ ]
72
+ }
73
+ ```
74
+
75
+ | Option | Default | Description |
76
+ |---|---|---|
77
+ | `name` | `Printer` | Accessory name. Must be unique per printer. |
78
+ | `host` | | Printer IP address or hostname. Printers without one are ignored. |
79
+ | `community` | `public` | SNMP community string. |
80
+ | `port` | `161` | SNMP port. |
81
+ | `snmpVersion` | `auto` | `auto` tries v2c, then v1. Set `1` for older printers that only answer v1. |
82
+ | `pollInterval` | `60` | Seconds between polls (10–3600). |
83
+ | `lowTonerThreshold` | `10` | Toner or ink % at or below which Home shows it as low (any color, on color printers). |
84
+ | `faultSensor` | `true` | Add the Printer Problem contact sensor. |
85
+ | `tonerTile` | `false` | Add humidity sensors showing the toner or ink %, one per color on color printers. They also count in Home's climate summary. |
86
+ | `showDrum` | `false` | Add drum life as a second battery. See below. |
87
+ | `lowDrumThreshold` | `10` | Drum and parts % (belt, fuser, laser unit, paper feed kit, ink waste box) at or below which a warning is logged, and the drum battery shows low. |
88
+ | `offlineAfter` | `3` | Failed polls in a row before the printer shows No Response. |
89
+ | `debug` | `false` | Log every poll at info level. |
90
+
91
+ ## What the Home app shows
92
+
93
+ HomeKit has no printer accessory type, so the plugin uses the closest sensors and Home
94
+ words them its own way:
95
+
96
+ - The printing sensor reads **Detected** / **Not Detected**.
97
+ - Low toner or ink is announced as **"battery is low"**. For a clearer message, add a Home
98
+ automation on that trigger that sends your own notification.
99
+ - Home shows only one battery per accessory. With `showDrum` on, it may show the drum
100
+ instead of the toner, which is why the drum is off by default. It's still read, and the
101
+ plugin logs a warning when it nears end of life. Apps like Eve show both.
102
+ - The page count is a custom characteristic, visible in Eve, Controller and the Homebridge
103
+ UI, not in Apple Home.
104
+
105
+ ## Levels and low alerts
106
+
107
+ Brother printers report two readings per supply: a coarse one (the number on the
108
+ printer's web page and display) and a finer one. The battery and tiles show the coarse
109
+ one, so they match the printer. A supply counts as low when either reading is at or below
110
+ `lowTonerThreshold`, or when the printer itself flags low toner, so a cartridge that shows
111
+ 10% but is really at 2% still raises the alert.
112
+
113
+ Printers without level reporting (some older models and ink tank printers) get no
114
+ battery; status, problems and the page count still work.
115
+
116
+ ## Going offline
117
+
118
+ The time before a printer shows No Response is about
119
+ `offlineAfter` × (`pollInterval` + 10 s), where 10 s is the SNMP timeout. With the
120
+ defaults that's about 3.5 minutes; `pollInterval: 30` with `offlineAfter: 1` brings it to
121
+ about 40 s. With `offlineAfter: 1`, a single lost packet can make it flash No Response for
122
+ one poll.
123
+
124
+ Brother lasers normally still answer SNMP in Sleep and Deep Sleep.
125
+
126
+ ## Checking what your printer reports
127
+
128
+ The package includes a command that prints what the plugin reads:
129
+
130
+ ```bash
131
+ npx -p homebridge-brother-printer brother-printer-probe 10.0.4.150
132
+ ```
133
+
134
+ Compare `tonerPercent` with **Remaining Life** on the printer's web page. If it doesn't
135
+ match, or values are `null`, please open an issue with the probe output and your printer
136
+ model.
137
+
138
+ ## Troubleshooting
139
+
140
+ - **"Can't reach … Request timed out"**: SNMP is off on the printer, the address is wrong,
141
+ or a firewall blocks UDP port 161. Test from the Homebridge machine with
142
+ `snmpget -v2c -c public <printer-ip> 1.3.6.1.2.1.1.1.0` (from the `snmp` package).
143
+ - **Status text in another language**: the plugin reads the printer's character set, so
144
+ the log shows the display text as the printer shows it. Problems and printing are
145
+ detected from language-neutral status codes, with English display text as a fallback.
146
+ - **Old printer never connects**: set `snmpVersion` to `1`.
147
+ - **Toner shows 0% with a full cartridge**: some non-genuine cartridges aren't recognised
148
+ by the printer, which then reports no level.
149
+
150
+ ## How it works
151
+
152
+ Brother printers expose maintenance data as packed records in their private MIB
153
+ (`1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8`, `.5.10` and `.5.11`). Each record is a one-byte
154
+ code, `0x01`, a length byte and a big-endian value; older models use a two-byte
155
+ current/max form. The main codes:
156
+
157
+ | Code | Meaning |
158
+ |---|---|
159
+ | `0x81`–`0x84` | Black, cyan, magenta, yellow toner or ink, % (coarse) |
160
+ | `0x6f`–`0x72`, `0xa1`–`0xa4` | The same, finer reading |
161
+ | `0x41`, `0x80`, `0x79`–`0x7b` | Drum life (mono; black, cyan, magenta, yellow) |
162
+ | `0x69`–`0x6d`, `0x85` | Belt, fuser, laser unit, paper feed kits, ink waste box |
163
+ | next care `0x82`, `0xa4`–`0xa7` | Drum pages remaining |
164
+ | counter `0x00` | Total pages printed |
165
+
166
+ Printing and problem state come from the standard Host Resources MIB (`hrPrinterStatus`,
167
+ `hrPrinterDetectedErrorState`), with the display text as a fallback.
168
+
169
+ The record codes follow the [brother](https://github.com/bieniu/brother) Python library
170
+ by Maciej Bieniek (Apache-2.0), and the tests use SNMP captures from its test suite.
171
+
172
+ ## License
173
+
174
+ MIT
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /*
5
+ * Quick check from the command line:
6
+ * npx brother-printer-probe 10.0.4.150 [community]
7
+ * Prints what the plugin would read from the printer.
8
+ */
9
+
10
+ const { query } = require('../lib/snmp');
11
+
12
+ const [target, community = 'public'] = process.argv.slice(2);
13
+ const [host, port] = (target || '').split(':');
14
+ if (!host) {
15
+ console.error('Usage: brother-printer-probe <printer-ip-or-hostname[:port]> [community]');
16
+ process.exit(2);
17
+ }
18
+
19
+ query({ host, port: Number(port) || 161, community })
20
+ .then((d) => {
21
+ console.log(JSON.stringify(d, null, 2));
22
+ })
23
+ .catch((err) => {
24
+ console.error(`Couldn't read ${host}: ${err.message}`);
25
+ console.error('Check the address, and that SNMP is enabled on the printer (Network > Protocol).');
26
+ process.exit(1);
27
+ });
@@ -0,0 +1,164 @@
1
+ {
2
+ "pluginAlias": "BrotherPrinter",
3
+ "pluginType": "platform",
4
+ "singular": true,
5
+ "headerDisplay": "Shows Brother laser and inkjet printers in HomeKit: printing state, problems, and toner or ink levels. SNMP must be on in the printer's web page (Network > Protocol).",
6
+ "schema": {
7
+ "type": "object",
8
+ "properties": {
9
+ "name": {
10
+ "title": "Platform name",
11
+ "type": "string",
12
+ "default": "Brother Printer"
13
+ },
14
+ "printers": {
15
+ "title": "Printers",
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "title": "Name",
22
+ "type": "string",
23
+ "default": "Printer"
24
+ },
25
+ "host": {
26
+ "title": "IP address or hostname",
27
+ "type": "string",
28
+ "placeholder": "10.0.4.150",
29
+ "description": "Required. Printers without an address are ignored."
30
+ },
31
+ "community": {
32
+ "title": "SNMP community",
33
+ "type": "string",
34
+ "default": "public"
35
+ },
36
+ "port": {
37
+ "title": "SNMP port",
38
+ "type": "integer",
39
+ "default": 161,
40
+ "minimum": 1,
41
+ "maximum": 65535
42
+ },
43
+ "snmpVersion": {
44
+ "title": "SNMP version",
45
+ "type": "string",
46
+ "default": "auto",
47
+ "oneOf": [
48
+ {
49
+ "title": "Automatic (v2c, then v1)",
50
+ "enum": [
51
+ "auto"
52
+ ]
53
+ },
54
+ {
55
+ "title": "v2c",
56
+ "enum": [
57
+ "2c"
58
+ ]
59
+ },
60
+ {
61
+ "title": "v1 (older printers)",
62
+ "enum": [
63
+ "1"
64
+ ]
65
+ }
66
+ ]
67
+ },
68
+ "pollInterval": {
69
+ "title": "Poll every (seconds)",
70
+ "type": "integer",
71
+ "default": 60,
72
+ "minimum": 10,
73
+ "maximum": 3600
74
+ },
75
+ "lowTonerThreshold": {
76
+ "title": "Toner / ink low at (%)",
77
+ "type": "integer",
78
+ "default": 10,
79
+ "minimum": 0,
80
+ "maximum": 100,
81
+ "description": "On color printers, the battery shows the lowest color and turns low when any color reaches this."
82
+ },
83
+ "showDrum": {
84
+ "title": "Show drum life as a second battery",
85
+ "type": "boolean",
86
+ "default": false,
87
+ "description": "Apple's Home app shows only one battery per accessory, and may pick the drum over the toner. Leave off unless you use Eve or another app that shows both."
88
+ },
89
+ "lowDrumThreshold": {
90
+ "title": "Drum and parts low at (%)",
91
+ "type": "integer",
92
+ "default": 10,
93
+ "minimum": 0,
94
+ "maximum": 100,
95
+ "description": "Logs a warning when the drum, belt, fuser, laser unit, paper feed kit or ink waste box reaches this."
96
+ },
97
+ "tonerTile": {
98
+ "title": "Show toner / ink % on tiles",
99
+ "description": "Adds a humidity sensor whose value is the level: one for a mono printer, one per color for a color printer. They also count in Home's climate summary.",
100
+ "type": "boolean",
101
+ "default": false
102
+ },
103
+ "faultSensor": {
104
+ "title": "Problem sensor",
105
+ "description": "Adds a contact sensor that opens on a jam, open cover, empty tray or other error, so Home can show and notify it.",
106
+ "type": "boolean",
107
+ "default": true
108
+ },
109
+ "offlineAfter": {
110
+ "title": "Mark offline after (failed polls)",
111
+ "type": "integer",
112
+ "default": 3,
113
+ "minimum": 1,
114
+ "maximum": 20
115
+ },
116
+ "debug": {
117
+ "title": "Log every poll",
118
+ "type": "boolean",
119
+ "default": false
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "layout": [
127
+ "name",
128
+ {
129
+ "key": "printers",
130
+ "type": "array",
131
+ "orderable": false,
132
+ "buttonText": "Add printer",
133
+ "items": [
134
+ "printers[].name",
135
+ "printers[].host",
136
+ {
137
+ "type": "fieldset",
138
+ "title": "Sensors",
139
+ "expandable": true,
140
+ "items": [
141
+ "printers[].lowTonerThreshold",
142
+ "printers[].showDrum",
143
+ "printers[].lowDrumThreshold",
144
+ "printers[].tonerTile",
145
+ "printers[].faultSensor"
146
+ ]
147
+ },
148
+ {
149
+ "type": "fieldset",
150
+ "title": "Advanced",
151
+ "expandable": true,
152
+ "items": [
153
+ "printers[].community",
154
+ "printers[].port",
155
+ "printers[].snmpVersion",
156
+ "printers[].pollInterval",
157
+ "printers[].offlineAfter",
158
+ "printers[].debug"
159
+ ]
160
+ }
161
+ ]
162
+ }
163
+ ]
164
+ }
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ const { PLATFORM_NAME, PLUGIN_NAME } = require('./lib/settings');
4
+ const { BrotherPrinterPlatform } = require('./lib/platform');
5
+
6
+ module.exports = (api) => {
7
+ api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, BrotherPrinterPlatform);
8
+ };