ESPHome Component: https://esphome.io/components/output/ac_dimmer.html
The ac_dimmer
component allows you to connect a dimmable light or other load that supports phase control dimming to your ESPHome project.
# Example configuration entry
output:
- platform: ac_dimmer
id: dimmer1
gate_pin: 7
zero_cross_pin:
number: 6
mode:
input: true
inverted: yes
light:
- platform: monochromatic
output: dimmer1
name: Dimmerized Light
Configuration variables:
- gate_pin (Required, Pin): The pin used to control the Triac or Mosfet.
- zero_cross_pin (Required, Pin): The pin used to sense the AC Zero cross event, you can have several dimmers controlled with the same zero cross detector, in such cases duplicate the
zero_cross_pin
config on each output. - method (Optional): Set the method for dimming, which can be:
leading pulse
: (default) a short pulse to trigger a TRIAC;leading
: gate pin driven high until the zero-cross is detected;trailing
: gate pin is driven high from zero-cross until dimming period, this method is suitable for mosfet dimmers only.
- init_with_half_cycle (Optional, boolean): Will send the first full half AC cycle Try to use this for dimmable LED lights, it might help to turn on at low brightness levels. On gas (halogen) lamps it might show at initial flicker. Defaults to
false
. - id (Optional, ID): Manually specify the ID used for code generation.
- All other options from
Output
.
Connection table:
MCU | INPUT Pin Zero Cross | OUTPUT Pin |
---|---|---|
ESP8266 | D1(GPIO5), D5(GPIO14), D7(GPIO13), D2(GPIO4), D6(GPIO12), D8(GPIO15) | D0(GPIO16), D2(GPIO4), D6(GPIO12), D8(GPIO15), D1(GPIO5), D5(GPIO14), D7(GPIO13) |
ESP32 | GPIO: 36, 39, 32, 25, 27, 12, 7, 2, 4, 17, 18, 21, 22, 34, 35, 33, 26, 14, 13, 15, 0, 16, 5, 19, 1, 23 | GPIO: 32, 25, 27, 12, 15, 0, 16, 5, 19, 3, 22, 33, 26, 14, 13, 2, 4, 17, 18, 21, 1, 23 |
Dimming lights with phase control can be tricky, the minimum level your light turns on might be different from other lights, also the perceived light level might not correlate to the percentage output set to the light, to try to minimize these behaviors you can tweak the values min_power
from this output component and also gamma_correct
from the monochromatic light.
Links to examples: https://github.com/esphome/feature-requests/issues/278, https://community.home-assistant.io/t/mqtt-ac-dimmer-esphome-without-home-assistant/418931/9