Smart Home Automation Forum
PWM support? - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A16 (https://www.kincony.com/forum/forumdisplay.php?fid=25)
+--- Thread: PWM support? (/showthread.php?tid=6749)

Pages: 1 2


RE: PWM support? - luis15pt - 09-25-2024

(09-22-2024, 11:36 PM)admin Wrote: KCS not support PWM output. you can try to use by ESPHome.

Update to this thread got it working in ESPHome with the following config:

Code:
# PWM output for fan control
output:
  - platform: ledc
    pin: GPIO14
    id: fan_output
    frequency: 25000Hz
    min_power: 0.0
    max_power: 1.0

fan:
  - platform: speed
    output: fan_output
    name: "PWM Fan"
    id: pwm_fan
    speed_count: 100

sensor:
  - platform: pulse_counter
    pin:
      number: GPIO32
      mode:
        input: true
        pullup: true
    name: "Fan RPM"
    id: fan_rpm
    unit_of_measurement: "RPM"
    filters:
      - multiply: 0.5
      - lambda: return round(x);  # Round to nearest whole number
    accuracy_decimals: 0  # Display no decimal places
    update_interval: 3s
    count_mode:
      rising_edge: INCREMENT
      falling_edge: DISABLE

  - platform: template
    name: "Fan Speed Percentage"
    id: fan_speed_percentage
    unit_of_measurement: "%"
    accuracy_decimals: 0
    lambda: |-
      return (id(fan_rpm).state / 6600.0) * 100.0;
    update_interval: 3s



RE: PWM support? - admin - 09-25-2024

good.