Jump to content

New Plugin - Philips Hue Mood Lighting


BillOatman
Go to solution Solved by Prydwyn,

Recommended Posts

BillOatman

Yup mine did this too, and it's successfully showing as version 1 now.

 

Apart from the setting to control the lights only by night, i think it would be good to also be able to have the option to control the lights on a timed basis. Sunset is too late for me as my house is quite dark....

Maybe sunset plus/minus a configurable number of hours or something.My house actually is a little too light at sunset.

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

WilhelmStroker

Maybe sunset plus/minus a configurable number of hours or something.My house actually is a little too light at sunset.

Ah yes that would be a good option.

Link to comment
Share on other sites

  • 2 weeks later...
BillOatman

Version 1.1.0.0 now in the catalog. This version adds a configuration item to set a sunset offset that is used when determining whether or not to control the lights.

  • Like 1
Link to comment
Share on other sites

WilhelmStroker

I've not had the chance to test this yet, hopefully sometime this week. Thanks for all your effort :)

Link to comment
Share on other sites

jhoff80

Hmm, thanks for this it's working perfectly.  I might finally be able to stop using Kodi with this plugin.

 

Now if only Netflix and Prime Video did similar. :D

Link to comment
Share on other sites

BillOatman

You are welcome.  Unfortunately nothing I can do about those other apps :)

Link to comment
Share on other sites

Pog22

I would like to note, that it works over the internet (hue is at a different location than the emby server) and its instant.   Thanks for taking on this plugin, hope to see it in the emby lineup soon!

 

How? It's asking for a hue bridge IP but I'm not exposing that? I have no option to login to my Hue account

Link to comment
Share on other sites

BillOatman

I think what he does is gives it his WAN IP address and a port, and he has his router port forward to the HUE bridge.

Link to comment
Share on other sites

Pog22

I think what he does is gives it his WAN IP address and a port, and he has his router port forward to the HUE bridge.

Being someone who has IOT devices in their own vlan at home this is definitely not something for me. Could it be possible do it if the plugin had Hue account access?

Link to comment
Share on other sites

BillOatman

Being someone who has IOT devices in their own vlan at home this is definitely not something for me. Could it be possible do it if the plugin had Hue account access?

I;m not sure how he does it, but the plugin expects to talk to the bridge directly.

@@pir8radio

Link to comment
Share on other sites

pir8radio

How? It's asking for a hue bridge IP but I'm not exposing that? I have no option to login to my Hue account

 

I run a few vlans as well for security. 

 

I am exposing my hub to the internet, I'm changing the port in my router, and my firewall only allows my single server IP to connect to that port (the hub).  Plus the hue hub only takes commands from clients that have the expected token (which you have to push the hub button to assign the token).    I would like to see @@BillOatman support connecting to the hub via https which would secure that kind of setup, hiding the token to sniffers.    In that case you would have to know my server IP (to spoof it) as well as the encrypted token to send commands to my hue..    If you were able to get both of those...   oh well, you can turn my lights on and off.. lol

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

Pog22

I run a few vlans as well for security. 

 

I am exposing my hub to the internet, I'm changing the port in my router, and my firewall only allows my single server IP to connect to that port (the hub).  Plus the hue hub only takes commands from clients that have the expected token (which you have to push the hub button to assign the token).    I would like to see @@BillOatman support connecting to the hub via https which would secure that kind of setup, hiding the token to sniffers.    In that case you would have to know my server IP (to spoof it) as well as the encrypted token to send commands to my hue..    If you were able to get both of those...   oh well, you can turn my lights on and off.. lol

 

Thanks, I've done just this, I've forwarded port 8088 to the Hue bridge on internal port 80 and locked it to just my Emby server source IP on my mikrotik firewall. 

 

It works really well, instant in fact. Any chance of adding a transition period, say dimming over 3-4 seconds? I use a kodi plugin that has theater light groups and a configurable dim time. There's also a Hue Stream app for Android as I also have a lightstrip I use for ambilight. Have you any plans for this @BillBoatman?  

Edited by Pog22
Link to comment
Share on other sites

BillOatman

Thanks, I've done just this, I've forwarded port 8088 to the Hue bridge on internal port 80 and locked it to just my Emby server source IP on my mikrotik firewall. 

 

It works really well, instant in fact. Any chance of adding a transition period, say dimming over 3-4 seconds? I use a kodi plugin that has theater light groups and a configurable dim time. There's also a Hue Stream app for Android as I also have a lightstrip I use for ambilight. Have you any plans for this @BillBoatman?  

No there isn't.  The bridge API does not allow it.  It does for light groups, but not for scenes.  Transition time for scenes is configured on the bridge itself when you create the scene.  It's my understanding that not all apps allow the setting of the transition time for scenes.  One Windows app that does is Hueatro.  https://www.microsoft.com/en-us/p/huetro-for-hue/9wzdncrfjj3t?activetab=pivot:overviewtab

 

5d2b7b105c938_Clipboard.jpg

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

BillOatman

Anyone know what the maximum transition time is for a scene?

I set 5 minutes (300,000 ms), and the light went to the end brightness instantly.

 

EDIT:  According to a post in the Hue developer forum,  the max transition time is 65534 ms or about 65.5 seconds.

Edited by BillOatman
Link to comment
Share on other sites

pir8radio

Anyone know what the maximum transition time is for a scene?

I set 5 minutes (300,000 ms), and the light went to the end brightness instantly.

 

EDIT:  According to a post in the Hue developer forum,  the max transition time is 65534 ms or about 65.5 seconds.

 

wow 65 seems like a long time too..   lol      I think i had a custom one set at around 10 seconds and that seemed too slow..  :-)

Link to comment
Share on other sites

BillOatman

I'm playing with a scene for movie credits which usually start with 5-6 minutes left nowadays.  

Still will probably leave that in as an optional scene and let people set a low light scene maybe.

 

Also testing HTTPS later, if that works OK for me without HTTPS I'll ask you to test it.

  • Like 1
Link to comment
Share on other sites

BillOatman

Hmmmm someone else posted:

"Transition time is specified in units of 0.1 seconds and can be up to 65535 (6553.5 seconds, or just over 1 3/4 hours)."

 

So he thinks it isn't in milliseconds.  I guess I'll have to experiment.

Link to comment
Share on other sites

chef

Hmmmm someone else posted:

"Transition time is specified in units of 0.1 seconds and can be up to 65535 (6553.5 seconds, or just over 1 3/4 hours)."

 

So he thinks it isn't in milliseconds.  I guess I'll have to experiment.

 

It's in Ticks sir

Link to comment
Share on other sites

chef

It's in Ticks sir

 

Oh sorry I miss read. I thought you meant Emby playback timing.

Link to comment
Share on other sites

pir8radio

@@Luke Do you block un-signed ssl certs if being requested from a plugin?   If so any way to add the HUE cert or allow it?    We are trying to make the link to emby secure for over the internet use... But emby is blocking the ability to connect to it as far as I can tell. Or is there a way for the plugin developer to skip the cert validation?

System.Net.Http.HttpRequestException: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
	   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
	   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Net.Security.SslState.ThrowIfExceptional()
	   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
	   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
	   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
	   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_1(IAsyncResult iar)
	   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
	   --- End of inner exception stack trace ---
	   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
	   at System.Threading.Tasks.ValueTask`1.get_Result()
	   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
	   at System.Threading.Tasks.ValueTask`1.get_Result()
	   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
	   at System.Threading.Tasks.ValueTask`1.get_Result()
	   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
	   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
	   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
	   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod)
	Source: System.Net.Http
	TargetSite: Void MoveNext()
	InnerException: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
	Source: System.Private.CoreLib
	TargetSite: Void Throw()
	   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
	   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Net.Security.SslState.ThrowIfExceptional()
	   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
	   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
	   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
	   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_1(IAsyncResult iar)
	   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
	
2019-07-16 17:50:47.987 Error App: Error in Emby.HueMoodLighting.HueMoodLighting
Edited by pir8radio
Link to comment
Share on other sites

 

 

Do you block un-signed ssl certs if being requested from a plugin?   If so any way to add the HUE cert or allow it?  

 

No, we don't, at least not directly. This looks like an outgoing request failing due to the certificate of the remote server.

Link to comment
Share on other sites

pir8radio

No, we don't, at least not directly. This looks like an outgoing request failing due to the certificate of the remote server.

 

That is correct...  the plugin is trying to reach the HUE device to talk to it.   The hue device has its own SSL cert (self signed)    The emby server is smacking it down "failing validation"  wondering if there is a way to tell the emby server (client in this case) to ignore that validation for a particular request or something.  I say emby server but I guess its a .net thing.

 

I'll try just adding a new cert to my hue first...   prob the most secure way to go about it.   otherwise you can have .net ignore the check..   but i think its global.. Just looked into it, looks like you can not update the self signed cert within the hue, so if there is a way to skip the validation within .net that would be great..   :D  :D

 

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
 
 
Edited by pir8radio
Link to comment
Share on other sites

 

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

 
 

 

 

Right but that's a bad practice, and that's also how you get black listed by app stores.

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