syssi / esphome-yeelight-ceiling-light

ESPHome custom firmware for some Yeelight Ceiling Lights
Apache License 2.0
150 stars 22 forks source link

Meteorite - low brightness and white tones issues #15

Closed chris-nite closed 2 months ago

chris-nite commented 3 years ago

Hi @syssi , thanks again for your fast help in getting the meteorite up and running with esphome. Finally a functioning and responsive light! :-) When using the light today i found out, that when the main light is used with a low brightness and then changing the white tones somewhere to the middle, the shown white tone is very warm or cold (depending if you move the slider a bit to the right or left). Changing tones are happening very aprubtly by the light while on low brightness, while for a very short time, the right (mixed) color is flashing for about half a sec. There seems to be something off, because if you improve the brightness by quite a bit (let's say half), changing white tones go very smoothly and are correctly mixed (through the ww and cw leds). Attached you'll find my yaml-file. Anyone got the same issues on lower brightness levels?

substitutions:
  name: yeelight_light_ceiling10

esphome:
  name: ${name}
  platform: ESP32
  board: esp32doit-devkit-v1
  platformio_options:
    platform: espressif32@3.0.0
    platform_packages: tasmota/framework-arduinoespressif32 @ 3.10006.210420

wifi:
  ssid: xxxx
  password: xxxx
  fast_connect: true

ota:
api:
logger:

output:
  - platform: ledc
    pin: GPIO19
    id: output_warm
    power_supply: power
#    min_power: 0.13
    max_power: 0.82
  - platform: ledc
    pin: GPIO21
    id: output_cold
    power_supply: power
#    min_power: 0.13
    max_power: 0.82

  - platform: ledc
    pin: GPIO23
    id: output_nightlight
    power_supply: power

  - platform: ledc
    pin: GPIO33
    id: output_red
    power_supply: power
  - platform: ledc
    pin: GPIO26
    id: output_green
    power_supply: power
  - platform: ledc
    pin: GPIO27
    id: output_blue
    power_supply: power

power_supply:
  - id: power
    pin: GPIO22
    enable_time: 0s
    keep_on_time: 0s

light:
  - platform: monochromatic
    name: "${name} night light"
    id: night_light
    output: output_nightlight
    gamma_correct: 0
    on_turn_on:
      - light.turn_off: ceiling_light
  - platform: cwww
    name: "${name} ceiling light"
    id: ceiling_light
    cold_white: output_cold
    warm_white: output_warm
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
    constant_brightness: true
    gamma_correct: 0
    on_turn_on:
      - light.turn_off: night_light
  - platform: rgb
    name: "${name} ambient light"
    red: output_red
    green: output_green
    blue: output_blue
    gamma_correct: 0
    effects:
      # Use default parameters:
      - random:
      # Customize parameters
      - random:
          name: "Slow Random Effect"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "Fast Random Effect"
          transition_length: 4s
          update_interval: 5s
      - pulse:
          name: "Fast Puse"
          transition_length: 0.5s
          update_interval: 0.5s
      - pulse:
          name: "Slow Puse"
          # transition_length: 1s      # defaults to 1s
          update_interval: 2s
      - strobe:
          name: "Green Strobe"
          colors:
            - state: True
              brightness: 100%
              red: 0%
              green: 100%
              blue: 0%
              duration: 500ms
            - state: False
              duration: 250ms
      - strobe:
          name: "Red Strobe"
          colors:
            - state: True
              brightness: 100%
              red: 100%
              green: 0%
              blue: 0%
              duration: 500ms
            - state: False
              duration: 250ms
      - strobe:
          name: "Blue Strobe"
          colors:
            - state: True
              brightness: 100%
              red: 0%
              green: 0%
              blue: 100%
              duration: 500ms
            - state: False
              duration: 250ms
      - strobe:
          name: "Police Strobe"
          colors:
            - state: True
              brightness: 100%
              red: 0%
              green: 0%
              blue: 100%
              duration: 500ms
            - state: True
              brightness: 100%
              red: 100%
              green: 0%
              blue: 0%
              duration: 500ms
      - flicker:
syssi commented 3 years ago

Please remove all gamma_correct: 0 lines, reflash and try again. ;-)

chris-nite commented 3 years ago

I tried that out and now the light only turns on, when i pull the brightness lever to about 40%. Interestingly the white tones still occur that flashing behavior when pulling it to about 50%. It seems the light tries to mix the warm and cold diodes, suceeds for about half a sec and then falls back to colder or warmer tones. Might the frequency setting change a thing?

syssi commented 3 years ago

I've disabled (value: 0) the gamma correction in the past because of this behavior / issue: https://github.com/esphome/esphome-core/issues/190

I will try to reproduce the issue at my device to get a better understanding. I must admit I don't use the color temperature slider.

Could you try to play around with the frequency setting? I think it could improve the situation (especially if driving the light with more brightness is working fine).

syssi commented 3 years ago

Take a look at this issue for some additional informations:

https://github.com/syssi/esphome-yeelight-ceiling-light/issues/8

I think the usability of every supported device / esp32 driven yeelight can optimized easily by playing around with gamma_correct, min_power, max_power and the frequency setting. May be some custom code is required to fix/improve the lower brightness limit (brightness=1).

chris-nite commented 3 years ago

I'm sorry, that i didn't give you a response yet. I really appreciate your support and will try out your suggestions on the coming weekend. Can i freely test out these settings like frequency/power etc. on the device itself without the risk of destroying it?

syssi commented 3 years ago

Did you find better settings to improve the configuration?

rafasanz commented 2 years ago

With the actual yaml if light is under 13-15% can happen few situations:

I have uncomment line 29 & 35 and now it's looking that everything is working fine.

But now, when i turn off, for example from 100% to 0% (off) starts to shutting down, but on some level (close to 13%) makes something strange. It's like flickering little bit time and after that goes off. In example => 100%----------50%-----------30%-------15%----20%----0% an example what ceiling does (not changing temperature color of light)

Thanks and nice work!!

ultrazauberer commented 1 year ago

I just want to say I have the same issue with the stock firmware. Changing the color of the white Mainlight on low brightness causes color flickering. Feels like the old light bulbs in the office.

So the ESPhome firmware could fix this problem according to the last post?

Also on of my yeelight arwen 550 forgets all the settings and the link to my Xiaomi account. But I barely use this lamp. Could ESPhome here also improve the behavior?

syssi commented 1 year ago

Also on of my yeelight arwen 550 forgets all the settings and the link to my Xiaomi account. But I barely use this lamp. Could ESPhome here also improve the behavior?

There is an EEPROM on the daughter board to store some key material and may be account numbers. This EEPROM isn't used if you flash the ESPHome based firmware so the chance is high to improve the usability/stability of your device.

ultrazauberer commented 1 year ago

Also on of my yeelight arwen 550 forgets all the settings and the link to my Xiaomi account. But I barely use this lamp. Could ESPhome here also improve the behavior?

There is an EEPROM on the daughter board to store some key material and may be account numbers. This EEPROM isn't used if you flash the ESPHome based firmware so the chance is high to improve the usability/stability of your device.

Thanks for you fast respond. I will definitely try it. Something is coming to my mind: If I use ESPhome on the yeelight, could I connect a DHT22 and read humidity and temperature (one big disadvantage: I guess only when the lamp is on)?

syssi commented 1 year ago

If I use ESPhome on the yeelight, could I connect a DHT22 and read humidity and temperature (one big disadvantage: I guess only when the lamp is on)?

Yes, the number of possibilities is huge here. :-) In best case the device is powered always.

PsychoRS commented 1 year ago

Hi, I think I've found the solution to 100% replicate the stock firmware behaviour.

First of all, I've recalculated min_power and max_power using the voltage info here. So, with my i-dont-know-if-correct-but-it-works calculations, max_power for the warm output must be 0.77 (if 0 is 0 and 1 is 3.3v, so 2.55v must be 0.77), and 0.76 for the cold output.

So:

output:
  - platform: ledc
    pin: GPIO19
    id: output_warm
    power_supply: power
    min_power: 0.13
    max_power: 0.77
    frequency: 1220Hz
  - platform: ledc
    pin: GPIO21
    id: output_cold
    power_supply: power
    frequency: 1220Hz
    min_power: 0.13
    max_power: 0.76

With this settings, my brightness slider is working perfect (no more turning off at 12-13%, no more "no more brightness from 9x% up". Then I found that, with that settings, if you turn off the light when at low brightness, it flicks strangely, as @rafasanz said.

The solution? For me was just using the zero_means_zero parameter.

So:

output:
  - platform: ledc
    pin: GPIO19
    id: output_warm
    power_supply: power
    min_power: 0.13
    max_power: 0.77
    frequency: 1220Hz
    zero_means_zero: true
  - platform: ledc
    pin: GPIO21
    id: output_cold
    power_supply: power
    frequency: 1220Hz
    zero_means_zero: true
    min_power: 0.13
    max_power: 0.76

With this configuration, my Meteorite is finally working as with the standard firmware. No more flickering, no more turning off around 13-15% brightness, no more max brightness at around 90%.

Please, try it and feel free @syssi to use this yaml for the repo.

PS: I don't know if frequency: 1220Hz has anything to do with this, must test it later.

syssi commented 1 year ago

Awesome! I will give it a try!

syssi commented 2 months ago

The frequency doesn't make a difference. I've added the improved limits to the example configuration.

helgek commented 1 month ago

@PsychoRS Thank you so much, my meteorite now also produces really perfect results!!