Skip to content

Commit ff5866b

Browse files
SuGliderCopilotme-no-devlucasssvazpre-commit-ci-lite[bot]
authored
feat(matter): adds Arduino Matter Library documentation (#11984)
* feat(matter): adds Arduino Matter Library documentation * fix(matter): title format * fix(matter): fixes SmartButton path Co-authored-by: Copilot <[email protected]> * fix(matter): Fix typo in cooling temperature variable name * fix(matter): Fix typo in parameter name for setCoolingHeatingSetpoints * fix(matter): typo Co-authored-by: Copilot <[email protected]> * fix(matter): typo Co-authored-by: Copilot <[email protected]> * fix(matter): fixes title alligments * fix(matter): examples url * fix(matter): Fix swapped function arguments * fix(matter): Add matter to libraries section * ci(pre-commit): Apply automatic fixes * fix(pre-commit): Fix spelling --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Me No Dev <[email protected]> Co-authored-by: Lucas Saavedra Vaz <[email protected]> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 21ddb09 commit ff5866b

19 files changed

+3213
-10
lines changed

docs/en/libraries.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ The Arduino ESP32 offers some unique APIs, described in this section:
9292

9393
api/*
9494

95+
Matter APIs
96+
-----------
97+
98+
.. toctree::
99+
:maxdepth: 1
100+
:glob:
101+
102+
matter/matter
103+
matter/matter_ep
104+
matter/ep_*
105+
95106
Zigbee APIs
96107
-----------
97108

docs/en/matter/ep_color_light.rst

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
################
2+
MatterColorLight
3+
################
4+
5+
About
6+
-----
7+
8+
The ``MatterColorLight`` class provides a color light endpoint for Matter networks with RGB color control using the HSV color model. This endpoint implements the Matter lighting standard for full-color lighting control.
9+
10+
**Features:**
11+
* On/off control
12+
* RGB color control with HSV color model
13+
* State persistence support
14+
* Callback support for state and color changes
15+
* Integration with Apple HomeKit, Amazon Alexa, and Google Home
16+
* Matter standard compliance
17+
18+
**Use Cases:**
19+
* RGB smart lights
20+
* Color-changing lights
21+
* Mood lighting
22+
* Entertainment lighting control
23+
* Smart home color automation
24+
25+
API Reference
26+
-------------
27+
28+
Constructor
29+
***********
30+
31+
MatterColorLight
32+
^^^^^^^^^^^^^^^^
33+
34+
Creates a new Matter color light endpoint.
35+
36+
.. code-block:: arduino
37+
38+
MatterColorLight();
39+
40+
Initialization
41+
**************
42+
43+
begin
44+
^^^^^
45+
46+
Initializes the Matter color light endpoint with optional initial state and color.
47+
48+
.. code-block:: arduino
49+
50+
bool begin(bool initialState = false, espHsvColor_t colorHSV = {0, 254, 31});
51+
52+
* ``initialState`` - Initial on/off state (default: ``false`` = off)
53+
* ``colorHSV`` - Initial HSV color (default: red 12% intensity HSV(0, 254, 31))
54+
55+
This function will return ``true`` if successful, ``false`` otherwise.
56+
57+
end
58+
^^^
59+
60+
Stops processing Matter light events.
61+
62+
.. code-block:: arduino
63+
64+
void end();
65+
66+
On/Off Control
67+
**************
68+
69+
setOnOff
70+
^^^^^^^^
71+
72+
Sets the on/off state of the light.
73+
74+
.. code-block:: arduino
75+
76+
bool setOnOff(bool newState);
77+
78+
getOnOff
79+
^^^^^^^^
80+
81+
Gets the current on/off state.
82+
83+
.. code-block:: arduino
84+
85+
bool getOnOff();
86+
87+
toggle
88+
^^^^^^
89+
90+
Toggles the on/off state.
91+
92+
.. code-block:: arduino
93+
94+
bool toggle();
95+
96+
Color Control
97+
*************
98+
99+
setColorRGB
100+
^^^^^^^^^^^
101+
102+
Sets the color using RGB values.
103+
104+
.. code-block:: arduino
105+
106+
bool setColorRGB(espRgbColor_t rgbColor);
107+
108+
* ``rgbColor`` - RGB color structure with red, green, and blue values (0-255 each)
109+
110+
getColorRGB
111+
^^^^^^^^^^^
112+
113+
Gets the current color as RGB values.
114+
115+
.. code-block:: arduino
116+
117+
espRgbColor_t getColorRGB();
118+
119+
setColorHSV
120+
^^^^^^^^^^^
121+
122+
Sets the color using HSV values.
123+
124+
.. code-block:: arduino
125+
126+
bool setColorHSV(espHsvColor_t hsvColor);
127+
128+
* ``hsvColor`` - HSV color structure with hue (0-360), saturation (0-254), and value/brightness (0-254)
129+
130+
getColorHSV
131+
^^^^^^^^^^^
132+
133+
Gets the current color as HSV values.
134+
135+
.. code-block:: arduino
136+
137+
espHsvColor_t getColorHSV();
138+
139+
Event Handling
140+
**************
141+
142+
onChange
143+
^^^^^^^^
144+
145+
Sets a callback for when any parameter changes.
146+
147+
.. code-block:: arduino
148+
149+
void onChange(EndPointCB onChangeCB);
150+
151+
The callback signature is:
152+
153+
.. code-block:: arduino
154+
155+
bool onChangeCallback(bool newState, espHsvColor_t newColor);
156+
157+
onChangeOnOff
158+
^^^^^^^^^^^^^
159+
160+
Sets a callback for on/off state changes.
161+
162+
.. code-block:: arduino
163+
164+
void onChangeOnOff(EndPointOnOffCB onChangeCB);
165+
166+
onChangeColorHSV
167+
^^^^^^^^^^^^^^^^
168+
169+
Sets a callback for color changes.
170+
171+
.. code-block:: arduino
172+
173+
void onChangeColorHSV(EndPointRGBColorCB onChangeCB);
174+
175+
updateAccessory
176+
^^^^^^^^^^^^^^^
177+
178+
Updates the physical light state using current Matter internal state.
179+
180+
.. code-block:: arduino
181+
182+
void updateAccessory();
183+
184+
Operators
185+
*********
186+
187+
bool operator
188+
^^^^^^^^^^^^^
189+
190+
Returns current on/off state.
191+
192+
.. code-block:: arduino
193+
194+
operator bool();
195+
196+
Assignment operator
197+
^^^^^^^^^^^^^^^^^^^
198+
199+
Turns light on or off.
200+
201+
.. code-block:: arduino
202+
203+
void operator=(bool state);
204+
205+
Example
206+
-------
207+
208+
Color Light
209+
***********
210+
211+
.. literalinclude:: ../../../libraries/Matter/examples/MatterColorLight/MatterColorLight.ino
212+
:language: arduino

0 commit comments

Comments
 (0)