Jump to content

New Plugin - Philips Hue Mood Lighting


BillOatman
Go to solution Solved by Prydwyn,

Recommended Posts

I've never really properly looked at the end time, but as far as I remember, once you stop a movie and then restart it, the end time is still calculated from the original length of the movie so I don't think that will be consistent.

There seems to be runtime in the baseItem object.

 

So calculating runtime ticks minus position ticks, in the progress event, minus whatever the user says is the moment to target, would most likely give us the answer, but we'd be doing that on progress events, and that's where I'm not sure if it's worth the cost.

 

Dunno. Was it taxing before Bill?

Edited by chef
Link to comment
Share on other sites

BillOatman

There seems to be runtime in the baseItem object.

 

So calculating position ticks, in the progress event, minus the runtime ticks, minus whatever the user says is the moment to target, would most likely give us the answer, but we'd be doing that on progress events, and that's where I'm not sure if it's worth the cost.

 

Dunno. Was it taxing before Bill?

 

It didn't seem to be.  But I have a decent server box and never more than 3 clients connected at once.

Plus we are already processing the progress event anyway for other things.

 

It should be made optional like the others in case it is taxing for some servers.

 

The only real problem I saw was the very rare case where a movie etc. had no, or extraordinarily short, end credits.  In that case the lights start to ramp up while the movie etc. is still playing. Another reason to make it optional :)

Edited by BillOatman
Link to comment
Share on other sites

It didn't seem to be. But I have a decent server box and never more than 3 clients connected at once.

Plus we are already processing the progress event anyway for other things.

 

It should be made optional like the others in case it is taxing for some servers.

 

The only real problem I saw was the very rare case where a movie etc. had no, or extraordinarily short, end credits. In that case the lights start to ramp up while the movie etc. is still playing. Another reason to make it optional :)

Then consider it done!

  • Like 1
Link to comment
Share on other sites

pir8radio

unrelated,  where have i seen the ability to set the ramp rate of a scene?     I dont remember... lol   but i recall seeing it somewhere...    How can I set my stop scene to ramp up slowly. 

Link to comment
Share on other sites

unrelated,  where have i seen the ability to set the ramp rate of a scene?     I dont remember... lol   but i recall seeing it somewhere...    How can I set my stop scene to ramp up slowly. 

 

You need to set that up in a 3rd part Hue app. Strangely, the official apps don’t support it.

 

Bill recommends the app for Windows called Huetro. Works really well:

 

https://www.microsoft.com/en-us/p/huetro-for-hue/9wzdncrfjj3t?activetab=pivot:overviewtab

Edited by hstamas
  • Like 1
Link to comment
Share on other sites

pir8radio

@@chef can a transition time feature be added to the plugin some how?   :D    to "modify" the scene via the plugin?

 

Note that you can also create scenes with a transition time which will be used when the scene is recalled. e.g.

  • {"name":"Romantic dinner", "lights":["1","2"], "recycle":true, "transitiontime":50}

 

5e2908ac47f44_Screenshotfrom202001222044

Edited by pir8radio
Link to comment
Share on other sites

<p>

@@chef can a transition time feature be added to the plugin some how? :D to "modify" the scene via the plugin?

Note that you can also create scenes with a transition time which will be used when the scene is recalled. e.g.

  • {"name":"Romantic dinner", "lights":["1","2"], "recycle":true, "transitiontime":50}
5e2908ac47f44_Screenshotfrom202001222044
Let me see about that. You would just want a transition time added to the scene call if that is possible?

 

 

Modifying scenes in hue gets kinda tough because you have to get a bunch of states and IDs for each device to reset the scene with new info.

 

It gets pretty in-depth.

Edited by chef
Link to comment
Share on other sites

pir8radio

Let me see about that. You would just want a transition time added to the scene call if that is possible?

 

 

Modifying scenes in hue gets kinda tough because you have to get a bunch of states and IDs for each device to reset the scene with new info.

 

It gets pretty in-depth.

 

Yea i looked through the api, didnt see where you could add the transition during recall.   It looks like you need to "modify" the scene as stored in the hue.   So if that is true, maybe just an option below each scene selection that says "Ramp Rate" or "Transition Time" in seconds and a save button that edits that scene via the plugin?

 

5e290d4bc35a4_Screenshotfrom202001222103

Link to comment
Share on other sites

pir8radio

oh i see what you are saying, you basically have to rewrite the whole scene?  you cant just say  scene name, transition x.  You have to re-input all of the lights and crapl

Link to comment
Share on other sites

pir8radio

I ended up finding an ios app "Hue Lights" by LapApps, LLC that let me change the transition time pretty easily 

  • Like 1
Link to comment
Share on other sites

BillOatman

All correct, you can't specify the transition time in the call to set the scene.  It needs to be defined in the scene setup itself.  

Not all scene editors allow you to set transition time. I mentioned one way earlier in this thread that does for Windows and is free.

Oh yes, mentioned on page 9 as well .. Huetro :)

 

I also thought trying to redefine the scene transition from the plugin config was above and beyond the call of duty :)

Edited by BillOatman
Link to comment
Share on other sites

WilhelmStroker

2 small issues with the current version:

1) My Roku stick doesn't seem to have an icon in the plugin. It does have one in the devices section in Emby and my Xbox and Emby Theater show up fine.

2) I've configured all settings, and when I go back into the settings, whatever is configured for Series is not readable. Movies and Live TV are still fine. Disabled Ublock but that didn't make any difference. The plugin still works though :)

 

Thanks.

Link to comment
Share on other sites

BillOatman

2 small issues with the current version:

1) My Roku stick doesn't seem to have an icon in the plugin. It does have one in the devices section in Emby and my Xbox and Emby Theater show up fine.

2) I've configured all settings, and when I go back into the settings, whatever is configured for Series is not readable. Movies and Live TV are still fine. Disabled Ublock but that didn't make any difference. The plugin still works though :)

 

Thanks.

 

Did the previous plugin (huemoodcontrol) icon work on the stick?

Link to comment
Share on other sites

Did the previous plugin (huemoodcontrol) icon work on the stick?

I think he means the push discovery image in the plugin UI.

Link to comment
Share on other sites

BillOatman

I think he means the push discovery image in the plugin UI.

Ohhhhhhh yeah.  That is a pretty one :)

Link to comment
Share on other sites

WilhelmStroker

I think he means the push discovery image in the plugin UI.

Yup! All my other devices show an icon, apart from my Roku. 

 

5e29eb7fd9c4f_Capture.jpg

Link to comment
Share on other sites

Yup! All my other devices show an icon, apart from my Roku.

 

5e29eb7fd9c4f_Capture.jpg

Ohh, that icon. That's an easy fix. Thanks!

 

It's fixed for the next release thanks guys!

Edited by chef
  • Like 1
Link to comment
Share on other sites

Not that it matters, but the icon for Kodi does not show either. Maybe we should have a "generic" icon also :)

I'll add them all for 1.0.0.9

 

I was a bit choosey for time sake.

 

Consider it done!

  • Like 2
Link to comment
Share on other sites

It's all been added in 1.0.0.9 which means dual update.

 

Interested in how the credit scenes work out.

 

Like I say, I don't have a hue, I wrote this thing from the API docs. This means I can't test it like it should be.

 

Pretty sure the logic makes sense.

Link to comment
Share on other sites

        private List<string> CreditSessions = new List<string>(); //That list of session IDs we need to ignore
        private void PlaybackCredits(PlaybackProgressEventArgs e, PhillipsHueSceneEmbyProfile profile, PluginConfiguration config)
        {
            if (profile.MediaItemCredits == null) return; //Users not using it. 

            if (CreditSessions.Exists(s => s.Equals(e.Session.Id))) return; //We've already triggered the event, it's in the list - move on

            //So much calculations every second!!
            var runTime                = e.Item.RunTimeTicks;
            var playbackPosition       = e.Item.PlaybackPositionTicks;
            var positionTriggerSeconds = runTime - (profile.MediaItemCreditLength * 20); //20 ticks in a second (we've asked the user to think of this input in seconds)

            if (playbackPosition < positionTriggerSeconds) return; //It's not time yet, move on

            CreditSessions.Add(e.Session.Id); //Add the session ID to the list so this event doesn't trigger again
            logger.Info($"Phillips Hue Reports {e.MediaInfo.Type} will trigger Credit Scene on {e.DeviceName}"); //Log that shit.
            RunScene(JsonSerializer.SerializeToString(new SceneRequest
            {
                scene = profile.MediaItemCredits
            }), config);

        }

Make sense to anyone else?

 

Empty the list on stop events (if the session exists in the list). Person might have stopped playback during the credits.

Edited by chef
Link to comment
Share on other sites

It's all been added in 1.0.0.9 which means dual update.

 

Interested in how the credit scenes work out.

 

Like I say, I don't have a hue, I wrote this thing from the API docs. This means I can't test it like it should be.

 

Pretty sure the logic makes sense.

Just installed the new version. Gonna check it out now

 

Sent from my BLA-L29 using Tapatalk

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...