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

Improves light support #155

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

danielcaceresm
Copy link

I added support to 2 lights I owns:

  • The first one doesn't have colder/warmer commands, it has commands per specific color values. Also, it doesn't have an on command, you just send the brightness and color values and it turns on.
  • The second one, as the first, it doesn't have colder/warmer commands, it has commands per specific color values. Also, it only has a toggle command for on/off.

Example:

{
    "manufacturer": "Sulion",
    "supportedModels": ["Marina S"],
    "supportedController": "ESPHome",
    "commandsEncoding": "Raw",
    "brightness": [26, 51, 77, 102, 128, 153, 179, 204, 230, 255],
    "colorTemperature": [
      2700, 4600, 6500
    ],
    "commands": {
      "off": "",
      "brighten": "",
      "dim": "",
      "colorTemperature": {
        "2700": "",
        "4600": "",
        "6500": ""
      }
    }
  }

Enhancements:

  • Added support for CMD_COLORTEMPERATURE and CMD_BRIGHTNESS commands to control color temperature and brightness, allowing specific commands per brightness or color values instead of up/down steps.
  • Updated async_turn_on method to handle cases where CMD_POWER_ON is not available by setting the last known color temperature and brightness.
  • Updated the async_turn_off method to check the current state before sending the power-off command.

Bug Fixes:

  • Use the delay config value when sending the command.
  • Fix the brightness step calculation to use the correct value

Copy link

@make-all make-all left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

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

Successfully merging this pull request may close these issues.

2 participants