Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when cover image is all black #67

Closed
deviantintegral opened this issue Dec 14, 2023 · 1 comment · Fixed by #70
Closed

Errors when cover image is all black #67

deviantintegral opened this issue Dec 14, 2023 · 1 comment · Fixed by #70
Labels
bug Something isn't working

Comments

@deviantintegral
Copy link

Describe the bug

While the first light is properly skipped, at least when using the method 400 errors are still thrown.

To Reproduce

Steps to reproduce the behavior:

  1. Make sure to have at least two lights configured.
  2. Listen to any track from https://en.wikipedia.org/wiki/This_Is_Spinal_Tap_(soundtrack). I suggest Christmas with the Devil 🤘 🎅 .
  3. See the 400 errors like so:

2023-12-13 19:38:21.233807 INFO media_lights_sync: Skipped black color for 'light.pedestal_1' light
2023-12-13 19:38:21.235094 INFO media_lights_sync: Set 'light.pedestal_2' light:
{'transition': 30, 'rgb_color': [], 'brightness': 255}
2023-12-13 19:38:21.239805 INFO media_lights_sync: Set 'light.pedestal_3' light:
{'transition': 30, 'rgb_color': [], 'brightness': 255}
2023-12-13 19:38:21.245798 INFO media_lights_sync: Set 'light.pedestal_4' light:
{'transition': 30, 'rgb_color': [], 'brightness': 255}
2023-12-13 19:38:21.257059 WARNING HASS: Error calling Home Assistant service default/homeassistant/turn_on
2023-12-13 19:38:21.295120 WARNING HASS: Code: 400, error: 400: Bad Request
2023-12-13 19:38:21.296774 WARNING HASS: Error calling Home Assistant service default/homeassistant/turn_on
2023-12-13 19:38:21.297256 WARNING HASS: Code: 400, error: 400: Bad Request
2023-12-13 19:38:21.297883 WARNING HASS: Error calling Home Assistant service default/homeassistant/turn_on
2023-12-13 19:38:21.298322 WARNING HASS: Code: 400, error: 400: Bad Request

I fixed this by changing the black check to:

                if color == [0, 0, 0] or len(color) == 0:

However, I'm not sure if this is actually best fixed elsewhere, as I'm using quantization_method: libimagequant and perhaps other methods always return values.

@deviantintegral deviantintegral added the bug Something isn't working label Dec 14, 2023
@deviantintegral deviantintegral changed the title Errors when listening to all-black covers Errors when cover image is all black Dec 14, 2023
@ericmatte
Copy link
Owner

Hi, I was not able to reproduce with the specified song and quantization_method: libimagequant.

However, your fix seems like an easy enough and safe patch, so I will add it just to be more safe.

Btw, nice song :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants