Kodi Community Forum

Full Version: Philips Hue Service & Ambilight
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11
Hello,

I created this addon for my own use to adjust my lights based on Kodi. It can adjust lights based on playback options, and includes experimental support for Ambilight.

Requirements
  • Kodi Leia 18.x or higher
  • Hue Bridge V2 (Square)

Installation
  1. Get Repo for auto-updates
  2. Install to Kodi from Zip 
  3. Install Hue Service from Snapcase Repo
  4. Adjust your Hue lights using the official or a 3rd party Hue app to the desired configuration
  5. Go to add-on settings and select "Create scene" to save your light set up.
  6. In video or audio actions, select your newly created scene to be applied when you play, pause or start media

Features:
  • Create and delete multi-room LightScenes
  • Adjust your light's colour and brightness
    • Optional transition time for scenes
    • Supports lights in multiple rooms or groups
    • Edit your scenes in 3rd party apps
  •    Apply selected scene on video or audio player actions
    • Can be disabled based on video type (Episode, Movie or music video) or duration
  • Ambilight Support
    • Lighting effects synced with on-screen action
    • Hardware decoding not supported on Android
  •    Daylight detection
    • Uses Hue's sunrise and sunset settings
    • Disable during daylight hours
    • If sunset falls while watching media, optionally turn on lights
    • Add-on does nothing at sunset if there's no playback
  • Enable schedule
    • Set a start and end time at which the add-on should be enabled
    • Time in 24h format (Eg: 22:00, not 10:00 PM)
    • Disable during daylight setting takes precedence over active hours

Notes:
  • Does not support multiple bridges on your network
  • Unofficial zigbee lights can be added, but may have inaccurate colours with ambilight

Problems?
(2019-06-24, 01:04)Snapcase Wrote: [ -> ]Hello,

I've been using some old add-ons to control my Hue lights for a while but they haven't aged well. Using them as a base, I rewrote my own.

Please keep in mind this is my first add-on and first time writing python, in my free time. 

Expect bugs, no support & use at your own risk!

Installation
  1. Download latest .zip version or Repo for auto-updates
  2. Install to Kodi from Zip
  3. Go to add-on settings to configure Hue scenes for each media action
Features:
  • Create and delete multi-room LightScenes
    • Adjust your lights as desired, and use the add-on to select the lights and transition time.
    • Supports lights in multiple rooms or groups.
    • The official Hue app won't show scenes made outside of the official app, but most 3rd party apps will let you see and edit your scene
  •    Apply selected scene on playback
    • Select scenes to apply when on Play, Pause and Stop
    • Separate scenes for Audio or Video playback
  •    Daylight detection
    • Uses Hue's sunrise and sunset settings
    • Disable during daylight hours
    • If sunset falls while watching media, optionally turn on lights
    • Add-on does nothing at sunset if there's no playback
Notes:
  • Hue Bridge with nPNP only
  • Does not support multiple bridges on your network
  • Only tested on LibreElec 9.0.2 & Windows 10, but no reason it shouldn't work anywhere.
  • No ambilight / dynamic lighting support.
    • If anyone knows a good algorithm to generate colours from a screenshot, I'll be looking into this in the future.
Problems?
  • Make sure you update your Hue bridge to the latest version. This add-on assumes you have the latest features
  • Turn on debug logging or the addon's logging (in addon_data)
 

It connects to my bridge and says saving settings but when I got into the add on to set up the scenes etc the bridge settings aren't there. Retried many times and it doesn't save the settings.

Edit. To fix this I exited the add on straight after connecting the bridge. This saved it and the settings were intact when started again which then enabled me to configure the settings. Thanks!
(2019-06-26, 23:16)Bone9 Wrote: [ -> ]It connects to my bridge and says saving settings but when I got into the add on to set up the scenes etc the bridge settings aren't there. Retried many times and it doesn't save the settings.

Edit. To fix this I exited the add on straight after connecting the bridge. This saved it and the settings were intact when started again which then enabled me to configure the settings. Thanks! 

Thanks for letting me know. I've had some bugs with the settings not saving when that window is open before. I'll check it out.
Excellent, thanks for your efforts.

Do you know if this works with external players? Currently I am using mpc for 4K HDR playback on Windows (native Kodi player for standard Blu-ray) and previous apps didn't account for that.
(2019-06-27, 05:08)HomeTheatreGuru Wrote: [ -> ]Excellent, thanks for your efforts.

Do you know if this works with external players? Currently I am using mpc for 4K HDR playback on Windows (native Kodi player for standard Blu-ray) and previous apps didn't account for that.

I haven't tested it and never used external players, so I don't know for sure. The script only triggers if Kodi informs it that there was a play or stop event, so it all depends on if Kodi knows what the external player is doing. If it's not already supported at the Kodi level, it's not something I can add on my own. I'm mainly on a LibreElec setup so I don't think it's something I can try out easily on my end - you'd have to try it out to know for sure.

I've just released some fixes that should make it more reliable and fix some bugs with some of the settings not working properly.
Thanks for the quick reply, I shall test for myself and report back!
(2019-06-26, 23:16)Bone9 Wrote: [ -> ]It connects to my bridge and says saving settings but when I got into the add on to set up the scenes etc the bridge settings aren't there. Retried many times and it doesn't save the settings.

Edit. To fix this I exited the add on straight after connecting the bridge. This saved it and the settings were intact when started again which then enabled me to configure the settings. Thanks! 

Hi @Bone9 

I ran into a problem like you described last night but I'm not 100% sure of the cause. I changed some things around and it stopped happening on my system but I don't know for certain I fixed it. If you get a chance to update the plugin and try again, let me know what happens. Also, I was having the problem on Libreelec but not my windows install. What OS are you running Kodi on?
Hi!

Thanks for a great addon!

Would it be possible to add a setting that allows the light adjustment to activate just between specific hours?
(2019-06-29, 23:33)macardi Wrote: [ -> ]Hi!

Thanks for a great addon!

Would it be possible to add a setting that allows the light adjustment to activate just between specific hours?
That's a good idea and shouldn't be too complicated if Kodi has an easy way to input a time. I want to make it much as work as possible with a remote control so I never have to get up from my couch! I'll look into it.
Great, the sunset settings doesn’t really work for me during summer since I live in Sweden and the sun not really set. So setting an hour interval would be great.

Thanks
@macardi In that case I'm going to stop complaining about dark canadian winter days... I'm curious, how do the Sunrise and Sunset routines in the Hue app work in your case? My add-on uses the same times which as far as I know should work worldwide based on location & time of year.

In any event, I've released a new version, v0.4.0, that supports setting a time window in which the add-on is active. Note that "disable during daytime" takes precedence. The setting needs to be entered in 24h format, and if the end time is beyond midnight it won't work properly. Eg, setting a time window from 16:00 to 01:30 won't behave correctly. I'll see if I can improve this in the future.

I've also added support for UPNP/ SSDP discovery for those that need it. UPNP isn't very fast so I only fall back if the NPNP discovery doesn't work. Also, if it gets disconnected, it should retry every 2 minutes up to a maximum of 5 times. This should be useful for those that have dynamic IP addresses for their Hue bridge, as the retry will attempt to look for an updated IP. Hopefully these improvements make it work better for a broader range of network setups.
Thank you, will test tonight!

It’s not that the sunset routine doesn’t work, but since the sun set so late I’m in bed before it happens.
Posting my thanks to Snapcase - Just installed your Hue Service (via your repo) - and it worked the first time. The UX works for me, the creation of the scenes via your phone etc and then taking a copy of that within your service within kodi. I can easily set the service to dim the main cinema lights to off whilst simultaneously fading up some ambiance lights. 

To be honest, what you are doing now, out of the box, is all I wanted from a kodi hue extension, so hooray to you, and many thanks.

Cheers, Ed.
That's good to hear, I'm glad it's useful to others than me Smile
Hi,

I released a new version v0.5.0 with experimental ambilight support. It worked out much better than I expected! I'll update the main post with more information. There are many parameters that need tuning which I haven't settled on, and I'll be exposing more settings in a future version.

I'm especially curious for anyone to try this on a low powered device like a Raspberry Pi. Calculating the colours is a pretty costly.
Pages: 1 2 3 4 5 6 7 8 9 10 11