Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to led_ble custom lights configured by user #34

Open
and7ey opened this issue Nov 1, 2022 · 5 comments
Open

Add to led_ble custom lights configured by user #34

and7ey opened this issue Nov 1, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@and7ey
Copy link

and7ey commented Nov 1, 2022

What is the process to add more lights to led_ble?
For ex., here is the list of commands/characteristics to be used with SP110E controller.
And I would like to add commands for SP107E (it controls the strip, SK6812_RGBW in my case - it could be switched on/off, the color could be changed, the brightness, effects, music/static color modes).

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

Describe the solution you'd like
The ideal solution would be to move light settings/commands from const.py - the user interface should allow to choose ready-for-use settings based on the lamp name (what you have in const.py currently) or user should be able to input all settings manually. In this case I will be able to add SP107E myself.

Additional context
I've tried to add SP107E support based on SP110E component, but it doesn't work since SP110E component uses its own implementation of bluetooth connection. I've tried to modify led_ble component to add support of SP107E, but I am failed with local led_ble installation (File "/config/led_ble/led_ble.py", line 16, in <module> from bleak_retry_connector import (ImportError: cannot import name 'retry_bluetooth_connection_error' from 'bleak_retry_connector' (/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py)).
But it looks for me that I am re-inventing the wheel.

@and7ey and7ey added the enhancement New feature or request label Nov 1, 2022
@bdraco
Copy link
Member

bdraco commented Nov 1, 2022

Can you post details about the protocol to see if it’s a fit for this library?

@and7ey
Copy link
Author

and7ey commented Nov 1, 2022

Hmm, I thought I added it to the post :)

Here is the description of SP110E protocol https://gist.github.com/mbullington/37957501a07ad065b67d4e8d39bfe012?permalink_comment_id=3611593#gistcomment-3611593

and I am working on SP107E protocol reverse engineering currently :) The functionality is the same, just commands are different.

@bdraco
Copy link
Member

bdraco commented Nov 1, 2022

Seems like a good candidate to add as it looks like it follows the same logic as this library.

You'll need to add a new protocol here
https://github.com/Danielhiversen/flux_led/blob/master/flux_led/protocol.py

@and7ey
Copy link
Author

and7ey commented Nov 2, 2022

I've expected more user friendly doc, not PR ;)

How the following code is used?
I've supposed to replace 0xEF0177 with what?

    def construct_state_query(self) -> bytearray:
        """The bytes to send for a query request."""
        return self.construct_message(bytearray([0xEF, 0x01, 0x77]))

there is STATE_COMMAND const at led_ble, why there is another command?

@bdraco
Copy link
Member

bdraco commented Nov 2, 2022

I've expected more user friendly doc, not PR ;)

It would be great if you could write some docs when you finish your PR.

How the following code is used? I've supposed to replace 0xEF0177 with what?

The state query is the bytes to send to get the current state of the device

    def construct_state_query(self) -> bytearray:
        """The bytes to send for a query request."""
        return self.construct_message(bytearray([0xEF, 0x01, 0x77]))

there is STATE_COMMAND const at led_ble, why there is another command?

The code was switched to using the flux_led protocol files at a later point. It might be leftovers that needs to be cleaned up still

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants