diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.56k stars 279 forks source link

MiLight FUT091/b2 remote #861

Open mostorer opened 1 year ago

mostorer commented 1 year ago

Is your feature request related to a problem? Please describe.

Trying to emulate a MiLight remote to pilot a sidoh/esp8266_milight_hub I have found that the specific remote I've been using is not within the list. Currently esp8266_milight_hub supports it, so if I call the API passing FUT091 as remote all is working, but diyHue currently does not permit to choose that remote type.

Describe the feature that you would like to be added

It would be great to have within the list of emulated remotes also FUT091/b2.

Describe alternatives you've considered

As the difference from a CCT remote is only due to the label passed within the API call, I'm thinking about using nodered in the middle to change that value. I have also the json and json.map chunks where remotes list is, added the FUT091 label as a new choice and launched diyHue (without dockerizing it) and it works like a charm, but I'm not sure directly editing those files is the right way to do the things. In case someone can suggest me the right way to manage webUI changes, I could apply them on a fork and post a Pull request after a full test.

Describe your use case for this feature Using Hue app and Alexa to manage MiLight led strips controllers, maintaining the use of the FUT091 remote already configured and in use in my home.

Checklist

Additional context

n/a

mariusmotea commented 1 year ago

Can you provide some api examples. I don't use anymore this implementation? The protocol file that generate the api request is located here https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/lights/protocols/milight.py

GitHub
diyHue/milight.py at master · diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
mostorer commented 1 year ago

Can you provide some api examples. I don't use anymore this implementation? The protocol file that generate the api request is located here https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/lights/protocols/milight.py

GitHubdiyHue/milight.py at master · diyhue/diyHueMain diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.

Sure. In current implementation I configured a MiLight Light choosing a CCT remote with address 0x3499 group 4, and the generated URL is:

http://192.168.x.y/gateways/0x3499/CCT/4 As the physical remote I have is a FUT091, nothing happens with the light.

Changing the ui json and json.map where the dropdown with remote types are, I added the FUT091 type, and I have been able to have a generated URL like this:

http://192.168.x.y/gateways/0x3499/fut091/4 This way, the light correctly switch on or off based on the json paylod.

Looking at the python module you point-out, we are talking about the line 10 within the code: url = "http://" + light.protocol_cfg["ip"] + "/gateways/" + light.protocol_cfg["miID"] + "/" + light.protocol_cfg["miModes"] + "/" + str(light.protocol_cfg["miGroups"])

The problem is not within the code, but there is no way (in current Master version) to have the needed remote type in "miModes".

mariusmotea commented 1 year ago

But you can manually change miModes value in lights.yaml to anything you want. Is that not enough?

mostorer commented 1 year ago

But you can manually change miModes value in lights.yaml to anything you want. Is that not enough?

Yes, it could. Where can I find lights.yaml ? Not found within the repository.

mariusmotea commented 1 year ago

Diyhue store the configuration in multiple yaml files. For lights it is lights.yaml. If you use docker check the path mounted inside the container. If you use host install check /opt/hue-emulator/config/lights.yaml.

mostorer commented 1 year ago

So, what I have done is:

This way all is working, as the API URL contains the new remote label. I would say ... quick and dirty.

It would be great for the future to have available "Light Mode" aligned to remote types supported within esp8266_milight_hub but, in any case, what you suggested me is working.

Thank you so much.