[V4] Dev service Milight

Hello everyone,

I’m working on developing the milight service. It will probably take some time as I’m not an expert in development, but I’m very motivated :wink:. For now, I can retrieve the gateway, include it in Gladys, and create the 4 Milight zones as devices.

Next step, send the command to turn the lights on/off.

Is anyone using milights?

Some previews

Hello @link39

I use it so I can be available for testing :slight_smile:

Hi @link39,
if you need help with development or reviews, I’m at your disposal :wink:.
Don’t hesitate to create a Pull Request on the Gladys repo (as a draft until development is complete) so we can take a look more easily and follow the development.

pr_draft

See you later

Thanks @AlexTrovato and @Totof.

I will get back to the service within the week and will therefore make a PR as indicated.

I managed to turn the lights on/off. In terms of code, I am stuck on creating parameters at the device level and retrieving them. I will probably ask you about this point.

See you soon.

Hello.

I still haven’t had time to work on the subject because I don’t have much time to devote to Gladys at the moment.
But yes, I will have to manage the color part, which I am not currently doing. More generally, I think that all services handling bulbs should use the same ‹ color › component. I don’t know if @pierre-gilles has already done something in the Philips Hue module for colors. In which case we could build on that. I know there have been a lot of discussions about this on the forum but I’ve lost track of it now :wink:

I didn’t know about Magic Device. It really looks like the mi-light, is it recent? Do you have feedback on the state with it or is it just sending ON / OFF / color commands?

Hi @AlexTrovato,

I tried to create a PR in Draft mode but I couldn’t find how to do it :sweat_smile: I only have the option Create a pull request.

Hello, on the « create PR » button you have a small arrow (dropdown), that’s where you’ll find the draft.
But I haven’t found a way to switch from PR to draft, you’re not allowed to make mistakes.
Otherwise, you put « WIP » in the title of the PR.

Hi, I’ll pass on the MultiLevelDeviceFeature, I admit I haven’t looked much into the Gladys core yet, I’m mainly focusing on the services part.

Yes, indeed, and then you have SensorDeviceFeature and BinaryDeviceFeature which are currently used. The display is therefore mainly managed by feature, not by device. But also, the device does not know its own type (light, switch…), only the features know it.

Great job regarding the color variation, we discussed it here.
The view of a color wheel was highlighted.
https://community.gladysassistant.com/t/parlons-de-gladys-v4/3578/672?u=tlse-vins

We’ve had this debate many times on the forum (probably in the « Let’s talk about Gladys 4 » topic), and I’m completely in favor :slight_smile: If a sensor manages temperature, humidity, and brightness at the same time, it makes sense to display the device only once and group the returned information, saving space.

We just need to find a clean way to do it, if anyone has presentation ideas, I’m interested.

I’m not a fan of this kind of solution, I find it cluttered and not necessarily useful to present 16 million colors to the user :stuck_out_tongue: I prefer a selection of 10-16 colors carefully chosen, like the palette proposed by @renaiku in PR

My mistake, I thought a mix of the two was not bad.

Hi,

a PR for the mi-light service:

https://github.com/GladysAssistant/Gladys/pull/647

I’m not a dev so be indulgent… and I’m open to all remarks and advice :wink:
I was heavily inspired by the hue module to understand the dev logic and I admit that some elements still escape me, especially for the interactions between UI and server.

What should work:

  • Detect Mi-light bridges on the network
  • Add areas as devices
  • Turn areas on/off

Bugs and remaining tasks:

  • Fix a display bug when adding an already existing bridge
  • Remove devices linked to a bridge when deleting it
  • Make it compatible with bridges other than v6.
  • Test with multiple bridges on the network
  • Perform the tests described in the pull-request check-list

For brightness/color management, I’m waiting for the more global reflections on the subject to mature.

Note for testers:
If you want to test and you are on Windows there is a file to modify. Indeed Windows manages broadcast quite strangely.
The file to modify is the following: server/services/mi-light/lib/light/light.getBridges.js
The explanations are in the comments.

Awaiting your feedback.

Hi,
Great job!! I am very interested in the development of this service on the V4.
@link39 Could you give us feedback on the status of the service and how color management and brightness will be handled?
I am available if you need testing or user feedback.
Again, well done for the work :clap:t2:

Hello,

Pierre Gilles and Alexandre have given me feedback on the PR. I need to correct a few elements, then I think it will be good to go for production.

Regarding the color and intensity of the light, I haven’t made any progress. On this point, I will follow the movement. When it’s clearer, Pierre Gilles should integrate this into the Philips hue. At that point, I will make changes to the mi light service to be consistent.

This just made me think of something. Since I moved, I’m going to reinstall Gladys (v3).

I noticed in v3 that when it comes to device detection, if you have multiple network interfaces, it doesn’t work.

My case:

  • Domo device on wlan0 (blocked from going online)
  • lan eth0

For detection to work, I had to reboot the pi by disabling eth0 and running the detection by connecting via wlan0.

Do you handle this type of case in your detection?

Hello!
Where is this service?

Hello,

it works, I had a few tests to review. I think I’ve done what was necessary. The PR should be pending.

@pierre-gilles where is this service?

There are several comments from @AlexTrovato and myself on the PR in March 2020, but I think @link39 is no longer available and there have been no changes since.

If anyone has some milight and wants to pick up the torch on the PR :slight_smile: