Just a test to check if multiple lamps works. It is hard coded for a second light bulb and if it works, it can be made for a list of light bulbs. Just as a tryout! Please note that not all statuses are being checked for the second bulb and that it is overall a simple implementation. Please add the second light bulb in your configuration as shown:
switch:
- platform: philips_ambilight+yeelight
name: Lounge Lamp (Top Right) # (Name in Front-End)
host: 192.168.1.XXX # (the TV)
username: !secret philips_username
password: !secret philips_password
address: 192.168.1.XXX, 192.168.1.YYY # (The first Bulb, The second Bulb) -> separated by a comma and space!
display_options: right-top
This new (and pretty unrefined) component mimics surprisingly well the funtionality of Amilight+Hue with all Yeelight bulbs/lights using the Music Mode function from their API. The colour of the bulb is read constantly from the TV (jointspace), processed on the Home Assistant machine, and updates are pushed to the bulb in a loop until turned off. I'm sure it could be improved, so the code is commented, I encourage you to have a play with the values and check the links for more custom changes, if something else works better, or adds more features ill be happy to add them in for everyone. The values I've chosen are simply through trial and error.
At times when testing this component (usually when the TV is displaying an ambient light / no colour), the bulb is still updated rapidly and can cause a noticeable flicker - if you have Epilepsy this may not be for you. (Yet) If anyone can find more optimal values to solve this, I would be very grateful (see Lines 83, 314, 316 etc).
This repository is compatible with the Home Assistant Community Store (HACS).
After installing HACS, install 'Philips Ambilight+Yeelight' from the store, and use the configuration.yaml
example below.
If you have already set up the Ambilight (Light) component, installing this component is very simple, copy the philips_ambilight+yeelight
directory into your config/custom_components/
directory,
enter the same username and password as for the ambilight component in the configuration.yaml, along with both the IP of the TV, and the IP of the bulb as follows, and restart home assistant:
If you have not setup any other Philips TV components, use the tool linked in the Ambilight (Light) component docs to obtain your username and password.
switch:
- platform: philips_ambilight+yeelight
name: Lounge Lamp (Top Right) # (Name in Front-End)
host: 192.168.1.XXX # (the TV)
username: !secret philips_username
password: !secret philips_password
address: 192.168.1.XXX # (The Bulb)
address2: 192.168.1.XXX # (The second Bulb)
display_options: right-top
The per-bulb positions I have added (defined by display_options
) are as follows:
Note:
- I have not tested each and every one of these positions manually, if one of them doesn't seem right, assume it's my fault and let me know, they are quick fixes
- As I do not have a TV with bottom ambilight LED's, I have not been able to test this part at all, although it should work in theory, please let me know if you have any success.
For a more custom position, different value calculations, or perhaps something different entirely, see the links in the code's comments. Understanding the 'topology' section (JointSpace API) will go a long way to explaining how this part works.
This component works by combining (or using features from) the following resources with a custom python script, if you would like to understand or improve different parts of this component, this is a good place to start:
- Python-Yeelight Library (Included in Home Assistant) by Stavros
- Pylips - Philips TV / Jointspace library (not Included) by eslavnov (very useful for testing)
- The Philips JointSpace API Documentation
- Philps Jointspace v6 Commands by marcelrv