Skip to content

GhostTypes/ff-5mp-hass

Repository files navigation

FlashForge 3D Printer Integration for Home Assistant

A modern Home Assistant custom integration for FlashForge 3D printers using the HTTP API for reliable, real-time monitoring and control.

Features

Category Feature Details
Monitoring 18 Sensors Real-time temperature monitoring, print progress, filament tracking, lifetime statistics
4 Binary Sensors Printing status, connectivity, error detection, pause state
Live Camera Feed MJPEG stream from printer camera (model-dependent)
Control Switches LED control
Select Entities Filtration mode control (Off/Internal/External)
Buttons Pause, resume, cancel print jobs, and clear status directly from Home Assistant
Architecture HTTP-First Design Superior reliability compared to TCP-only implementations
Async/Await Fully asynchronous for optimal Home Assistant integration
Auto-Discovery UDP-based network discovery with manual fallback
Configurable Polling Adjust update frequency from 5-300 seconds

Supported Hardware

Printer Model Support Status
FlashForge Adventurer 5M Series Fully Supported
FlashForge Adventurer 4 Fully Supported
Other Not Supported (Not planned)

Model-specific features (LED, filtration, camera) are automatically detected and enabled when available.

Requirements

Requirement Details
Home Assistant 2025.1.0 or newer
Python Library flashforge-python-api 1.0.2+
Network Local LAN connectivity to printer
Printer Setup LAN mode enabled with check code

Installation

Method Steps
Via HACS (Recommended) 1. Open HACS in Home Assistant
2. Click on Integrations
3. Click the menu (top right) → Custom repositories
4. Add repository:
   • URL: https://github.com/GhostTypes/ff-5mp-hass
   • Category: Integration
5. Click Add
6. Search for "FlashForge" in HACS
7. Click Download
8. Restart Home Assistant
Manual Installation 1. Download the latest release
2. Extract the custom_components/flashforge folder
3. Copy to your Home Assistant config/custom_components/ directory
4. Restart Home Assistant

Configuration

Step Instructions
Prerequisites: Enable LAN Mode Before adding the integration, you must enable LAN mode on your FlashForge printer:

1. On the printer touchscreen, go to SettingsNetworkLAN Mode
2. Enable LAN mode
3. Note the Check Code (8-digit code) - you'll need this for setup

Video Tutorial
Option 1: Automatic Discovery (Recommended) 1. Go to SettingsDevices & ServicesIntegrations
2. Click + Add Integration
3. Search for "FlashForge"
4. Select your printer from the discovered list
5. Enter your printer's Check Code
6. Click Submit
Option 2: Manual Configuration 1. Go to SettingsDevices & ServicesIntegrations
2. Click + Add Integration
3. Search for "FlashForge"
4. Select "Configure Manually"
5. Enter:
   • IP Address: Your printer's IP (e.g., 192.168.1.100)
   • Printer Name: Friendly name (optional)
   • Serial Number: From printer settings
   • Check Code: From LAN mode settings
6. Click Submit
Configuration Options After setup, you can adjust settings:

1. Go to SettingsDevices & ServicesFlashForge
2. Click on your printer → Configure
3. Scan Interval: Update frequency in seconds (5-300, default: 10)
LED Switch Override If your printer's LED switch is not detected but you know it is supported, enable Always show LED switch in the options. This will force the LED switch to appear regardless of printer capability checks.

Available Entities

Sensors

Entity Description Unit
sensor.flashforge_machine_status Current printer state (idle, printing, paused, error) -
sensor.flashforge_nozzle_temperature Current extruder temperature °C
sensor.flashforge_nozzle_target_temperature Target extruder temperature °C
sensor.flashforge_bed_temperature Current bed temperature °C
sensor.flashforge_bed_target_temperature Target bed temperature °C
sensor.flashforge_print_progress Print completion percentage %
sensor.flashforge_current_file Currently printing file name -
sensor.flashforge_current_layer Current layer number -
sensor.flashforge_total_layers Total layer count -
sensor.flashforge_elapsed_time Time spent printing seconds
sensor.flashforge_remaining_time Estimated time remaining seconds
sensor.flashforge_filament_length Estimated filament length needed meters
sensor.flashforge_filament_weight Estimated filament weight grams
sensor.flashforge_print_speed Speed adjustment percentage %
sensor.flashforge_z_offset Z-axis compensation mm
sensor.flashforge_nozzle_size Installed nozzle size -
sensor.flashforge_filament_type Current filament type -
sensor.flashforge_lifetime_filament Total filament used over printer lifetime meters
sensor.flashforge_lifetime_runtime Total runtime over printer lifetime -

Binary Sensors

Entity Description Device Class
binary_sensor.flashforge_printing On when actively printing running
binary_sensor.flashforge_online On when printer is connected connectivity
binary_sensor.flashforge_error On when error detected problem
binary_sensor.flashforge_paused On when print is paused -

Switches

Entity Description Availability
switch.flashforge_led Control printer LED lights All Models

Select Entities

Entity Description Options Availability
select.flashforge_filtration_mode Control filtration system Off, Internal, External Model-dependent

Buttons

Entity Description
button.flashforge_pause_print Pause active print job
button.flashforge_resume_print Resume paused print job
button.flashforge_cancel_print Cancel and abort print job
button.flashforge_clear_status Clear printer status/errors

Camera

Entity Description
camera.flashforge_camera Live MJPEG stream from printer camera

Usage Examples

Automation: Notify When Print Completes

automation:
  - alias: "3D Print Complete Notification"
    trigger:
      - platform: state
        entity_id: binary_sensor.flashforge_printing
        from: "on"
        to: "off"
    action:
      - service: notify.mobile_app
        data:
          title: "Print Complete"
          message: "{{ states('sensor.flashforge_current_file') }} finished printing!"

Automation: Alert on Print Error

automation:
  - alias: "3D Printer Error Alert"
    trigger:
      - platform: state
        entity_id: binary_sensor.flashforge_error
        to: "on"
    action:
      - service: notify.mobile_app
        data:
          title: "Printer Error"
          message: "FlashForge printer has encountered an error!"
          data:
            priority: high

Automation: Turn Off LED When Print Finishes

automation:
  - alias: "Turn Off Printer LED After Print"
    trigger:
      - platform: state
        entity_id: binary_sensor.flashforge_printing
        from: "on"
        to: "off"
    action:
      - service: switch.turn_off
        target:
          entity_id: switch.flashforge_led

Lovelace Card Example

type: entities
title: FlashForge Printer
entities:
  - entity: sensor.flashforge_machine_status
  - entity: binary_sensor.flashforge_printing
  - entity: sensor.flashforge_print_progress
  - entity: sensor.flashforge_nozzle_temperature
  - entity: sensor.flashforge_bed_temperature
  - entity: sensor.flashforge_remaining_time
  - type: divider
  - entity: button.flashforge_pause_print
  - entity: button.flashforge_resume_print
  - entity: button.flashforge_cancel_print
  - entity: button.flashforge_clear_status
  - type: divider
  - entity: switch.flashforge_led
  - entity: switch.flashforge_camera
  - entity: select.flashforge_filtration_mode

Camera Card

type: picture-glance
camera_image: camera.flashforge_camera
entities:
  - binary_sensor.flashforge_printing
  - sensor.flashforge_print_progress

Troubleshooting

Issue Problem Solutions
Discovery Not Finding Printer Automatic discovery doesn't detect your printer • Ensure printer is on the same network/subnet as Home Assistant
• Check firewall settings (UDP port 18007 must be open)
• Verify LAN mode is enabled on the printer
• Try manual configuration with IP address
Connection Failed During Setup Setup fails with connection error • Verify printer has LAN mode enabled
• Check the check code is correct (codes can expire)
• Ensure printer is powered on and connected to network
• Test API access manually: http://<PRINTER_IP>:8898/info
• Verify serial number matches printer label
Entities Show "Unavailable" Integration installed but entities are unavailable • Check printer is online and reachable
• Verify credentials are still valid
• Reload the integration: Settings → Integrations → FlashForge → ⋮ → Reload
• Check Home Assistant logs for connection errors
Python API Not Installing Integration fails due to missing flashforge-python-api • Verify Home Assistant has internet access
• Check PyPI is reachable: https://pypi.org/project/flashforge-python-api/
• Try manual install: pip install flashforge-python-api in HA environment
• Restart Home Assistant after installation
Static IP Recommended - For best reliability, assign a static IP address to your printer in your router's DHCP settings. This prevents connection issues if the printer's IP changes.

Related Projects

Project Description Link
Python API Library Core HTTP API client for FlashForge printers ff-5mp-api-py
TypeScript API Library TypeScript/JavaScript API client ff-5mp-api-ts
FlashForgeUI Cross-platform monitoring & control application FlashForgeUI-Electron

License

This project is licensed under the MIT License - see the LICENSE file for details.

If you find this integration useful, please star the repository!