Help making Color Extractor work with WebOS entity picture

Hello!

I’ve been trying to use the color extractor integration to change some led strips based on the entity picture displayed by my WebOS TV but it doesn’t seem to work.

When my TV is playing something, like Amazon Prime, the entity picture gets this value:

entity_picture: >-
  /api/media_player_proxy/media_player.lg_sala?token=bc52d396cab24e415de7313f9ab63269121c17a4cb6aa7586ef1ae418bde652e&cache=5fc8a308406e5a53

So I tried calling color_extractor.turn_on service like this:

color_extract_path: {{ states.media_player.lg_sala.attributes.entity_picture}}
entity_id: light.yeelight_color_0x0000000005e768aa

But I get this error:

Invalid data for call_service at pos 1: not a file for dictionary value @ data['color_extract_path']

It seems the extractor can’t find an image file in the path, yet HA can. Is there something else I should add to the path? There’s no URL for the picture, just a path.

I also tested with a Chromecast, which has a path and a URL:

entity_picture_local: /api/media_player_proxy/media_player.tv_quarto?token=4b92ccd7c520a4232ed628d8efcda05cfaa11553e00b5020ff225e99ad8b80c5&cache=c0e849320f2f2b91
entity_picture: https://i.scdn.co/image/ab67616d00001e02b41607c1edf9f0cbee08d02e

When I use the URL call, it works normally: :white_check_mark:

color_extract_url: '{{ states.media_player.tv_quarto.attributes.entity_picture}}'
entity_id: light.yeelight_color_0x0000000005e768aa

But when I try the path option it doesn’t: :x:

color_extract_path: '{{ states.media_player.tv_quarto.attributes.entity_picture_local}}'
entity_id: light.yeelight_color_0x0000000005e768aa

Here’s hoping someone has got it working and can help me figure out how to! Thanks in advance.

After a lot of trial and error, instead of using color_extract_path I converted the path to an URL and it worked: :white_check_mark:

color_extract_url: >-
  http://192.168.68.168:8123{{
  states.media_player.lg_sala.attributes.entity_picture}}
entity_id: light.yeelight_color_0x0000000005e768aa

I also had to add the internal URL to the allow_list:

homeassistant:
  allowlist_external_urls:
    - http://192.168.68.168:8123/

So there’s the solution, maybe there is a more elegant method to change a path to an URL and automatically grab the internal URL but it’s outside of my knowledge.

3 Likes

Hello Carlos,

To me it doesn’t work. When i set up the local ip address both in the automation and in the allowlist i get an error in the log mentioning that the server disconnected.

I could make it work with the duckdns link (external) but for some reason it results in an unstable network (slow network, devices disconnecting etc)

Do you use also duckDNS for external access?

Thanks
Kind Regards