I have a 3D Printer and build an enclosure for it. I also have sensor from the Printer and Enclosure in HASS. No i want to control my Fans I added to the enclosure from HASS. So I can hold the temp inside the enclosure on a set level.
Does anyone now about a fan control that has an API I can add to HASS to get and set Fan speed? Or if there is nothing like that has an idea how to build one? I have an Raspi with Octoprint running near the Printer so maybe that can be used?
My immediate thought is an ESP32 with a temperature sensor controlling a few relays to turn the fans on and off between a range of high/low temperatures. To be fair, an ESP8266 could do this as well, and the Wemos D1 Mini is extremely affordable.
I have a fan in my enclosure and used to use ESP32 running ESPHOME connected to MOSFET board to control a 12V PC fan.
Now I use the Sinilink XY-WFMS ESP8266 Board with MOSFET as it combines the ESP and the MOSFET
See here. If you have more than one fan, it’ll be better to use the ESP32 and multiple MOSFET boards:
The ESP32 can run on a USB supply and the fans can run on whatever they are running on now, you just connect the power supply and the fan to the MOSFET board
The image at the top of the thread shows the connections
Then heres my solution: I dont remember which pin, but connect a GPIO of your pi to the speed setting pin of the fan and use pwm on the raspi to control it. To control the raspi a python script via mqtt would do the trick to let HA control the fans. SOmething like this could fullfill your needs: https://gist.github.com/SqyD/a927ab612df767a0cc892bcde23d025c maybe a bit modifiyng of the code is needed, but with this route you can save the esp.
@Holdestmade hey, so I got all part from AliExpress and build them together. So far it is working, I can switch the fan on and off from Home Assistant. But there is no difference in speed as far as I can see so I think the PWM does only switch on and of but not change the speed. Do you have any idea what I need to check?