ESPHome Brightness H801

I’ve been struggling with the same 100% or 0% issue and a power cycle did nothing to help.

It seems to me that this is mostly a documentation issue since the pwm output is determined by relative values of RGB rather than the traditional measures of duty cycle of pwm. By changing the call.set_brightness(), you can achieve the accurate pwm output you’re looking for.

I have even broken out setting the colors individually.
ESPhome doesn’t respect the 50% settings. I tried with int after looking at the codebase under set_red() but that errored out so it has a conversion behind the scenes.

It is difficult to make much sense of the flow of the src code but I’ll list it at the bottom. It is the same as specified in the lambda function.

Lambda Code:

      - lambda:
          name: redflicker
          update_interval: 10s
          lambda: |-
            static int state = 0;
            auto call = id(h801_2_rgb).turn_on();
            // Transtion of 1000ms = 1s
            call.set_transition_length(1000);
            if (state == 0) {
              call.set_red(0.5);
              call.set_green(0.5);
              call.set_blue(0.5);
            } else if (state == 1) {
              call.set_red(1.0);
              call.set_blue(0.5);
              call.set_green(0.0);
            } else if (state == 2) {
              call.set_red(0.5);
              call.set_blue(0.0);
              call.set_green(0.0);
            } 
            call.perform();
            state += 1;
            if (state == 3)
              state = 0;

and log

[11:18:59][D][light:261]: 'H801_2_Light' Setting:
[11:18:59][D][light:283]:   Red=100%, Green=0%, Blue=50%
[11:18:59][D][light:300]:   Transition Length: 1.0s
[11:19:09][D][light:261]: 'H801_2_Light' Setting:
[11:19:09][D][light:283]:   Red=100%, Green=0%, Blue=0%
[11:19:09][D][light:300]:   Transition Length: 1.0s
[11:19:15][D][sensor:092]: 'h801_2_uptime_s': Sending state 35.77300 s with 0 decimals of accuracy
[11:19:19][D][light:261]: 'H801_2_Light' Setting:
[11:19:19][D][light:283]:   Red=100%, Green=100%, Blue=100%
[11:19:19][D][light:300]:   Transition Length: 1.0s
[11:19:29][D][light:261]: 'H801_2_Light' Setting:
[11:19:29][D][light:283]:   Red=100%, Green=0%, Blue=50%
[11:19:29][D][light:300]:   Transition Length: 1.0s

src

  automation_2->add_actions({light_lightcontrolaction_2});
  light_lambdalighteffect_3 = new light::LambdaLightEffect("redflicker", [=]() -> void {
      static int state = 0;
      auto call = h801_2_rgb->turn_on();
      // Transtion of 1000ms = 1s
      call.set_transition_length(1000);
      if (state == 0) {
        call.set_red(0.5);
        call.set_green(0.5);
        call.set_blue(0.5);
      } else if (state == 1) {
        call.set_red(1.0);
        call.set_blue(0.5);
        call.set_green(0.0);
      } else if (state == 2) {
        call.set_red(0.5);
        call.set_blue(0.0);
        call.set_green(0.0);
      } 
      call.perform();
      state += 1;
      if (state == 3)
        state = 0;
  }, 10000);

I had same problem with Quinled original and Esphome. After a power cycle it’s working properly.

Anyone knows ESPhome can be configured to use the Channels as Individual Light Channels for dimming single colour LEDs

Looks like it H801/H802 RGBW LED controller | devices.esphome.io

The H801 is pretty affordable and easy to hack and adapt to your needs. It can be found on AliExpress Here is an article about the hardware for those who have an interest for more details about the board. It can be used as a RGB, RGBW, RGB dual white or even control 5 individual monochromatic strips if you want or combinations of these.

Does anyone have a yaml file for ESPHome to control 5 white strips as individual lights? The ‘cookbook’ above mentions it but doesn’t actually cover how.

Very delayed, but I just setup an H801 with ESPHome yesterday, and used white lights - they only connections on the strip are a + and -. Here is the code I used for my single strip, but you should be able to duplicate it for the additional strips:

light:
  - platform: monochromatic
    name: "Aux Pantry Lights"
    output: output_component
    id: aux_pantry_light

output:
  - platform: esp8266_pwm
    id: output_component
    pin: 15

I used @Enoo’s code above to turn the closet light on and off automatically with a door contact sensor. I soldered the door sensor to the WW pin, and cut the lead on the bottom of the board.

I meant to update this topic, but didn’t. For anyone else want to use the H801 to control 5 white (single colour) strips independently, you’ll need these in the ESPHome YAML:

output:
  - platform: esp8266_pwm
    pin: 12
    frequency: 1000 Hz
    id: pwm_w1
  - platform: esp8266_pwm
    pin: 13
    frequency: 1000 Hz
    id: pwm_w2
  - platform: esp8266_pwm
    pin: 15
    frequency: 1000 Hz
    id: pwm_w3
  - platform: esp8266_pwm
    pin: 14
    frequency: 1000 Hz
    id: pwm_w4
  - platform: esp8266_pwm
    pin: 4
    frequency: 1000 Hz
    id: pwm_w5   

Then you can define the 5 ‘lights’ for HA:

light:
  - platform: monochromatic
    name: "Strip1"
    id: "strip1"
    output: pwm_w1
  - platform: monochromatic
    name: "Strip2"
    id: "strip2"
    output: pwm_w2
  - platform: monochromatic
    name: "Strip3"
    id: "strip3"
    output: pwm_w3
  - platform: monochromatic
    name: "Strip4"
    id: "strip4"
    output: pwm_w4
  - platform: monochromatic
    name: "Strip5"
    id: "strip5"
    output: pwm_w5
2 Likes

I am about to do this and my guess was what you have posted, so thanks for saving me from endless experimentation and mis-typing.

Thanks, worked perfectly.

1 Like