Jump to content

Plugin for controlling Hue light


nxenos83

Recommended Posts

WilhelmStroker

Yes, windows is not recommended for home assistant, so a pi is your best bet. Or a linux machine for example. I have 2 Emby clients in my living room, and what my automation does is trigger a certain activity for JUST the lights in my living room, if I'm on any of those devices. It looks a bit like this, but there's likely better examples to be found on the Home assistant forums. This is pretty much borrowed from the link I posted earlier.

You need to configure both Hue and Emby as prerequisites.

 

automation:
  - alias: "Emby Playback paused/stopped"
    trigger:
      - platform: state
        entity_id: media_player.emby__androidtv__nvidia_shield_android_tv, media_player.emby__emby_theater__xbox_one_x
        from: 'playing'
        to: 'idle'
    action:
        service: scene.turn_on
        entity_id: scene.livingroom_normal

  - alias: "Emby Playback starting"
    trigger:
      - platform: state
        entity_id: media_player.emby__androidtv__nvidia_shield_android_tv, media_player.emby__emby_theater__xbox_one_x
        to: 'playing'
        from: 'idle'
    action:
        - service: scene.turn_on
          entity_id: scene.livingroom_dim
        - service: light.turn_on
          entity_id: light.hue_lightstrip_plus_1

 

The scenes look like this:

scene:
  - name: Livingroom normal
    entities:
        light.living_room_big:
            state: on
            transition: 2
            brightness_pct: 100
        light.living_room_small:
            state: on
            transition: 2
            brightness_pct: 100
  - name: Livingroom dim
    entities:
        light.living_room_big:
            state: on
            transition: 2
            brightness_pct: 10
        light.living_room_small:
            state: on
            transition: 2
            brightness_pct: 10

Link to comment
Share on other sites

hstamas

Thanks for posting that example @WilhelmStroker. I havent really attempted to try Home Assistant yet as I would need to get a Pi set up first but have been studying examples trying to familiarize myself why the syntax used.

 

Would you know what could be added to your above example to only get this automation to happen when watching a movie and be ignored for TV and Live TV? I would be using Kodi as my player so maybe it reports something that could trigger it or possibly just add a video length condition and have it trigger only if the video is of a certain duration?

 

​I don't want my lights to go off when watching regular TV shows or live tv.

Edited by hstamas
Link to comment
Share on other sites

  • 4 months later...

hstamas can you please share how you managed to get this to work? I added my IFTTT maker url including the api key in the first text field, checked movies and my options and entered the name of my webhook "turn_on_lights" that I created in IFTTT. this does not work for me.

Link to comment
Share on other sites

when I fire the IFTTT trigger manually via the URL or another app it works perfectly, but it seems that emby does not trigger the webhook at all.

 

this is my setup:

 

5c13a3ef10810_20181214133400.png

Link to comment
Share on other sites

hstamas

Did you verify in IFTTT that it received the request and then attempted to act on it?

 

Yes the IFTTT trigger works properly.

 

Like I mentioned this did NOT work for me using the stable release of the server. Once I updated to the beta (Mac OSX) it started working.

Link to comment
Share on other sites

hstamas

hstamas can you please share how you managed to get this to work? I added my IFTTT maker url including the api key in the first text field, checked movies and my options and entered the name of my webhook "turn_on_lights" that I created in IFTTT. this does not work for me.

Did you make sure your event name in IFTTT is the exact same name used in the web hook web url? I had an issue early on not knowing what to put in the placeholder part of the url. attached are my setups in both the plugin and IFTTT. Your event name has to be the exact same thing in both places.

 

Now I havent watched a movie in about a week. I sure hope this hasn't stopped working and I am just not aware of it??

 

Just checked and it is still working as expected.

post-45887-0-59269200-1544805031_thumb.png

post-45887-0-14270300-1544805037_thumb.png

Edited by hstamas
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
Biofects

Hello everyone, I am very vanilla (2 weeks new) to Emby and loving it! I was searching for a phillips hue plugin and found this article. I was bummed for about 30 min, that the original plugin was no longer working. Then I said I'll see if I can fix it. Well I have it working for Emby 3.6.0.84. I do have the fix for 3.5 also, ill need to compile it. I will fork the original and publish in the next day or so. Do I just link to my github here when I publish? I would love feedback.

 

Thanks

Edited by Biofects
Link to comment
Share on other sites

hstamas

Hi @@Biofects. The plugin is still working for me as is so Im curious what isnt working on your end? Is it just the need to be running the beta server that is the issue?

 

I'd be happy to test out anything you create that might make this an even better plugin. @@Luke should be able to give you instructions on how to get a plugin submitted to the catalog once  you get to that stage.

Link to comment
Share on other sites

Biofects1

Thanks @Luke and @hstamas.

 

I have published release here Biofects. The reason I went down this road was I could not get the original plugin to work with my new install of Emby Server not the beta version. I also tried to update the base code to be on later versions. Please let me know if you have issues on the install and I will try to fix them.

 

Thanks.

Link to comment
Share on other sites

To work with the beta version you'll need to use the beta nuget package. the version of the nuget package corresponds to the version of emby server.

Link to comment
Share on other sites

Biofects1

Oh Sorry,I miss spoke. I have the latest nuget package, and working the update is Working in Emby 3.6.0.78-beta. Also I messed up my account and I am @Biofects

Edited by Biofects1
Link to comment
Share on other sites

hstamas

My bad guys. I though we were talking about the Webhooks plugin that this discussion thread turned into (which works well with the latest Emby server beta).

 

@@Biofects1, I will definitely test out your updated Hue specific plugin this weekend and give you feedback here.

Edited by hstamas
Link to comment
Share on other sites

GreyBeard

I so wish this could somehow be tied to the cinema mode plugin. I used to use the Cinema Experience plugin with Kodi. It made for a very cool "movie night" experience. Select play for the movie and before movie starts dim certain lights, start music and play trivia slides for 10 minutes. End trivia, turn off lights, turn on light behind tv and play two trailers. Play the movie. Movie gets paused, raise lights to dim level. Movie ends, raise lights to normal level. The only thing they didn't have figured out when I was using it was how to save a time credits start for each movie to raise the lights to dim level then full when it ends. Add in the ability to control the curtains I'll eventually have to change the screen size for 2.35:1 vs 1.85:1 and we're golden. Really wish I knew more about programming.....

Link to comment
Share on other sites

GreyBeard

BTW, the plugin from @@Biofects works fine in the latest beta. (Which for some reason my dashboard says I'm running 4.0.0.0 beta instead of what I think is 3.6.85?) Thanks for the fix. Looking forward to more options such as colors and controlling more than one group doing different things.

Link to comment
Share on other sites

hstamas

Thanks @Luke and @hstamas.

 

I have published release here Biofects. The reason I went down this road was I could not get the original plugin to work with my new install of Emby Server not the beta version. I also tried to update the base code to be on later versions. Please let me know if you have issues on the install and I will try to fix them.

 

Thanks.

 

Had the chance to quickly test out the plugin last night and it work perfectly. In my use case I would need the ability to choose which specific lights to control or if thats not possible be able to trigger a scene instead? Also the ability to have different actions based on what playback is doing, IE: Play = Turn off  / Pause = Raise to 50% etc. Great work so far!

Link to comment
Share on other sites

Biofects

Had the chance to quickly test out the plugin last night and it work perfectly. In my use case I would need the ability to choose which specific lights to control or if thats not possible be able to trigger a scene instead? Also the ability to have different actions based on what playback is doing, IE: Play = Turn off  / Pause = Raise to 50% etc. Great work so far!

 

 

Thanks for testing, Im hoping to have some time this weekend to start adding features as you have described. Like I said I am still very vanilla to Emby, so it might take a bit. I have added a function to auto discover the bridge, just need to add a few more features before next release. 

Link to comment
Share on other sites

  • 3 weeks later...
Biofects

Hey Everyone, 

 

Sorry for the delay, I have added a couple features:

 

Get the latest here Biofects Emby Phillips Hue Plugin

 

  • Multiple Light Group Support
  • Individual Dim Control for Play Pause and Stop

 

5c4e146f3a935_ScreenShot20190127at22752P

 

Please test and let me know what you think.

 

I also want to give a shout out to a bud NicK who helped me with C# and getting bugs worked out.

Edited by Biofects
Link to comment
Share on other sites

OMG, a few months ago I read something about the possibilities of Philips HUE and Emby, but I did not have any device and I was not interested anymore. But last Christmas I received an Amazon Dot 3rd and a week ago I bought a starter kit with two bulbs and a bridge.

 

I just tried it and it works great! I created a routine with Alexa, an "emby mode", where Alexa and a Broadlink RM mini 3 open the TV app, decrease the brightness and turn the lights blue. But this works more directly and by devices, a light bulb in the bedroom for example with settings different from those of the living room.

 

 

 

I guess the next step could be to customize the colors of the groups or devices. And I think the greatest (and maybe most complicated) thing is to detect that you have logged in Emby in a device and launch a change in the lights.

 

For example:

 

In the living room I have lights in warm white mode so, when you enter and log in Emby App, the lights change to a certain color, then we got the preferences of play, pause and stop and when you disconnect or log out you return to the previous setting or another you want.

 

 

I do not know if it is possible because I do not know what can or can not be done. But since I do not know too much about programming, at least my contribution is to try and give ideas.

 

 

thank you very much @@Biofects and hit it :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...