/ad-media-lights-sync

💡 AppDaemon App that synchronize RGB lights with the thumbnail of a media player in Home Assistant. Be sure to ⭐️ my repo!

Primary LanguagePythonMIT LicenseMIT

Media Player Lights Sync

hacs_badge

Buy Me A Coffee

AppDaemon App that synchronizes the color of RGB lights with the thumbnail of a media player in Home Assistant.


Example 1 Example 1

Features

  • Realtime RGB lights color synchronization with the thumbnail of a media player
  • Extract most relevant colors from a picture and assign them to lights
  • Always creates great matching moody ambiances
  • Change all configured lights color at the same time using multithreading
  • Prevent lights synchronization based on a state condition from your Home Assistant

Installation

Use HACS or download the media_lights_sync directory from inside the apps directory here to your local apps directory, then add the configuration to enable the media_lights_sync module.

Prerequisites

In order for this app to work, you need to add the following packages to the config of your AppDaemon 4 Supervisor add-on:

system_packages:
  - musl
  - make
  - g++
  - python3-dev
  - build-base
  - jpeg-dev
  - zlib-dev
python_packages:
  - Pillow

If you are running AppDaemon in your own docker container, you must create and build a docker image with the above dependencies using a Dockerfile similar to this (untested):

FROM acockburn/appdaemon:latest
# Manually install the dependencies
RUN apk add musl make g++ python3-dev build-base jpeg-dev zlib-dev
RUN pip3 install Pillow

App configuration

media_lights_sync:
  module: media_lights_sync
  class: MediaLightsSync
  media_player: media_player.tv
  photo_attribute: entity_picture
  ha_url: !secret ha_url
  use_current_brightness: False
  condition:
    entity: input_boolean.sync_tv_lights
    state: "on"
  lights:
    - light.left_theatre_light
    - light.right_theatre_light
key optional type default description
module False string media_lights_sync The module name of the app.
class False string MediaLightsSync The name of the Class.
media_player False string The entity_id of the media player to sync from.
photo_attribute True string entity_picture The state attribute containing the url to the thumbnail. Examples: entity_picture, entity_picture_local.
ha_url True string None The URL to your Home Assistant. Only useful if photo_attribute is a relative URL1. Examples: https://my-ha.duckdns.org, http://192.168.1.123:8123.
use_current_brightness True string False Do not change lights brightness. If False, it will always sets all lights to maximum brightness.
condition True object Sync lights only if the state of the condition entity is valid.
condition.entity False string The entity_id of the condition.
condition.state False string The state to match in order for the lights to sync.
lights False list The list of all the lights entity_id to sync to.

1: See /developer-tools/state in your Home Assistant config for the valid attribute name of the thumbnail url of your media_player.

Compatibility

This app has been tested and is working with the following devices:

  • Media Players:
  • RGB Lights:
    • Philips Hue
    • ESPHome RGB Light using an ESP8266
    • Z-Wave
    • Lifx
    • TP-Link
    • Yeelight (YLDP02YL, YLDD02YL)

If you've found that this app is working with another device, just let me know so I can update this list.

Notes