H-bridge Fan
hbridge fan 平台允许你使用兼容的 h-bridge(L298N、DRV8871、MX1508、BTS7960、L9110S、DRV8833、TB6612 等)来控制风扇(或电机/电磁阀)。

# 示例配置条目fan: - platform: hbridge id: my_fan name: "Living Room Fan" pin_a: motor_forward_pin pin_b: motor_reverse_pin # enable_pin: motor_enable decay_mode: slow # 慢速衰减模式(滑行)或快速衰减(制动)。-
pin_a (必填, ID):连接到 h-bridge 的 Pin A(或 IN1 等)的 float output 的 id。
-
pin_b (必填, ID):连接到 h-bridge 的 Pin B(或 IN2 等)的 float output 的 id。
-
enable_pin (可选, ID):连接到 h-bridge 使能引脚的 float output 的 id(如果 h-bridge 使用使能)。
-
decay_mode (可选, string):你希望与 h-bridge 一起使用的衰减模式。可选值为
slow(滑行)或fast(制动)。默认为slow。 -
speed_count (可选, int):设置支持的离散速度级别数量。该值用于 计算每个速度的百分比。例如,
2表示你有 50% 和 100%,而100将允许输出以 1% 为增量变化。默认为100。 -
preset_modes (可选):此风扇的预设模式列表。预设模式可用于自动化(例如
on_preset_set)。 -
包含 Fan 组件 的所有其他选项。
fan.hbridge.brake 操作
Section titled “fan.hbridge.brake 操作”将所有 h-bridge 引脚设为高电平,短接风扇/电机的绕组,迫使电机主动停止。
on_...: then: - fan.hbridge.brake: my_fan