This project provides a bridge between Anycubic Kobra S1 3D printers and Home Assistant using MQTT. It allows for monitoring and controlling the printer through Home Assistant, enabling features such as printer status updates, light control, print pause/resume/cancel, and video streaming.
-
Clone the repository:
git clone https://github.com/metheos/anycubic-s1-mqtt-bridge.git cd anycubic-s1-mqtt-bridge
-
Create a
.env
file based on the.env.example
file and fill in the required environment variables. -
Install the required Python packages:
pip install -r requirements.txt
To run the application, execute the following command:
python asm.py
Make sure your printer is connected and configured properly.
The application uses environment variables for configuration. You can set the following variables in your .env
file:
ANYCUBIC_S1_IP
: Your S1 IPHA_BROKER
: Your.HomeAssistant.MQTT.AddressHA_PORT
: 1883HA_USER
: Your Home Assistant MQTT username.HA_PASS
: Your Home Assistant MQTT password.SNAPSHOT_INTERVAL_IDLE
: Interval for taking snapshots when printer is idle.SNAPSHOT_INTERVAL_BUSY
: Interval for taking snapshots when printer is busy.INFO_UPDATE_INTERVAL
: Interval for updating printer information.
To run the application using Docker, you can use the provided Dockerfile
and docker-compose.yml
.
-
Build the Docker image:
docker-compose build
-
Start the application:
docker-compose up
This will start the application in a Docker container, allowing for easy deployment and management.
The repository includes an example Home Assistant view configuration that you can use to monitor your Anycubic S1 printer:
To use this view:
- Copy the content from the home_assistant_view_example.yaml file
- Paste it into the view yaml editor and click Save
This view uses elements from https://github.com/piitaya/lovelace-mushroom for the AMS spool visualization and badges.
The camera is manually configured in configuration.yaml as below
camera:
- platform: ffmpeg
name: "Anycubic S1 Printer Camera"
input: "http://<Anycubic S1 IP>:18088/flv"
extra_arguments: "-analyzeduration 1000000 -probesize 1000000 -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt"
You may need to adjust entity IDs to match the ones created by your specific printer.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.