Yeelight - errors on change of color with script

I have recently added another Yeelight RGB bulb to my set up and have started to get this error in the HA log when I run a script to change the color of 2 bulbs in a group.

[homeassistant.components.light.yeelight] Error when calling <function YeelightLight.set_default at 0x6e1735d0>: {'message': 'general error', 'code': -5000}

This error has only started to occur since I have added the new bulb, and performing a color change using a script on 2 bulbs (1 older and the 1 new) in a group. The color changes without issue, but throws this error each time.


Can you post the script that errors?

Hi @Bob_NL , here is one of the 3, they are all configured the same except for the color difference.

  alias: 'Evening Lights'
    - service: light.turn_on
        - light.steps
        - light.table
        brightness: 60
        rgb_color: [225,167,255]
        transition: 3


I still receive this same error in the logs each time a group of Yeelights has the color changed. It has never gone away. Currently on 64.0

Error when calling <function YeelightLight.set_default at 0x6dbb9150>: {'code': -5000, 'message': 'general error'}

Did you try without the transition? Transition doesn’t allways work as intented with my Yeelights.
Does the transition indeed take 3 seconds?

@Bob_NL I haven’t tried without transition, but yes, the transition does work as it should and fades in over 3 secs.

The issue only occurs with a scene of multiple Yeelights, and not on single lights.

@kanga_who I have the same issue, did you get it fixed? I read somewhere that someone with the same issue was also unable to set a default ‘scene’ within the Yeelight app… got an error in chinese :smiley: . This might be a clue.

@MattP, no solution as yet that I am aware of.

The scenes and lights activate without any issues, it’s just a log issue that bothers me. IF we can remove that error from producing in the logs, that would be good enough for me at the moment.

Have you tried just using a scene to do this?

Yes, that is what I am currently using. The same error is produced.

@kanga_who - what I ended up doing tonight was copying the Python script from and copying it into my HASS directory /config/custom_components/light/ When this is in that location it is used in preference to the built-in copy.

From there I made these adjustments (without knowing python at all - so I am not suggesting this is best practice :slight_smile: and someone may well offer to improve it ) - I changed lines 115-116 from this:

except yeelight.BulbException as ex:
    _LOGGER.error("Error while calling %s: %s", func, ex) 

to this:

except yeelight.BulbException as ex:
    exstr = str(ex)
    if "general error" in exstr:
        _LOGGER.debug("Error while calling %s: %s", func, ex)
        _LOGGER.error("Error while calling %s: %s", func, ex)

What this does is checks the exception text, and if it is the pointless ‘general error’ we keep seeing, it downgrades it from an ‘error’ to a ‘debug’ entry. So it won’t be in your logs unless (I assume) you specify you want debug logging for your light components.

Hope that helps. My lights are dimming/brightening and I get no more errors.