Change your rgb lights color according to spotify album background

Happy to help!

There are definitely some packages in that list that aren’t required. When I get the time, I’ll work out which ones to remove and report back here.

1 Like

I am trying this with appdeamon too, but I can’t get it working. My hassio fails to install g++ every time.

I have the same issue since updating from 0.97 to 0.97.1

Ok, there’s an update to AppDaemon that fixes this issue. If you don’t see it available in the Hass.io tab, go to the Addd-on store, press the refresh button, wait a minute or two then go into the AppDaemon add on and it should show the option to update.

However… There’s a new issue, at least for me:

2019-08-10 10:58:10.699066 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/tv_lights_sync.py
2019-08-10 10:58:10.742953 WARNING AppDaemon: ------------------------------------------------------------
2019-08-10 10:58:10.743103 WARNING AppDaemon: Unexpected error loading module: /config/appdaemon/apps/tv_lights_sync.py:
2019-08-10 10:58:10.743460 WARNING AppDaemon: ------------------------------------------------------------
2019-08-10 10:58:10.747003 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
    self.read_app(mod["name"], mod["reload"])
  File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 1809, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/appdaemon/apps/tv_lights_sync.py", line 5, in <module>
    from PIL import Image
  File "/usr/lib/python3.7/site-packages/PIL/Image.py", line 95, in <module>
    from . import _imaging as core
ImportError: Error loading shared library libtiff.so.5: No such file or directory (needed by /usr/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-x86_64-linux-gnu.so)

I think I have it working again, as well as the AppDaemon update mentioned above; a new system package, tiff is required. My Config now looks like the following:

{
  "disable_auto_token": false,
  "system_packages": [
    "libcurl",
    "zlib-dev",
    **"tiff",**
    "libjpeg-turbo-dev",
    "libwebp",
    "tk",
    "openjpeg",
    "python3-dev",
    "curl-dev",
    "gcc",
    "g++"
  ],
  "python_packages": [
    "pip==19.0.3",
    "pycurl",
    "Pillow"
  ]
}

Everything’s restarted OK, but I won’t have a chance to properly test it until later. Hopefully this fixes it.

I Will have a look at this. I was on version 0.95 and updates to 0.97 Because it didn’t work. The appdeamon update makes sense.

I can confirm it works now. Do you know if it is possible to make a switch in home assistant to enable and disable the app from appdeamon.

Glad it’s working again!

I’m afraid I don’t know the answer to that question. Mine is triggered by an automation. I have it set up so that if the sun is below the horizon and I am playing the Spotify app on one of my Shield TV’s it engages. I’m also thinking about adding an input_boolean into the mix for a manual override.

Yes, indeed I have already tried the input boolean. In condition:, the same way as on Github. Only it doesn’t seem to work for me. If the input boolean is off it stil turns on and changes the lights. Any idea Why?

I provided you with some totally erroneous information in my last post, it isn’t automation-driven at all.

This is the condition of my apps.yaml in appdaemon:

tv_lights_sync:
    module: tv_lights_sync
    class: tv_lights_sync
    ha_url: http://hassio/homeassistant
    media_player: "media_player.spotify"
    photo_attribute: "entity_picture"
    condition:
        entity: sensor.living_room_shield_tv_app_name
        state: "Spotify"
    lights:
      - "light.hue_lightstrip"
      - "light.nanoleaf"
      - "light.living_room_lamps"
      - "light.drinks_shelf"
      - "light.kitchen_floor"
      - "light.death_ball"
      - "light.lounge_ceiling_spots"

The sensor in the condition is as follows:

        living_room_shield_tv_app_name:
            value_template: "{{ state_attr('media_player.living_room_shield_tv', 'app_name') }}"
            friendly_name: Living Room Shield TV App Name

So basically when the Living Room Shield TV is playing the Spotify app, those lights specified will change colour. I honestly thought I’d updated this to include the sun’s horizon position… obviously not!

I’ll have a go at this later and report back.

This is mine and it doesn’t seem to work do you know why? if I turn off the input_boolean it still changes the colours

tv_lights_sync:
  module: tv_lights_sync
  class: tv_lights_sync
  ha_url: http://hassio/homeassistant
  media_player: "media_player.small_tv"
  condition: 
  entity: "input_boolean.album_art_sync"
  state: "on"
  lights:
    - "light.hue_color_lamp_1"
    - "light.led_strip_bed"
    - "light.led_strip_bench"
    - "light.desk_light"

All looks OK, except for the indentation of entity and state in `condition. Try fixing that first.

you are right, should have seen that. it works now

It’s often the simplest things, and it usually just takes a second pair of eyes to notice it. Glad it’s all working for you again.

1 Like

@Luukotje Following a recent upgrade, the AppDaemon was refusing to startup for me due to a problem resolving one of the dependencies. I took the opportunity to finally go through them and remove the ones that were no longer required. I can confirm that the following config works and resolves the latest issue:

{
  "disable_auto_token": false,
  "system_packages": [
    "libjpeg",
    "tiff"
  ],
  "python_packages": [
    "pip",
    "Pillow"
  ]
}

nice, thank you for keeping me up to date I will test it very soon.

Has anyone gotten this to work recently? Now all I can get is:

“FATAL: Failed installing package pillow”

For anyone else having trouble I got this working with the following setup:

{
  "disable_auto_token": false,
  "system_packages": [
    "libcurl",
    "zlib-dev",
    "libjpeg-turbo-dev",
    "libwebp",
    "tk",
    "openjpeg",
    "python3-dev",
    "curl-dev",
    "gcc",
    "g++"
  ],
  "python_packages": [
    "pip==19.0.3",
    "pycurl",
    "Pillow"
  ],
  "init_commands": [],
  "log_level": "info"
}

Like some past setups I’m sure there are unnecessary things in there but I mostly just stole the list from here.

Hey, thanks for your work.

I tried to add it on my install, and I have noticed I get the following error :

Any idea?

Thanks!

I’m getting an error when trying to use this… The service is “not found”.

I’ve added the __init__.py in a folder called color_recognizer, and added color_recognizer: to my configuration.yaml… Am I missing something?