Smart Plugs¶
Control your printers with Tasmota or Home Assistant smart plugs, or monitor energy with MQTT devices for power monitoring, automation, and energy tracking.

Overview¶
Smart plug integration enables:
- Power control - Turn printers on/off remotely
- Energy monitoring - Track power consumption
- Auto power-on - Start printer before scheduled prints
- Auto power-off - Shut down after cooldown
- Automation - Hands-free print scheduling
Requirements¶
Bambuddy supports two types of smart plug integrations:
Option 1: Tasmota¶
Direct control of Tasmota-flashed smart plugs:
| Feature | Required? |
|---|---|
| Tasmota firmware | Yes |
| Power monitoring | Recommended |
| HTTP API access | Yes |
Popular Options:
- Sonoff S31 - Compact, power monitoring
- Gosund SP111 - Affordable, power monitoring
- Athom Plugs - Pre-flashed with Tasmota
- Shelly Plug S - High quality, Tasmota compatible
Pre-flashed Plugs
Buy plugs pre-flashed with Tasmota to avoid the flashing process. Athom and some others sell them ready to use.
Option 2: Home Assistant¶
Control any switch/light entity through Home Assistant:
| Feature | Required? |
|---|---|
| Home Assistant instance | Yes |
| Long-Lived Access Token | Yes |
| Network access to HA | Yes |
Supports:
- Zigbee - Plugs via ZHA or Zigbee2MQTT
- Z-Wave - Plugs via Z-Wave JS
- Matter - Matter-compatible devices
- WiFi - Any WiFi plug integrated with HA
- ESPHome - Custom ESP-based devices
Flexible Integration
Home Assistant integration lets you use any device HA supports, including cloud-connected plugs that don't have local APIs.
HA Scripts for Multi-Device Control¶
Want to control multiple devices together (e.g., printer + enclosure fan)? Use Home Assistant scripts:
- Create a script in HA that turns on/off multiple devices
- Add the script entity (e.g.,
script.turn_on_printer_setup) as a smart plug in Bambuddy - Link it to a printer
- Configure automation triggers (optional)
- When triggered, the script executes your automation
Script Automation Options:
| Option | Description |
|---|---|
| Run when printer turns on | Automatically execute script when the main power plug is switched on |
| Run when printer turns off | Automatically execute script when the main power plug is switched off |
| Show on Printer Card | Display a quick-run button on the printer card |
Scripts appear in a dedicated row on printer cards with "Run" buttons for quick access.
Use Case: Enclosure Fan
Create two HA scripts: one to turn on printer + fan, another to turn off both. Link them to your printer with "Run when printer turns on/off" enabled. Now when you control the main plug, both devices respond automatically.
Script Behavior
Scripts can only be triggered ("Run"), not toggled on/off like regular plugs. They execute once when triggered and complete immediately.
Option 3: MQTT (Monitor-Only)¶
Subscribe to MQTT topics for energy monitoring from any MQTT-enabled device:
| Feature | Required? |
|---|---|
| MQTT broker | Yes |
| Device publishing JSON data | Yes |
| Control capability | No (monitor-only) |
Supports:
- Zigbee2MQTT - Any Zigbee energy monitor
- Shelly - Via native MQTT or Zigbee2MQTT
- Tasmota Discovery - Subscribe to Tasmota sensor topics
- ESPHome - ESP devices publishing to MQTT
- Any MQTT source - Any device publishing JSON with power data
Monitor-Only
MQTT plugs are monitor-only for energy tracking. They cannot be turned on/off through Bambuddy. Use your MQTT broker, Home Assistant, or other automation to control them.
Adding a Smart Plug¶
Adding a Tasmota Plug¶
Automatic Discovery¶
The easiest way to add Tasmota plugs is with automatic discovery:
- Go to Settings > Smart Plugs
- Click Add Smart Plug
- Select the Tasmota tab
- Click Discover Tasmota Devices
- Wait for the network scan to complete
- Click on a discovered device to select it
- Fill in remaining details and Save
Network Auto-Detection
Bambuddy automatically detects your local network and scans all 254 addresses. Works with password-protected devices too!
Manual Entry¶
If discovery doesn't find your plug:
- Go to Settings > Smart Plugs
- Click Add Smart Plug
- Select the Tasmota tab
- Enter configuration:
| Field | Description |
|---|---|
| Name | Friendly name |
| IP Address | Plug's network IP |
| Printer | Associated printer |
- Click Save
- Click Test to verify connection
Adding a Home Assistant Plug¶
Initial Setup (One-Time)¶
Before adding HA plugs, configure the connection:
- Go to Settings > Network
- Find the Home Assistant section
- Enter your Home Assistant URL (e.g.,
http://192.168.1.100:8123) - Enter your Long-Lived Access Token
- Click Test Connection to verify
- Enable Enable Home Assistant toggle
Creating an Access Token
In Home Assistant: Profile > Long-Lived Access Tokens > Create Token. Copy the token immediately - it won't be shown again!
Automatic Configuration (Home Assistant Add-on)¶
When running Bambuddy as a Home Assistant add-on, the integration is automatically configured using environment variables provided by the Home Assistant supervisor:
How it works:
- The add-on sets
HA_URLandHA_TOKENenvironment variables automatically - Bambuddy detects these and configures the integration on startup
- The connection is established to
http://supervisor/coreusing the supervisor-provided token - No manual configuration needed!
In the UI:
When environment variables are active, you'll see:
- Lock icons on the URL and Token fields (read-only)
- "(Environment Managed)" labels
- "Automatically enabled via environment variables" badge on the toggle
- The integration is automatically enabled
Zero Configuration
The Home Assistant add-on automatically configures the integration - no need to create access tokens or enter URLs manually!
Manual Override Disabled
When environment variables are active, you cannot edit the URL or token through the UI. To use different values, configure them in the add-on settings or use the standard installation method.
Adding the Plug¶
- Go to Settings > Smart Plugs
- Click Add Smart Plug
- Select the Home Assistant tab
- Select an entity from the dropdown (shows all switch/light/input_boolean entities)
- Enter a friendly name
- Select the associated printer
- (Optional) Configure energy sensor entities (see below)
- Click Save
Entity Selection
The dropdown shows the entity's friendly name and current state. Already-configured entities are filtered out.
Adding an MQTT Plug¶
MQTT plugs subscribe to topics and extract power/energy data from JSON payloads. Each data type (power, energy, state) can use a different MQTT topic with its own settings.
Prerequisites¶
Configure your MQTT broker in Settings > Network (same broker used for MQTT Publishing).
Adding the Plug¶
- Go to Settings > Smart Plugs
- Click Add Smart Plug
- Select the MQTT tab
- Configure each data source:
Power Monitoring:
| Field | Description | Example |
|---|---|---|
| Topic | MQTT topic for power data | zigbee2mqtt/shelly/power |
| JSON Path | Path to power value in JSON | power_l1 or data.power |
| Multiplier | Unit conversion | 1.0 or 0.001 for mW→W |
Energy Monitoring (Optional):
| Field | Description | Example |
|---|---|---|
| Topic | MQTT topic for energy data | zigbee2mqtt/shelly/energy |
| JSON Path | Path to energy value in JSON | energy_l1 |
| Multiplier | Unit conversion | 1.0 or 0.001 for Wh→kWh |
State Monitoring (Optional):
| Field | Description | Example |
|---|---|---|
| Topic | MQTT topic for state data | zigbee2mqtt/shelly/state |
| JSON Path | Path to on/off state in JSON | state_l1 |
| ON Value | What value means "ON" | ON, true, 1 (auto-detected if empty) |
- Click Save
Separate Topics
Each data type can subscribe to a different MQTT topic. This is useful when your device publishes power, energy, and state to separate topics.
Same Topic Example
If your device publishes everything to one topic:
- Power Topic:
zigbee2mqtt/shelly-working-room - Power Path:
power_l1 - Energy Topic:
zigbee2mqtt/shelly-working-room - Energy Path:
energy_l1
Separate Topics Example
If your device publishes to different topics:
- Power Topic:
sensors/power/shelly - Power Path:
value - Energy Topic:
sensors/energy/shelly - Energy Path:
total_kwh
JSON Path Examples
For JSON {"power_l1": 150, "energy_l1": 2.5}:
- Power path:
power_l1 - Energy path:
energy_l1
For nested JSON {"data": {"power": 150}}:
- Power path:
data.power
Finding Your Topic
Use an MQTT client like MQTT Explorer to browse your broker and find the topic your device publishes to.
Custom ON Value
Some devices report state as true/false instead of ON/OFF. Set the ON Value to match your device (e.g., true, 1, on). Leave empty for auto-detection of common values.
Energy Sensor Configuration¶
Many Home Assistant smart plugs expose energy data as separate sensor entities rather than as attributes on the switch entity. Common examples include:
- Tapo P110M -
sensor.tapo_power,sensor.tapo_today_energy,sensor.tapo_total_energy - IKEA plugs via Zigbee2mqtt -
sensor.ikea_plug_power,sensor.ikea_plug_energy - Shelly plugs -
sensor.shelly_power,sensor.shelly_energy
To enable energy tracking for these plugs:
- After selecting the switch entity, expand Energy Monitoring (Optional)
- Select the appropriate sensor for each field:
- Power Sensor (W) - Current power consumption
- Energy Today (kWh) - Today's energy usage
- Total Energy (kWh) - Lifetime energy usage (used for per-print tracking)
Sensor Selection
The dropdowns show all HA sensors with power/energy units (W, kW, kWh, Wh). You can select sensors from any device - they don't need to match the switch entity.
Per-Print Energy Tracking
The Total Energy sensor is required for per-print energy tracking. Bambuddy records the total at print start and end to calculate energy used.
Switchbar Quick Access¶
Add frequently-used plugs to the sidebar for quick access:

- In Settings > Smart Plugs, expand a plug's settings
- Enable Show in Switchbar
- A plug icon appears in the sidebar footer
- Hover to see status and control all switchbar plugs
The switchbar shows:
- Current power state (ON/OFF)
- Power consumption (if available)
- Quick on/off toggle buttons
Multiple Plugs
Add multiple plugs to the switchbar for one-click access to your entire printer farm.
Admin Link (Tasmota Only)¶
Each Tasmota smart plug card includes a direct link to the Tasmota web interface:
- Click the Admin link on the plug card
- Opens Tasmota interface in a new tab
- Auto-login if username/password configured in Bambuddy
Quick Configuration
Use the admin link for quick access to Tasmota settings like power reporting, schedules, and firmware updates.
Home Assistant Plugs
HA plugs don't have an admin link. Manage them through your Home Assistant dashboard.
Finding Plug IP Address (Tasmota Only)¶
From Tasmota Interface¶
- Access your plug's web interface
- Go to Information
- Note the IP Address
From Router¶
- Log into your router
- Find connected devices
- Locate the plug by name or MAC
Static IP (Recommended)¶
Assign a static IP to prevent changes:
- Go to plug web interface
- Configuration > Configure WiFi
- Enter static IP settings
Create a DHCP reservation for the plug's MAC address.
Power Control¶
Manual Control¶
Toggle power from Bambuddy:
- Go to printer card
- Click the power icon
- Select On or Off
Or from Settings > Smart Plugs:
- Click the power toggle for any plug
Power Status¶
| Icon | Status |
|---|---|
| On | |
| Off | |
| Unreachable |
Automation¶
Auto Power On¶
Automatically turn on printer before prints:
- Enable Auto Power On for the plug
- When a queued print is ready:
- Bambuddy turns on the plug
- Waits for printer to boot
- Starts the print
Auto Power Off¶
Automatically turn off after prints:
- Enable Auto Power Off for the plug
- Set Cooldown Temperature (e.g., 40°C)
- Set Cooldown Time (e.g., 5 minutes)
- After print completes:
- Wait for bed to cool below threshold
- Wait additional cooldown time
- Turn off the plug
Safety Checks¶
Auto power-off includes safety checks:
- Only triggers after successful prints
- Waits for cooldown
- Checks for queued prints
- Verifies printer is idle
Energy Monitoring¶
Track power consumption:
Real-time Data¶
| Metric | Description |
|---|---|
| Power (W) | Current draw |
| Voltage (V) | Line voltage |
| Current (A) | Amperage |
| Energy (kWh) | Cumulative |
Per-Print Tracking¶
Enable energy tracking to record:
- Energy per print
- Electricity costs
- Efficiency comparisons
Power Dashboard¶
View power statistics:
- Current power draw
- Energy over time
- Cost calculations
- Peak usage
Tasmota Commands (Technical Reference)¶
Bambuddy uses these Tasmota HTTP commands for direct Tasmota integration:
| Action | Command |
|---|---|
| Turn On | http://{ip}/cm?cmnd=Power%20On |
| Turn Off | http://{ip}/cm?cmnd=Power%20Off |
| Status | http://{ip}/cm?cmnd=Status%200 |
| Energy | http://{ip}/cm?cmnd=Status%208 |
Testing Manually¶
# Turn on
curl "http://192.168.1.100/cm?cmnd=Power%20On"
# Get status
curl "http://192.168.1.100/cm?cmnd=Status%200"
Safety Considerations¶
Don't Cut Power Mid-Print¶
Auto power-off is safe because:
- Only triggers after print completion
- Waits for cooldown
- Checks printer state
Never manually power off during printing!
Surge Protection¶
Consider adding surge protection:
- Protects printer electronics
- Protects smart plug
- Especially important for unstable power
Fire Safety¶
Smart plugs have current limits:
- Most handle 10-15A
- 3D printers typically draw 3-8A
- Check your plug's rating
Troubleshooting¶
Tasmota: Plug Not Responding¶
- Check plug is powered
- Verify IP address is correct
- Ensure plug is on same network
- Check if Tasmota web interface loads
- Verify no firewall blocking
Home Assistant: Plug Shows Offline¶
- Check HA connection in Settings > Network
- Click Test Connection to verify
- Ensure the access token hasn't expired
- Verify HA is reachable from Bambuddy's network
- Check if entity exists in HA
Home Assistant: Entities Not Loading¶
- Verify HA URL is correct (include port if needed)
- Check access token has correct permissions
- Try regenerating the access token
- Ensure HA integration is enabled
Auto Power-Off Not Working¶
- Check feature is enabled
- Verify cooldown settings
- Ensure print completed successfully
- Check for queued prints (won't power off if more queued)
Power Data Incorrect¶
- Not all plugs have power monitoring
- For Tasmota: Calibrate in Configuration > Configure Other
- For HA: Check if entity has power attributes or configure separate energy sensors
- Check plug specifications
Home Assistant: No Energy Data¶
Many HA plugs expose energy data as separate sensor entities, not as switch attributes:
- When adding/editing the plug, expand Energy Monitoring (Optional)
- Select the appropriate power sensor (W)
- Select energy today and total sensors (kWh) if available
- The sensors should appear in the dropdown if they have power/energy units
Tips¶
Start Simple
Start with manual power control before enabling automation.
Test Cooldown
Monitor a few prints to find the right cooldown temperature for your printer.
Label Plugs
If you have multiple plugs, label them physically to match Bambuddy names.
Dedicated Circuit
If possible, put printers on a dedicated circuit to avoid tripping breakers.
Energy Baseline
Track energy for a week to establish your typical consumption baseline.