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

Support for light devices #997

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

Conversation

make-all
Copy link

@make-all make-all commented Jan 3, 2023

This PR adds support for lights with IR or RF remote controls.

Support for color temperature and brightness control is provided, with the assumption that each function is driven by "up" and "down" commands. When color temperature or brightness is set to the end of the range, more commands than necessary are deliberately issued to attempt to resync the light in case the remote has been used.

Initial configuration is for an Iris Ohyama dome ceiling light sold in Japan. In addition to the 10 step brightness and color temperature controls, this light also contains a nightlight, which is turned on by setting brightness to 1 (0.4%, which cannot be mistakenly selected in the UI, as that only goes down to 1%). It also contains a memory feature, which is used to have better control over the turn-on brightness and color temperature, and an off timer feature which is not implemented here.

Note: The icon may be using a slightly different font than the others, and should probably be redone by someone who knowss the details of how the others were made to be consistent.

Required HA version was updated from 2022.4 to 2022.5 to get COLOR_TEMP_KELVIN support, as mireds were deprecated in 2022.11, so any new light implementation should use Kelvin.

@fran122157
Copy link

Any news for this PR?? Would be nice to be able to add lights through SmartIR

@PGayol
Copy link

PGayol commented Apr 26, 2023

Hi! Any chance of this PR to be marged into main? Would be a great addition. Thanks!

@make-all
Copy link
Author

This PR will address #939 also

@make-all make-all mentioned this pull request Nov 7, 2023
Supports commands for on/off, brighten/dim, colder/warmer and night.
Start with a configuration for an Iris Ohyama light.
Total steps is 10 (5 in each direction from "centre"), not 5.
- Save the previous value in closest_match so we can judge whether it was
  closer than the higher value.
- There are various cases where we support brightness, so use a separate variable to track that
- Add some debug logging to changes
- Don't fallback to the "on" command when we got a brightness or color temperature but decided it was the same step we are on, so didn't do anything.
The remote has "Full" (full brightness, mid color temp), "Night" (nightlight)
and "Memory recall" buttons for turning on, and a "Memory set" button for
saving the current brightness and color temp in memory.

- Use the "Memory save" before the "off" command to save as we turn off.
- Use "Memory recall" rather than "Full" for turning on.
When using this with Adaptive lighting, during the day the light keeps beeping due to reaching the end of its range every 90s.
This is because Adaptive lighting is trying to adjust the brightness and color temperature, but they are not actually moving because of the limited number of steps.
Putting the resync code inside the condition that we actually need to move the brightness should prevent this, and only resync when we are actually changing to the end of the range.
@V4n1X
Copy link

V4n1X commented May 12, 2024

Still waiting for the merge, would be great to see this PR in the next release :)

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.

4 participants