Switch on 3D printer when slicer is opened
Tags: 3dprinting, smarthome, homeassistant, automation
Published: 2024-04-17 14:09:20

![](https://blog.disane.dev/content/images/2024/04/switch_on-3d-printer-when-slicer-is-opened-2_banner.jpeg)Today I'll show you how to automatically switch on your 3D printer when you start your slicer software on your computer ✨

---

> 💡 For this article, I am using an already set up Home Assistant with an MQTT broker in the background. If you are not yet using Home Assistant, this would be a good time to do so. Alternatively, you can also use any other SmartHome software.

Since I got my 3D printer, I've been using it almost every day. To save electricity, I switch it on and off automatically via a smart socket as soon as the print is finished. I have already described exactly how to do this in another article:

[Monitoring non-smart devices 💡![Preview image](https://blog.disane.dev/content/images/2023/12/nicht_smarte-gerate-uberwachen_banner-1.jpeg)How you can make normal devices smart in a relatively simple way, in the article ☝️](https://blog.disane.dev/non-smart-device-monitoring/)

Only this time we're not just monitoring the 3D printer (yes, I do that too), but we're explicitly switching it on or, in this case, off.

## Integrate your own computer into Home Assistant

In order for Home Assistant to know that we have started an application on the computer, we need to install a tool that connects to Home Assistant and also sends telemetry data to Home Assistant. The tool is called "HASS.Agent":

[GitHub - LAB02-Research/HASS.Agent: Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more.![Preview image](https://repository-images.githubusercontent.com/420055307/d090b8e8-ebae-4129-97f3-5d7c79398531)Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more. - GitHub - LAB02-Research/HASS.Agent: Windows-based client for Home Assistant. Provides n...](https://github.com/LAB02-Research/HASS.Agent)

⚠️

At the time of writing, the "HASS.Agent" is only available for Windows. For more information, take a look here 👇  
  
[https://github.com/LAB02-Research/HASS.Agent](https://github.com/LAB02-Research/HASS.Agent?tab=readme-ov-file#what-its-not)

The nice thing about the tool is that it connects to your Home Assistant and exchanges data with it. This allows you to carry out automations when certain things happen on your computer, receive push notifications and much more.  
  
For this to work, you need an MQTT broker that must be configured in the tool. I'll just assume that at this point.  
  
In the tool, you can create sensors on/from your computer, which are then sent to Home Assistant:

![](https://blog.disane.dev/content/images/2024/01/image.png)

Now we add new "Local sensors". It is important here that you add the type "ProcessActive" and set the appropriate process name for your slicer:

![](https://blog.disane.dev/content/images/2024/01/image-1.png)

![](https://blog.disane.dev/content/images/2024/01/image-2.png)

### The automation 💡

The values set above now automatically end up in Home Assistant in the integration MQTT with the name of your computer:

![](https://blog.disane.dev/content/images/2024/04/image-7.png)

With the matching entity `sensor.desktop_marco_desktop_marco_prusaactive` you can then create your automation:

```yaml
alias: 🖨️ 3D printer on if Prusa-An
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.desktop_marco_desktop_marco_prusaactive
    from: "0"
    to: "1"
condition: []
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.smart_plug_2210126702180251200148e1e9aac535_outlet
mode: single
```

**Important:**  
Please customize the entity for your smart outlet (the part at `switch.smart_plug_2210126702180251200148e1e9aac535_outlet` according to your outlet entity).

That's it! 🔥

![](https://media0.giphy.com/media/t3sZxY5zS5B0z5zMIz/giphy.gif?cid=5a38a5a2if78wncml2q76e13b2hrxkf1dr1ie1hy28mus3g8&ep=v1_gifs_search&rid=giphy.gif&ct=g)

### Conclusion

As you can see, it is quite easy to transfer data from your computer to Home Assistant and then use it to perform the corresponding automation. But you are not limited to the process name. You can use it to do various things and "mine" data.

You can also use the tool to remotely control your computer, switch it off, open pages or even execute Powershell scripts. What more could you want? 🤭

---

If you like my posts, it would be nice if you follow my [Blog](https://blog.disane.dev) for more tech stuff.