Philips Android TV Ambilights (Light) component

@gyrga @Molodax, Right, I’m back, having looked at that python tool (fantastic by the way) it should be quite straight forward (in terms of the code) to add these ambilight+hue features into home assistant, but how do you think this should be done? Currently, for the extra features (the effects) i’m using the built in effects drop down for the individual light, but I don’t see an option for adding a secondary switch within the ambilight (light) panel itself, I wonder if it would be better to try and create a seporate remote component, combining many of the features in the python script (power on/off, navigation, launching apps etc) and having the +hue switch as a part of that, keeping the RBG light control as a separate entity? what are your thoughts
The only other option would be to add an Ambilight+Hue OFF and Ambilight+Hue ON ‘effect’ within the drop down, which would allow automation, but is essentially a work around

I think just adding them as a service will be a big thing. One can create shortcuts if they want to expose the functionality in the UI.

For anyone interested in automating the Ambilight+Hue setting, I have put together a Switch component using most of the code from the Ambilight Light component, this quickly adds support for Ambilight+Hue status (while the tv is available) and switching on/off from Home Assistant, note, there is a bit of a lag between HA sending the on/off request, and registering it change, therefore it is advised to decrease the scan_interval in your configuration.yaml, enjoy :slight_smile:

2 Likes

Hi did you have time to look further into this. I’d still like to have this too.

Are you guys able to turn on the Ambilight on even if the TV wasn’t on for a while. My ambilight goes unavailable about 5min after I turn the Tv to standby (WoWLAN enabled).

I saw this:

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.

But it says for a long period of time, mine goes offline a few minutes after. Not quite a long period of time.

Or should this feature only be used when the TV is on. I thought I could use the light without the TV on with this component, but I can only use it like this for liek 5min (see above).

I still have the unavailabilty question from above but I ran into another issue.

With the example from above my automation looks like this

- alias: Ambilight - TV follows Light
  initial_state: 'on'
  trigger:
    - entity_id: light.sphere
      platform: state
  condition:
    - condition: template
      value_template: "{{ not is_state('light.ambilight', 'unavailable') }}"
  action:
    - service: light.turn_on
      entity_id: light.ambilight
      data_template:
        brightness: '{{ states.light.sphere.attributes.brightness|int }}'
        xy_color: ['{{states. light.sphere.attributes.xy_color[0]|float}}','{{states. light.sphere.attributes.xy_color[1]|float}}']

While xy_color works, the brightness value does not get set.

If I set it in the service tab in home assisant like this

{
  "entity_id": "light.ambilight",
"brightness": "75"
}

it works, but it does not follow this line

brightness: '{{ states.light.sphere.attributes.brightness|int }}'

mine was working well but all of a sudden it is now unavailable all the time, tv on or off? any idea please?

1 Like

That is a known issue with this component, I think it was mentioned above somewhere in this thread, it is due to the way the jointspace API handles brightness commands - as of yet, the brightness will only be set if it is set to FOLLOW_COLOR, and you cannot set both brightness and colour in the same POST request - im sure this could be improved upon, but it would require rewriting the component (If anyone else has the time to do this, I would be happy to change it on the github repo :smiley: )

1 Like

To anyone having problems with availiability - this wont completely solve your problem (TV can still enter deep sleep at times) but try enabbling the wake on LAN setting in the TV’s settings app, that is the only difference I can think of, the ambilight component works for a long period of time after the TV switches off for me currently

Great work! I’m just curious about something… Any chance this component lets us use Xiaomi Yeelight/led stripes?

Something like this:

I have a full Xiaomi lights setup and don’t want to buy a new Philips Hue setup.

Thanks!

1 Like

Hey everyone!
I have created (my first!) a pull request on github to update this component to make it compatible with Home Assistant after the ‘Great Migration’. In the meantime, while the PR isn’t through yet (or if the author has objections to some other changes, which is fair) you can find the working version on my repo (you should see it in “forks”)

I also changed it up a bit to make it reflect the philips naming convention a bit more, so you need to pay attention to that and update your config accordingly!

@jomwells seems like we will get issues with 0.92

See

and (different component that was fixed fast)

@h4nc already created a PR on github to fix this, in the meantime you could use the component from my fork until it’s merged (but remember to change the platform name in your config). Although I haven’t added the init.py, the component works perfectly fine for me on 0.92. I changed the folder structure and added the needed manifest that defines the domain.

Like I said, if you don’t want to wait for the merge you can look at the current PRs on github, there you should find my PR. :slight_smile:

Could you post a link to your PR?

Sure, here’s the PR: https://github.com/jomwells/ambilights/pull/1
and here’s the fork itself: https://github.com/hutchinsane/ambilight
which is probably easier to download. Just remember to read the doc again, since I did change the platform name to better reflect the naming convention. :slight_smile:

1 Like

Would be really nice to have this component in custom updater.
@hutchinsane maybe you are able to do this in your fork?

1 Like

That’s a good idea actually, I’ll see what I can do!

Already tried your fork. Works again with 0.92. Thanks you!

Would really be nice to have those kind of updates automated with custom updater.

Is manifest.json really required? I’ve added empty _init_.py in the folder and it was sufficient.
Does anyone noticed that it is almost never possible to turn on the ambilight from frontend page if it is off, however, it works well when it is called as a light on service in automaton?

For it’s also only possible to control the ambilight when the tv is on.
I have a sensor that pings my tv. Some minutes after turning the tv to standby the ping fails. So after that ambilight is offline to.

Don’t know if turning it on with an automation would work. Never tried it, but I doubt it.