ollo69/ha-samsungtv-smart

Ambilight implementation?

INPoppoRTUNE opened this issue · 14 comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I’d like to know if it is technically possible to export to Home Assistant the RGB values of the perimeter pixels of the tv at a fast enough rate to be useful, if possible at all.

Describe the solution you'd like
A clear and concise description of what you want to happen.
While the tv is turned on take a screenshot every few milliseconds, trim the perimeter of the display and export the RGB value of the pixels. This would allow us to implement an Ambilight inspired solution, similar to Hyperion.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I wasn’t able to find any other implementation, as Hyperion is Android exclusive and the only branch I’m aware of is for LG tvs.
Hue sync isn’t really a reasonable solution for me as I don’t own any Philips light, nor the sync box required.

Additional context
Add any other context or screenshots about the feature request here.

amen

amen

?

I don't know if this is possible, maybe with some dedicated hw just to do this it could be. But for sure this is not something that can be implemented by this integration based on ha infrastructure.

for sure this is not something that can be implemented by this integration based on ha infrastructure.

Just as curiosity, what are you seeing that makes you think this is not possible? Is the limit among the Samsung APIs, the polling rate of HA, the computational burden or something else I’m not aware of?

Polling rate is not applicable to HA state machine.

Polling rate is not applicable to HA state machine.

But I’m assuming that between HA and Samsung APIs you have a Python layer, which is capable to implement a polling mechanism. If HA is able to change the entity state fast enough, you may demand to python the polling task and let HA just update the entity value with whatever python is spitting out(?)

I wish there could be a workable solution.

Why is the Philips hue app able to do it then?
Isn't there any way to port to Tizen hyperion?

There are a lot of complexity in this kind of implementation. First of all a language as Python (that is an interpreted language, basically a scripting language) is not the right one for this kind of solution. I don't know very well Hyperion, but as I can see it is written in C++ and I suppose it use low level OS API. You have to consider that a software that capture screenshot every ms it will use a lot of CPU, using python for this you will probably have 100% CPU without an acceptable response. Furthermore an HA integration run in the HA context and would totally kill the main HA functionality.
The only possible solution should have a software like Hyperion that run alone, maybe on a separate hw (or may be not, depend on how powerfull is your hw), and the integration should comunicate with that software based on exposed API.

The only possible solution should have a software like Hyperion that run alone, maybe on a separate hw

The problem for this solution is that you need an external video source, from which you’ll split the signal. I don’t have an external source, and I’d like to access the internal video source.
I’m not familiar wit Samsung APIs, so I tried to launch the challenge to a tangent project.

There are a lot of complexity in this kind of implementation. First of all a language as Python (that is an interpreted language, basically a scripting language) is not the right one for this kind of solution. I don't know very well Hyperion, but as I can see it is written in C++ and I suppose it use low level OS API. You have to consider that a software that capture screenshot every ms it will use a lot of CPU, using python for this you will probably have 100% CPU without an acceptable response. Furthermore an HA integration run in the HA context and would totally kill the main HA functionality. The only possible solution should have a software like Hyperion that run alone, maybe on a separate hw (or may be not, depend on how powerfull is your hw), and the integration should comunicate with that software based on exposed API.

a detail:
AS far as I know, no external hardware is needed to run this type of ambilight system.

For example:
In Webos there is the possibility to install Hyperion by rooting the tv, it is the same TV that runs hyperion and it works perfectly.

In Samsumg, there is an official solution, it is an application of PHilips HUE, but it is very expensive and only allows to use its hardware for the leds.

I understand then that if there is an official application that does it, it should be possible.
Another thing is that they have had access to private methods of the video api and that officially for developers do not allow ....
But the tv should be able to do what is necessary without external hardware.

a detail: AS far as I know, no external hardware is needed to run this type of ambilight system.

Well, technically you need at least root access to the tv and a led controller that needs to be able to communicate with such tv.
Failing to have root access to the tv or to communicate with the leds requires at least a third microcontroller into the mix.

Un detalle: Hasta donde yo sé, no se necesita ningún hardware externo para ejecutar este tipo de sistema ambilight.

Bueno, técnicamente necesitas al menos acceso root al televisor y un controlador LED que pueda comunicarse con dicho televisor. No tener acceso raíz al televisor o comunicarse con los LED requiere al menos un tercer microcontrolador en la mezcla.

Yes, yes, right.
I nuance:

Specifically you need a small hardware, which receives the signal from hyperion ( or similar) and send it to the led strip.

What is most commonly used in the ambilight custom world, is a WLED device, which costs less than 5 euros.

This would be enough.
But that, the challenge here would be to somehow read the screen similar to how hyperion does.

I also agree that Python is probably not the solution.

But that, the challenge here would be to somehow read the screen similar to how hyperion does.

I think you may be underestimating the communication challenge: admitting the existence of a screenshot Samsung API based on the existence of Hue Sync, there might not be a fast enough API to send the content to the led driver. This will result in a strip that lag behind the actual image on the screen. There may also be a communication protocol challenge.

That said, I’m not familiar at all with Samsung APIs, so I’m currently stuck at the first step.

admitting the existence of a screenshot Samsung API based

As I know it does not exists. Consider that this protocol is not so well documented, most is based on test / reverse engineering.
Anyway I close this thread because this feature cannot be implemented here in any case.