-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat(zigbee): Add Temperature Dimmable Light support #12031
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
base: master
Are you sure you want to change the base?
Conversation
👋 Hello Hannes-Beckmann, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
P-R-O-C-H-Y
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Hannes-Beckmann, thank you for your addition to the Zigbee Library.
I have tested using a HA (ZHA) and a C6 with RGB light and it works as a charm.
I have requested a few changes to make the API as close to the other Light endpoints.
| ############################### | ||
| ZigbeeTemperatureDimmableLight | ||
| ############################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting issue
| ############################### | |
| ZigbeeTemperatureDimmableLight | |
| ############################### | |
| ############################## | |
| ZigbeeTemperatureDimmableLight | |
| ############################## |
| setColorTemperature | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Sets the light color temperature (in mireds). | ||
|
|
||
| .. code-block:: arduino | ||
| bool setColorTemperature(uint16_t mireds); | ||
| * ``mireds`` - Color temperature in mireds (153 = 6500K, 500 = 2000K) | ||
|
|
||
| Returns ``true`` if successful, ``false`` otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to preferred API change
| setColorTemperature | |
| ^^^^^^^^^^^^^^^^^^^ | |
| Sets the light color temperature (in mireds). | |
| .. code-block:: arduino | |
| bool setColorTemperature(uint16_t mireds); | |
| * ``mireds`` - Color temperature in mireds (153 = 6500K, 500 = 2000K) | |
| Returns ``true`` if successful, ``false`` otherwise. | |
| setLightTemperature | |
| ^^^^^^^^^^^^^^^^^^^ | |
| Sets the light color temperature (in mireds). | |
| .. code-block:: arduino | |
| bool setLightTemperature(uint16_t mireds); | |
| * ``mireds`` - Color temperature in mireds (153 = 6500K, 500 = 2000K) | |
| Returns ``true`` if successful, ``false`` otherwise. |
| getColorTemperature | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Gets the current color temperature (in mireds). | ||
|
|
||
| .. code-block:: arduino | ||
| uint16_t getColorTemperature(); | ||
| Returns current color temperature in mireds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| getColorTemperature | |
| ^^^^^^^^^^^^^^^^^^^ | |
| Gets the current color temperature (in mireds). | |
| .. code-block:: arduino | |
| uint16_t getColorTemperature(); | |
| Returns current color temperature in mireds. | |
| getLightTemperature | |
| ^^^^^^^^^^^^^^^^^^^ | |
| Gets the current color temperature (in mireds). | |
| .. code-block:: arduino | |
| uint16_t getLightTemperature(); | |
| Returns current color temperature in mireds. |
|
|
||
| #include "Zigbee.h" | ||
|
|
||
| #define ZIGBEE_TEMP_LIGHT_ENDPOINT 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start from endpoint number 1. No need to be using number 11
| #define ZIGBEE_TEMP_LIGHT_ENDPOINT 11 | |
| #define ZIGBEE_TEMP_LIGHT_ENDPOINT 1 |
| * @brief This example demonstrates Zigbee Temperature Dimmable light bulb. | ||
| * | ||
| * The example demonstrates how to use Zigbee library to create an end device with | ||
| * temperature dimmable light end point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * temperature dimmable light end point. | |
| * temperature dimmable light endpoint. |
| #include "ep/ZigbeeSwitch.h" | ||
| //// Lights | ||
| #include "ep/ZigbeeColorDimmableLight.h" | ||
| #include "ep/ZigbeeTemperatureDimmableLight.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick here, please use Alphabetical order, so place it on last place in Lights group
| bool ZigbeeTemperatureDimmableLight::setColorTemperature(uint16_t mireds) { | ||
| return setLight(_current_state, _current_level, mireds); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the setLightTemperature method name instead.
| bool ZigbeeTemperatureDimmableLight::setColorTemperature(uint16_t mireds) { | |
| return setLight(_current_state, _current_level, mireds); | |
| } | |
| bool ZigbeeTemperatureDimmableLight::setLightTemperature(uint16_t mireds) { | |
| return setLight(_current_state, _current_level, mireds); | |
| } |
|
|
||
| bool setLightState(bool state); | ||
| bool setLightLevel(uint8_t level); | ||
| bool setColorTemperature(uint16_t mireds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the setLightTemperature API name instead
| bool setColorTemperature(uint16_t mireds); | |
| bool setLightTemperature(uint16_t mireds); |
| uint16_t getColorTemperature() { | ||
| return _current_color_temperature; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, will prefer the getLightTemperature instead.
| uint16_t getColorTemperature() { | |
| return _current_color_temperature; | |
| } | |
| uint16_t getLightTemperature() { | |
| return _current_color_temperature; | |
| } |
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit e046998. |
Description of Change
This pull request introduces a new Zigbee Temperature Dimmable Light endpoint.
Test Scenarios
I have tested this Pull Request with pioarduino with the esp32-c6-devkitm-1 board on an ESP32-C6-MINI-1U using the ZHA-Integration in Home Assistant.
The included example is not tested since I do not have access to a board with a built-in RGB-LED.
Note that the minimum and maximum temperature is not respected by Home Assistant. Out of range values are clamped.