home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.16k stars 29.83k forks source link

Philips TV Ambilight doesn't turn on #68676

Closed ostojan closed 2 years ago

ostojan commented 2 years ago

The problem

Using entity provided by phipils_js integration I can't turn on Ambilight in my TV. Turning off works fine and without any problems.

What version of Home Assistant Core has the issue?

core-2022.3.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

philips_js

Link to integration documentation on our website

https://www.home-assistant.io/integrations/philips_js/

Diagnostics information

File is too big to paste here

Example YAML snippet

service: light.turn_on
target:
  entity_id: light.mytv_ambilight
data: {}

Anything in the logs that might be useful for us?

I don't see any errors or warnings

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

philips_js documentation philips_js source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (philips_js) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

elupus commented 2 years ago

Does the entity turn on? Can you change effects?

ostojan commented 2 years ago

No the entity doesn't change status. I discovered that I can turn it on, but I have to pass additional data in 'effects' field. It'd be nice to just turn on last effect on its own rather than passing effects manually.

bramstroker commented 2 years ago

I have the same issue. Unable to turn on ambilight. Turned on debug logging for haphilipsjs to provide some debug information.

Running HA 2022.3.8 Philips TV 55PUS7101. Jointspace 6

When I turn on ambilight with the remote on my TV I see the following in the log

2022-04-01 20:53:25 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/mode -> {"current":"internal"}
2022-04-01 20:53:25 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/power -> {"power":"On"}
2022-04-01 20:53:25 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/currentconfiguration -> {"styleName":"FOLLOW_VIDEO","isExpert":false,"menuSetting":"VIVID"}

However the effect is not selected, and none of the effects in the GUI seem to match the effects my TV provides.

Screenshot 2022-04-01 at 20 54 48

Turning the ambilight off with HA works correctly.

When I turn it on again I see the following API calls:

2022-04-01 20:56:00 DEBUG (MainThread) [haphilipsjs] Post succeded: {'r': 255, 'g': 255, 'b': 255} ->
2022-04-01 20:56:00 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/cached -> {"layer1":{"left":{"0":{"r":255,"g":255,"b":255},"1":{"r":255,"g":255,"b":255},"2":{"r":255,"g":255,"b":255},"3":{"r":255,"g":255,"b":255}},"top":{"0":{"r":255,"g":255,"b":255},"1":{"r":255,"g":255,"b":255},"2":{"r":255,"g":255,"b":255},"3":{"r":255,"g":255,"b":255},"4":{"r":255,"g":255,"b":255},"5":{"r":255,"g":255,"b":255},"6":{"r":255,"g":255,"b":255},"7":{"r":255,"g":255,"b":255}},"right":{"0":{"r":255,"g":255,"b":255},"1":{"r":255,"g":255,"b":255},"2":{"r":255,"g":255,"b":255},"3":{"r":255,"g":255,"b":255}}}}

And then when retrieving the ambilight state:

2022-04-01 20:56:55 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/mode -> {"current":"internal"}
2022-04-01 20:56:55 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/power -> {"power":"Off"}
2022-04-01 20:56:55 DEBUG (MainThread) [haphilipsjs] Get succeded: ambilight/currentconfiguration -> {"styleName":"OFF","isExpert":false}

The problem seems to be somewhere in the styles/effects not being mapped correctly.

Hope this helps a bit. Let me know if I need to provide more information.

elupus commented 2 years ago

Well it tries to turn on manual mode, which it seems your tv is ignoring.

bramstroker commented 2 years ago

The problem is it tries to turn the ambilight on with mode AUTO and style OFF, this style is set in the attributes after the async_turnoff function is run. It does not save the latest selected effect but overwrites with OFF.

I made some quick changes in the python code to make things work for me. I always want the ambilight in standard FOLLOW_VIDEO mode, see https://gist.github.com/bramstroker/243d8f245da2a9b984c06751d544ff44. And all sections between CUSTOM START and CUSTOM END. Not sure how to resolve things for everyone, because these FOLLOW_VIDEO presets are not passed from the Jointspace API so they are probably different for other TV's

elupus commented 2 years ago

It should have set it to MODE manual, but i don't see that in your call log example. Only the cached color values.

Was the screen on when you tried this? Or was this turning on from screen off?

bramstroker commented 2 years ago

It should have set it to MODE manual, but i don't see that in your call log example. Only the cached color values.

You mean the ambilight mode from api call ambilight/mode? They are as follows when I switch using my remote control.

Was the screen on when you tried this? Or was this turning on from screen off?

I always have the screen on.

elupus commented 2 years ago

Oh that is interesting. They don't follow along at all on my tv to styles. Okey so this was TV on.

Turning on with mode auto and style off is obviously invalid. Turning on with som follow video mode when screen is turned on makes absolute sense. Can you provide a pull request? Then we can look at details there?

bramstroker commented 2 years ago

Sure will have a look into that tomorrow

bramstroker commented 2 years ago

@elupus Did some refactoring this morning on the ambilight component. I've sent you a PM on discord to discuss something.