Philips Android TV Ambilights (Light) component

I have successfully created a custom light component for the Ambilights on Phillips Android TV’s (2016+) using the JointSpace API.

If you have already paired your TV for the custom media_player component, you can skip the pairing process and refer to the same username and password in your configuration.yaml


First Pair your TV, and generate the username and password using this tool and enter the details, along with the IP address of your TV into your configuration.yaml as follows:

  - platform: ambilights
    name: Bedroom Ambilights
    host: 192.168.1.XXX
    username: !secret philips_username
    password: !secret philips_password

Place the in you config/custom_components/light/ directory, and restart Home Assistant


This component has the following features:

  • Power Ambilights ON/OFF
  • Brightness
  • RGB color
  • Effects
    • Manual (custom RGB color for all LED’s)
    • Standard (Follow Video)
    • Natural (Follow Video)
    • Football / Immersive (Follow Video)
    • Vivid (Follow Video)
    • Game (Follow Video)
    • Comfort (Follow Video)
    • Relax (Follow Video)
    • Lumina / Adaptive Brightness (Follow Audio)
    • Colora / Adaptive Color (Follow Audio)
    • Retro (Follow Audio)
    • Spectrum (Follow Audio)
    • Scanner (Follow Audio)
    • Rhythm (Follow Audio)
    • Party / Random (Follow Audio)

Individual effects can be easily removed from the Front-End by removing them from the AMBILIGHT_EFFECT_LIST (line 53 of )

Known Issues

  • The light component can turn the Ambilights on when the TV is off, however, after the TV has been in standby for a long period of time, the component will loose connection, and will be unable to turn the lights on again until the TV is woken up and reconnects - this can be solved by manually turning on the TV and then changing the ambilights, or through the use of an IR blaster connected to Home Assistant to achieve the same result.

Older Philips TV’s

Older (non-Android) Philips TV’s with ambilights, which use the JointSpace API, may be controllable through this component, try changing the BASE_URL on line 20 to http://{0}:1925/1/{1} . Note: as the older API does not use HTTPS, there is no need for the username and password fields to be generated or placed into your configuration.yaml , there may also be changes needed to the _getReq() and _postReq() sections to accomodate this, If anyone is successful with this, let me know and I will update this section.

Thank you for this component. It works really good so far. Maybe you should submit it as an official component?


Brilliant, glad its working for others, seeing as it was my first attempt at a component I wasn’t sure! :smiley: As for making it official, firstly I would have no idea where to start, but more seriously, It probably couldn’t be an official component as-is, mainly due to the extra step needed to get the pairing code at the start - perhaps if I were to combine the code that generates the username and password into the component, with a persistent notification on the front-end when it first runs with the pairing process - but as this requires the input of the user (typing in the pairing code displayed on the TV) I’m still not sure this is possible.

Great component!

I managed to make my ambilights follow the RGB lights I have in the room with the following automation:

- alias: Ambilights Follow Room Lights
  - entity_id: light.room_1
    platform: state
  - condition: state
    entity_id: input_boolean.ambilight_follow_room
    state: 'on'
  - alias: ''
    service: light.turn_on
    entity_id: light.ambilights
      brightness: '{{ states.light.room_1.attributes.brightness }}'
      transition: 2
      xy_color: ['{{states.light.room_1.attributes.xy_color[0]|float}}','{{states.light.room_1.attributes.xy_color[1]|float}}']

I also created an input boolean to activate this feature or disable it.
If you don’t want it, you can just remove the ‘condition statement’ from the automation.

    name: Ambilights Follow Room Lights
    initial: off

Hey there!

Would love to install this component to control my Philips 55PUS7502/12 Ambilight, but I always fail at the first step, to pair my TV and get the username/password:

As far as I understand I have to download the and copy in configcustom_components/media_player

but then? Do I have to restart to get the username/password? Or do I have to run this file manualy, but if so, how do I do that?

Thanks in advance

You need to download from repository and run it on local environment. So you need to instal Python and some other python components required by this script. When you try to run it everything required will be displayed in console. I don’t remember exactly every step :confused:

1 Like

Hey thanks for your reply! Sorry I´m absolutely not into Python or Coding in general, but does it mean I can start the from my Mac for example with this program here ? And what are the other python components?

Yes, you need to instal for example the newest version of python and run command “python --host 192.168.x.x pair” in folder where you downloaded. I’m using windows, so I’m not sure how exactly run it on Mac.
For sure you will be needed to instal some component required by this script, don’t remember what was that. If you don’t known how to instal correct component just google python component name install and instruction should be in the first position.


@Nizm0 has given the command you’ll need, it is the same on Mac OS, you’ll need to download and install python on your Mac from the link you provided if you have yet to do so, then open a terminal window in the folder with the file inside.

cd /path/to/folder

then run the command

python --host 192.168.x.x pair

As you will be installing python afresh, there may be some dependencies you need to install, for example, this was posted on the GitHub issues page for the script:

Requests is not a built in module (does not come with the default python installation), so you will have to install it

$ sudo pip install requests
if you have pip installed

Alternatively you can also use:
$ sudo easy_install -U requests
if you have easy_install installed.

Once you have your username and password, and they are in your home assistant configuration, you are done with the script, from then on all that is needed is the in your /config/custom_components/light/ folder

Awesome! That was pretty much my exact motive for making the component, I wanted it to match my RGB LED strips in the same room, making it a full light component also means you can use light groups to have the ambilights integrated into the rooms lighting controls without an automation (although you do forgo the ease of a toggle switch to disable it)

An interesting automation I have built on top of this is one that uses both this light component, and an updated version of the media_player component (which adds the ability to detect what TV Channel or App is currently on the TV), I have it so that if the source changes at all, the Ambilights will be automatically set to the “Standard” effect (Follow Video), meaning that if I have previously set the lights to a certain colour, but then say, open Netflix with the remote, the ambilights will automatically default back to follow the video on the screen, it works brilliantly!

- alias: Amiblights Auto-Standard
  - entity_id: sensor.tv_source
    platform: state
  - condition: state
    entity_id: media_player.philips_tv
    state: 'on'
  - data:
      effect: Standard
      entity_id: light.bedroom_ambilights
    service: light.turn_on

Thanks for your reply! Did all the steps to install Python and components, and after I typed in the command

python --host 192.168.x.x pair in the folder where the file is, I got this here:

Starting pairing request
Traceback (most recent call last):
  File "", line 123, in <module>
  File "", line 90, in main
  File "", line 41, in pair
    r ="https://" + config['address'] + ":1926/6/pair/request", json=data, verify=False)
  File "/Library/Python/2.7/site-packages/requests-2.19.1-py2.7.egg/requests/", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.19.1-py2.7.egg/requests/", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.19.1-py2.7.egg/requests/", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.19.1-py2.7.egg/requests/", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.19.1-py2.7.egg/requests/", line 513, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=1926): Max retries exceeded with url: /6/pair/request (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x102f939d0>: Failed to establish a new connection: [Errno 60] Operation timed out',))

What does it mean, Can anybody help?

Are you sure that you write correct IP address for your TV? It’s look like your TV is not responding, and the script can’t connect to it to display data required do generate user.


I can get the same errors by putting in the wrong IP, so thats very likely the case, remember you can easily see the TV’s IP from the Android Settings :slight_smile:

1 Like

Hm, don’t know. Maybe you have no access to internet on the TV or your tv is on different sub net and you have no access to it from your PC/Laptop. Verify if your PC IP have the same 3 thirst part of IP address as the one on TV. Maybe you have set on router isolate Wireless devices that they have no access to each other.
Try to ping your tv to verify if you have access to it.

1 Like

Ha! It finally worked!! you were right, I used the wrong IP adress, but now everything works fine, thanks so much for your help and this component! One last question: Is it possible to control also the Ambilight+Hue function with this component or with a command line switch?

1 Like

Unfortunately I have no hue lights to test that functionality with, so cannot add it myself. I would guess it is possible though, if you find the command needed to be sent to the tv, and test that it works, it should be simple to add to the component.


I have a problem with this component. It really changes the color of the LED strip behind the TV. I cannot seem to be able to change the brightness with automation.

I can set brightness from the light manually. With automation it does not work. Here is the code:
# Philips Ambilight leds low on TV off #
- id: ambilight-low-brightness-when-tv-off # <-- Required for editor to work.
alias: Amiblights at low brightness when TV off
- entity_id: media_player.philips_tv
platform: state
- condition: state
entity_id: media_player.philips_tv
state: ‘off’
- service: light.turn_on
entity_id: light.philips_ambilight
brightness: 30
effect: Manual
transition: 2
rgb_color: [‘255’,‘105’,‘180’]

It does change the color to pink, but brightness stays at 255. What’s wrong?


I would like to read the rgb values from the ambilight TV, so that I can send this value to other RGB ligts in the same room. Is that possible?

1 Like

@jan.lanner try this:

- alias: Room Lights follow Ambilight TV
  - entity_id: light.philips_ambilight
    platform: state
  - condition: state
    entity_id: light.room_1
    state: 'on'
  - alias: ''
    service: light.turn_on
    entity_id: light.room_1
      brightness: '{{ light.philips_ambilight.attributes.brightness }}'
      transition: 2
      xy_color: ['{{states.light.philips_ambilight.attributes.xy_color[0]|float}}','{{states.light.philips_ambilight.attributes.xy_color[1]|float}}']


Will try it as soon as my orderd RGBw-light strips arrive. Installed your component today and it works great!