Philips Android TV Ambilights (Light) component

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.

Hi!

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
trigger:
- entity_id: media_player.philips_tv
platform: state
condition:
- condition: state
entity_id: media_player.philips_tv
state: ‘off’
action:
- service: light.turn_on
entity_id: light.philips_ambilight
data:
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?

Hi,

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
  trigger:
  - entity_id: light.philips_ambilight
    platform: state
  condition:
  - condition: state
    entity_id: light.room_1
    state: 'on'
  action:
  - alias: ''
    service: light.turn_on
    entity_id: light.room_1
    data_template:
      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}}']
2 Likes

Thanks!

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

I’ve tried this code but, unfortunately, it doesn’t work for me.

It actually would work if to find a way how to pull current colours from the tv ambilight (the component doesn’t do it currently).

1 Like

@Molodax , Yes. If you are using Manual method for changing colors it can pull the current colors. But if you have follow video or follow audio mode, it can’t. I think that it’s not even supported by API.

Which API do you mean? As for ‘manual’ method, it is possible to put all RGB lights including the TV ambilight in one group and have the same effect of manually changed colours without automation.

The API for changing effect and colors. If you choose Standard or any of the automatic effects, for example “Party” you can’t see the live color (anywhere) of the LED strip.

But you figured it out as I can see from your reply.

Do I understand it correctly, the api can not pull the colors from the TV if you have the TV in a mode where the video output controls the colors? That could explain why my automation did not work.

I made this automation out of your suggestion.

  • id: ‘1541594397491’
    alias: Sync RGB with Ambilight TV
    trigger:
    • entity_id: light.tv_ambilights
      platform: state
      condition:
    • condition: state
      entity_id: light.tradfri_rgb
      state: ‘on’
    • condition: state
      entity_id: input_boolean.follow_ambilight
      state: ‘on’
      action:
    • alias: ‘’
      service: light.turn_on
      entity_id: light.tradfri_rgb
      data_template:
      brightness: ‘{{ light.tv_ambilights.attributes.brightness }}’
      transition: 2
      xy_color: [’{{states.light.tv_ambilights.attributes.xy_color[0]|float}}’,’{{states.light.tv_ambilights.attributes.xy_color[1]|float}}’]

Correct. It could be possible, if you could use “ambilight+hue” option in TV. So it would be tricked to think that you have hue system. Philips said, that they don’t offer hue experience with other manufacturers, because they say that the color change is not fast enough.

1 Like

Hi,
I set uo everything as described above, but my ambilight is unavailable.

I have a 9002.

I get this error:

Update for light.ambilight fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/light/ambilights.py”, line 221, in update
self.getState()
File “/config/custom_components/light/ambilights.py”, line 155, in getState
fullstate = self._getReq(‘ambilight/currentconfiguration’)
File “/config/custom_components/light/ambilights.py”, line 267, in _getReq
return json.loads(resp.text)
File “/usr/local/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/local/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I’d really like to control my ambilighty. But I’m stuck with the error appearing every minute.

Hey, awesome component! Thank you, @jomwells!

I’ve seen people asking about ‘Ambilight + Hue’ switch in this thread. I’ve been trying to solve this particular problem for the past 2 years… I hope it’s okay if I share my solution here:

I’ve decided to document all API endpoints and to create a better python tool to control Philips TVs. You can find an unofficial API reference and the tool (both are ‘work-in-progress’) here: https://github.com/eslavnov/Pylips (comments are welcome!)

It’s far from being done and it’s not a home assistant component (yet), but it already supports turning ‘Ambilight + Hue’ on and off through the API:
python pylips.py --host %ip_address% --user %username% --pass %password% --command ambihue_on
python pylips.py --host %ip_address% --user %username% --pass %password% --command ambihue_off

You can use it through a script/switch entity in Home Assistant… Or perhaps @jomwells could add this particular API call to his component - I would be glad to help.

If this works for you, please share your TV model! Thank you in advance!

4 Likes

In my opinion, ambilight+hue on/off would be a really great addition for this component. I don’t have a problem to easily access this feature from the TV menu, however, I hate the fact that it keeps the lights on even if I turn off the TV. Therefore, would really like to automate it.

1 Like

Sorry for asking again, but I’d really like to enable this for my 9002 too. I copied the error in my post above.
Maybe the developer of this component can tell why it is failing.