Jump to content
LaunchBox Community Forums

Smart Light Integration


Recommended Posts

I created a simple plugin to integrate launchbox/bigbox with my yeelight rgb.

It kind of simulates a backlight (I have the bulb behind the tv) but I think it looks better, for this case at least :)

The light turn on when I start bigbox, change the color based on selectedgame -> platform and turn off when I exit..

Here's how it looks right now

I don't plan in doing a public release but I can share the code if anyone gets interested.

  • Like 3
Link to comment
Share on other sites

Ok first let me say I'm doing everything the lazy way :)

docs -> https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf

- you have to activate lan control from the app
- the lamp will listen on 55443 for raw tcp json commands (NOT http)
(philips hue, for example, you send commands via http post)

the recommended way to start would be doing an SSDP discover on your network to get info about the lamp(s) (ip/port/etc). I'm just hardcoding the ip I get from the app/router. 

I'm also not checking for any server replies so I had to put that sleep on shutdown, because it was disconnecting before powering off :x

BigLight.cs

Edited by int3
Link to comment
Share on other sites

@Jason Carr

hey jason is there any way to get the platform selected from the platforms menu?

I'm getting the platform from the game with
SystemEventTypes.SelectionChanged -> GetAllSelectedGames()[0].Platform
but I wanted to change colors from the platforms menu

Looking at the api I see
IBigBoxThemeElementPlugin.OnSelectionChanged
but it doesn't seem to be firing or maybe I'm doing something wrong (not sure if I'd have to handle OnUp(), OnDown(), etc)

The idea is when I open BigBox or go to "View Platforms" get the currently selected platform, and when I move up or down get the newly selected, etc.

Thank you :)

Link to comment
Share on other sites

This looks amazing @int3; what an awesome idea. The IBigBoxThemeElementPlugin.OnSelectionChanged sounds like the right way to go. Basically, you'd have to implement that interface, and yes, you'd have to add methods for each of those methods on the interface, but you could just make them do nothing. If you implement that interface on a new class, it should be firing. Let me know if you can't get it to work and post the code and I'll help get it figured out. :)

  • Like 1
Link to comment
Share on other sites

@int3 I *think* I know why. In order to use the IBigBoxThemeElementPlugin interface, you have to implement it from a WPF/XAML control, and then use that control in a custom theme. That was the point of that type of plugin when it was built. If you're looking to do it without a custom theme, you would need to use one of the other interfaces, such as the ISystemEventsPlugin, as you've done. Is there a reason why that won't work?

Link to comment
Share on other sites

@Jason Carr only problem in using SystemEventTypes.SelectionChanged is I don't have a way to get the currently selected platform (from the platforms view). It fires when I open BigBox and when I move up or down, but since there's no game selected I can't use PluginHelper.StateManager.GetAllSelectedGames()[0].Platform. Maybe if you add a GetSelectedPlatform() to StateManager? :) 

Link to comment
Share on other sites

  • 2 weeks later...
On 3/8/2019 at 1:02 PM, int3 said:

@Jason Carr only problem in using SystemEventTypes.SelectionChanged is I don't have a way to get the currently selected platform (from the platforms view). It fires when I open BigBox and when I move up or down, but since there's no game selected I can't use PluginHelper.StateManager.GetAllSelectedGames()[0].Platform. Maybe if you add a GetSelectedPlatform() to StateManager? :) 

@int3 Sorry for the delay on this, but I've actually added a new StateManager.GetSelectedPlatform() method in for the next beta. I'm not exactly sure when the beta will be out, but most likely it'll be out in the next few days.

  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
On 4/22/2019 at 4:25 PM, zetec-s-joe said:

Once the you have updated int3 show a new video :)

Joe

I think @Jason Carr forgot to add GetSelectedPlatform(). I'm on 9.8-beta-10 and cannot see the method :X But when it gets added I'll post a new video :D

  • Haha 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...