Skip to main content

Fan Devices

Control fan speed with three hardware drivers and two control modes (free slider and fixed steps).

Driver typesโ€‹

DriverUse caseRequirements
PWMSmall DC fansOne GPIO
L298NLarger motorsThree GPIOs
RF433MHz remote fansThree trigger GPIOs

Wiringโ€‹

PWMโ€‹

PinESP32Notes
PWM signalGPIO 19Via MOSFET
GNDGNDCommon ground

L298Nโ€‹

PinESP32
ENA (speed)GPIO 19 (PWM)
IN1GPIO 20
IN2GPIO 21

RF 433MHzโ€‹

PinESP32
HighGPIO 19
MediumGPIO 20
LowGPIO 21

Add a fan (dashboard)โ€‹

  1. Open Devices โ†’ Add device
  2. Type: Fan
  3. Driver: PWM / L298N / RF
  4. Set GPIO pins
  5. Save

Speed controlโ€‹

  • Free speed: slider 0โ€“100%
  • Steps: Low / Medium / High
  • Both modes are available on the same device

MQTT topicsโ€‹

Control: smarthome/{esp32_name}/fan/{device_id}/set
State: smarthome/{esp32_name}/fan/{device_id}/state
{"state":"ON","speed":75,"mode":"slider"}
{"state":"ON","speed":2,"mode":"steps"}
{"state":"OFF"}

See alsoโ€‹