Skip to content

Panda PWR

Brings the BIQU Panda PWR smart power controller into your printer's web interface.

The Panda PWR sits between the wall socket and your printer. It switches the printer's mains power, measures what the printer draws, and has a USB port it can switch on and off.

What this version does

Version 0.1.0, the first release, shows your Panda PWR's live readings, keeps their history and charts it, and makes its USB ports switches in Fluidd and Mainsail. Its page, reachable from the Bespok3d app and at /panda-pwr/ on your printer, shows the voltage, current, power and energy used, and whether the printer's power and the USB ports are on. It refreshes every few seconds. A reading that has stopped arriving is marked as not current (on a V2, which sends a reading only when something changes, as soon as it is lost or after 2 minutes of quiet; on a V1 after 30 seconds), and a Panda PWR that cannot be reached is said to be unreachable, with the reason.

Your Panda PWR What you get
V2 Live readings; USB-A and USB-C as switches
V1 on BIQU's own firmware Live readings; its USB port as a switch
V1 on the community firmware (DragonPWR) Live readings, read through its own API; USB-A switching with an optional DragonPWR control token

The plugin finds out which one you have by itself. The energy figure of a V1 is shown in kWh, which is still to be confirmed on a real V1. DragonPWR can leave out a value it did not measure (it counts no energy yet, and its power metering can be switched off): the page then says "not measured" and why, the history and its charts leave a gap, and /panda-pwr/metrics leaves the value out. None of them ever shows a missing value as 0.

/panda-pwr/status gives the same as JSON, and /panda-pwr/health says whether the service runs.

Setting it up

  1. Find the Panda PWR's IP address, in your router or on the Panda PWR's own page.
  2. Reserve that address for it in your router, so it does not change.
  3. Enter it as Panda PWR address in this plugin's settings in the Bespok3d app.

Use the IP address, not a name ending in .local: many printers, the Snapmaker U1 among them, cannot look those up.

The USB switches

In Fluidd and Mainsail's power section the Panda PWR's USB ports show as panda_pwr_usb_a and panda_pwr_usb_c. They cannot be switched while a print runs. A switch counts only once the Panda PWR reports the new state; if it does not, the switch shows an error. On a V1, panda_pwr_usb_a is its only USB port and panda_pwr_usb_c always shows an error: the V1 has no second port. A macro can switch them through Moonraker, for example {action_call_remote_method("set_device_power", device="panda_pwr_usb_a", state="on")}.

DragonPWR control token

With no control token set on your DragonPWR, anyone on your network who can reach it can switch its USB port. Setting a control token on the DragonPWR and entering the same token in DragonPWR control token in the plugin's Config tab restricts USB control to clients that provide the token. The setting starts as web, which means no token: keep it that way if the DragonPWR has no token set. Do not leave it empty on a printer whose Bespok3d daemon is older than 0.15.0: the app then cannot save the plugin's settings. If you do not have a DragonPWR, leave it at web. If the device refuses a token, the plugin reports an error instead of trying without it. Choose 1 to 64 characters from letters, digits and .,-:/_@ to fit both platforms. DragonPWR permits other printable non-space ASCII characters, but Bespok3d does not accept all of them. The plugin never creates or changes a device token.

The token is stored unencrypted in the printer's plugin user_vars.json, readable by root, and is returned unmasked by the platform's config API and shown in its Config tab. The plugin does not expose it through its own routes, metrics or logs. The device protocol uses plain HTTP on the LAN. Use a trusted network, reserve the device address, and update the token setting when changing controllers. If you replace DragonPWR with stock firmware at the same address, the plugin recognizes the replacement automatically when it can identify it. A missing or refused native response alone does not authorize stock switching.

Only USB-A is supported on DragonPWR V1. DragonPWR firmware on V2 hardware and DragonPWR's experimental switching controls are not supported. Moonraker's existing print lock still applies to its power-device path.

The history

The readings are kept on the printer, one row a minute (the lowest, average and highest voltage, current and power, the energy counter, and the switches), for 7 days unless you set Days of history to something else; 0 keeps none. They are written every five minutes rather than on every reading, to spare the printer's storage, so a power cut can lose the last few minutes.

  • http://<printer>/panda-pwr/history answers JSON. By default the last 24 hours, a row a minute; from and to take Unix seconds or ISO times, last a number of seconds up to now, step seconds. Each row says how much energy was used in it; a reset of the Panda PWR's own energy counter is not counted as negative use. Grafana reads it through its Infinity plugin.
  • Average power and current in the history (each row's power_watts.avg and current_amps.avg, and average_power_watts for the whole period) are worked out from the Panda PWR's own energy counter: the energy it counted, divided by the time. Averaging the readings themselves reads low when the load pulses, as a heated bed does (29% low on a test print). The current has no counter of its own, so it is that power times the readings' amps per watt. The counter moves in small steps, so a step shorter than 15 minutes takes its average over the 15 minutes around it. The lowest and highest are still the readings. averages_from says which was used: on a V1, whose energy unit is not confirmed yet, it is still the readings. A small hint on the power and current charts says the same.
  • http://<printer>/panda-pwr/metrics gives the live reading in Prometheus' format, for the many Grafana setups that scrape Prometheus. A reading that is not current is left out, so graphs show a gap rather than an old value. The energy counter is there only once its unit is confirmed as kWh, which is not yet the case on a V1.

On the plugin's page the history is drawn as charts for the last hour, 6 hours, 24 hours or 7 days: power, voltage and current (the average, with a band from the lowest to the highest), and the energy used in each step, with the energy used, the average and the highest power above them and a table view below. Hover a chart, or focus it and use the arrow keys, to read a value.

The history stays on the printer if you uninstall the plugin.

What is coming

  1. Switching the printer off at the wall after a print has finished and cooled down, if you turn it on.

Your printer's power is never cut while it runs

The Panda PWR feeds the printer's own computer. Cutting its power while it runs can damage what the printer is writing to its storage. So this plugin never offers an "off" button for the printer's power, in Fluidd, in a macro or on its own page. The only way it will ever switch the printer off is the after-print option above: the printer shuts down cleanly first, and the Panda PWR cuts the power afterwards. If anything about that is in doubt, the printer stays on.

Good to know

  • Out of the box the Panda PWR's own web interface has no password: anything on your network can switch it. BIQU's stock V1 firmware has no way to add one; DragonPWR supports a control token for USB switching, and the V2 has a "High Security" switch in its Settings. Keep it on a network you trust.
  • With High Security off, a V2 sends your Wi-Fi password to anything on your network that connects to it. This plugin keeps only the readings and the firmware version from that message and drops the rest at once: it is never logged, stored or shown. With High Security on, the V2 sends nothing without a login, which closes that leak, but this version of the plugin cannot read it then: its page says High Security is on. To read it anyway, turn on "Log in with High Security on" (an experiment, since 0.0.19) and enter the Panda PWR's password on the plugin's page: the plugin tries it once and keeps only a key made from it on the printer, never the password.
  • This is an experiment release: expect it to change.

Requirements

A Klipper printer enrolled in Bespok3d. Developed on a Snapmaker U1 with a Panda PWR V2; the Panda PWR V1 is meant to work too.

Uninstalling

Uninstall from the Bespok3d app. The page and the service are removed; your printer's power is not touched.