Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f7c597

Browse filesBrowse files
committed
feat(matter):replacing code in examples and header files
1 parent 7d465f3 commit 3f7c597
Copy full SHA for 3f7c597

File tree

Expand file treeCollapse file tree

23 files changed

+130
-117
lines changed
Filter options
Expand file treeCollapse file tree

23 files changed

+130
-117
lines changed

‎libraries/Matter/examples/MatterColorLight/MatterColorLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterColorLight/MatterColorLight.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Light Endpoint
2222
MatterColorLight ColorLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & HSV Color state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -43,10 +47,6 @@ bool button_state = false; // false = released | true = pres
4347
const uint32_t debouceTime = 250; // button debouncing time (ms)
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

46-
// WiFi is manually set and started
47-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
48-
const char *password = "your-password"; // Change this to your WiFi password
49-
5050
// Set the RGB LED Light based on the current state of the Color Light
5151
bool setLightState(bool state, espHsvColor_t colorHSV) {
5252

‎libraries/Matter/examples/MatterContactSensor/MatterContactSensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterContactSensor/MatterContactSensor.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
// Matter Contact Sensor Endpoint
3737
MatterContactSensor ContactSensor;
3838

39+
// WiFi is manually set and started
40+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
41+
const char *password = "your-password"; // Change this to your WiFi password
42+
3943
// LED will be used to indicate the Contact Sensor state
4044
// set your board RGB LED pin here
4145
#ifdef RGB_BUILTIN
@@ -48,10 +52,6 @@ const uint8_t ledPin = 2; // Set your pin here if your board has not defined LE
4852
// set your board USER BUTTON pin here - decommissioning and Manual Contact Sensor toggle button
4953
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
5054

51-
// WiFi is manually set and started
52-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
53-
const char *password = "your-password"; // Change this to your WiFi password
54-
5555
// Button control
5656
uint32_t button_time_stamp = 0; // debouncing control
5757
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterDimmableLight/MatterDimmableLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterDimmableLight/MatterDimmableLight.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Dimmable Light Endpoint
2222
MatterDimmableLight DimmableLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & Brightness state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -43,10 +47,6 @@ bool button_state = false; // false = released | true = pres
4347
const uint32_t debouceTime = 250; // button debouncing time (ms)
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

46-
// WiFi is manually set and started
47-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
48-
const char *password = "your-password"; // Change this to your WiFi password
49-
5050
// Set the RGB LED Light based on the current state of the Dimmable Light
5151
bool setLightState(bool state, uint8_t brightness) {
5252
if (state) {

‎libraries/Matter/examples/MatterEnhancedColorLight/MatterEnhancedColorLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterEnhancedColorLight/MatterEnhancedColorLight.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Light Endpoint
2222
MatterEnhancedColorLight EnhancedColorLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// It will use HSV color to control all Matter Attribute Changes
2529
HsvColor_t currentHSVColor = {0, 0, 0};
2630

@@ -46,10 +50,6 @@ bool button_state = false; // false = released | true = pres
4650
const uint32_t debouceTime = 250; // button debouncing time (ms)
4751
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4852

49-
// WiFi is manually set and started
50-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
51-
const char *password = "your-password"; // Change this to your WiFi password
52-
5353
// Set the RGB LED Light based on the current state of the Enhanced Color Light
5454
bool setLightState(bool state, espHsvColor_t colorHSV, uint8_t brighteness, uint16_t temperature_Mireds) {
5555

‎libraries/Matter/examples/MatterFan/MatterFan.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterFan/MatterFan.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
// Fan Endpoint - On/Off control + Speed Percent Control + Fan Modes
2121
MatterFan Fan;
2222

23+
// WiFi is manually set and started
24+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
25+
const char *password = "your-password"; // Change this to your WiFi password
26+
2327
// set your board USER BUTTON pin here - used for toggling On/Off and decommission the Matter Node
2428
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
2529

@@ -41,10 +45,6 @@ const uint8_t dcMotorPin = 2; // Set your pin here if your board has not define
4145
#warning "Do not forget to set the RGB LED pin"
4246
#endif
4347

44-
// WiFi is manually set and started
45-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
46-
const char *password = "your-password"; // Change this to your WiFi password
47-
4848
void fanDCMotorDrive(bool fanState, uint8_t speedPercent) {
4949
// drive the Fan DC motor
5050
if (fanState == false) {

‎libraries/Matter/examples/MatterHumiditySensor/MatterHumiditySensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterHumiditySensor/MatterHumiditySensor.ino
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
// Matter Humidity Sensor Endpoint
2828
MatterHumiditySensor SimulatedHumiditySensor;
2929

30-
// set your board USER BUTTON pin here - decommissioning button
31-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
32-
3330
// WiFi is manually set and started
3431
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
3532
const char *password = "your-password"; // Change this to your WiFi password
3633

34+
// set your board USER BUTTON pin here - decommissioning button
35+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
36+
3737
// Button control - decommision the Matter Node
3838
uint32_t button_time_stamp = 0; // debouncing control
3939
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterMinimum/MatterMinimum.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterMinimum/MatterMinimum.ino
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
// Single On/Off Light Endpoint - at least one per node
2929
MatterOnOffLight OnOffLight;
3030

31+
// WiFi is manually set and started
32+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
33+
const char *password = "your-password"; // Change this to your WiFi password
34+
3135
// Light GPIO that can be controlled by Matter APP
3236
#ifdef LED_BUILTIN
3337
const uint8_t ledPin = LED_BUILTIN;
@@ -44,16 +48,12 @@ bool button_state = false; // false = released | true = pres
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

4650
// Matter Protocol Endpoint (On/OFF Light) Callback
47-
bool matterCB(bool state) {
51+
bool onOffLightCallback(bool state) {
4852
digitalWrite(ledPin, state ? HIGH : LOW);
4953
// This callback must return the success state to Matter core
5054
return true;
5155
}
5256

53-
// WiFi is manually set and started
54-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
55-
const char *password = "your-password"; // Change this to your WiFi password
56-
5757
void setup() {
5858
// Initialize the USER BUTTON (Boot button) that will be used to decommission the Matter Node
5959
pinMode(buttonPin, INPUT_PULLUP);
@@ -71,7 +71,7 @@ void setup() {
7171
OnOffLight.begin();
7272

7373
// Associate a callback to the Matter Controller
74-
OnOffLight.onChange(matterCB);
74+
OnOffLight.onChange(onOffLightCallback);
7575

7676
// Matter beginning - Last step, after all EndPoints are initialized
7777
Matter.begin();

‎libraries/Matter/examples/MatterOccupancySensor/MatterOccupancySensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterOccupancySensor/MatterOccupancySensor.ino
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
// Matter Occupancy Sensor Endpoint
3535
MatterOccupancySensor OccupancySensor;
3636

37-
// set your board USER BUTTON pin here - decommissioning only
38-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
39-
4037
// WiFi is manually set and started
4138
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
4239
const char *password = "your-password"; // Change this to your WiFi password
4340

41+
// set your board USER BUTTON pin here - decommissioning only
42+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
43+
4444
// Button control
4545
uint32_t button_time_stamp = 0; // debouncing control
4646
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterOnOffLight/MatterOnOffLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterOnOffLight/MatterOnOffLight.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <WiFi.h>
1818
#include <Preferences.h>
1919

20+
// WiFi is manually set and started
21+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
22+
const char *password = "your-password"; // Change this to your WiFi password
23+
2024
// List of Matter Endpoints for this Node
2125
// On/Off Light Endpoint
2226
MatterOnOffLight OnOffLight;
@@ -42,10 +46,6 @@ bool button_state = false; // false = released | true = pres
4246
const uint32_t debouceTime = 250; // button debouncing time (ms)
4347
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4448

45-
// WiFi is manually set and started
46-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
47-
const char *password = "your-password"; // Change this to your WiFi password
48-
4949
// Matter Protocol Endpoint Callback
5050
bool setLightOnOff(bool state) {
5151
Serial.printf("User Callback :: New Light State = %s\r\n", state ? "ON" : "OFF");

‎libraries/Matter/examples/MatterOnOffPlugin/MatterOnOffPlugin.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterOnOffPlugin/MatterOnOffPlugin.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// On/Off Plugin Endpoint
2222
MatterOnOffPlugin OnOffPlugin;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -41,10 +45,6 @@ uint32_t button_time_stamp = 0; // debouncing control
4145
bool button_state = false; // false = released | true = pressed
4246
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4347

44-
// WiFi is manually set and started
45-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
46-
const char *password = "your-password"; // Change this to your WiFi password
47-
4848
// Matter Protocol Endpoint Callback
4949
bool setPluginOnOff(bool state) {
5050
Serial.printf("User Callback :: New Plugin State = %s\r\n", state ? "ON" : "OFF");

‎libraries/Matter/examples/MatterPressureSensor/MatterPressureSensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterPressureSensor/MatterPressureSensor.ino
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
// Matter Pressure Sensor Endpoint
2828
MatterPressureSensor SimulatedPressureSensor;
2929

30-
// set your board USER BUTTON pin here - decommissioning button
31-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
32-
3330
// WiFi is manually set and started
3431
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
3532
const char *password = "your-password"; // Change this to your WiFi password
3633

34+
// set your board USER BUTTON pin here - decommissioning button
35+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
36+
3737
// Button control - decommision the Matter Node
3838
uint32_t button_time_stamp = 0; // debouncing control
3939
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterSmartButon/MatterSmartButon.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterSmartButon/MatterSmartButon.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
// Generic Switch Endpoint - works as a smart button with a single click
2121
MatterGenericSwitch SmartButton;
2222

23+
// WiFi is manually set and started
24+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
25+
const char *password = "your-password"; // Change this to your WiFi password
26+
2327
// set your board USER BUTTON pin here
2428
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
2529

@@ -29,10 +33,6 @@ bool button_state = false; // false = released | true = pres
2933
const uint32_t debouceTime = 250; // button debouncing time (ms)
3034
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
3135

32-
// WiFi is manually set and started
33-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
34-
const char *password = "your-password"; // Change this to your WiFi password
35-
3636
void setup() {
3737
// Initialize the USER BUTTON (Boot button) GPIO that will act as a smart button or to decommission the Matter Node
3838
pinMode(buttonPin, INPUT_PULLUP);

‎libraries/Matter/examples/MatterTemperatureLight/MatterTemperatureLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterTemperatureLight/MatterTemperatureLight.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Temperature CW/WW Light Endpoint
2222
MatterColorTemperatureLight CW_WW_Light;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & Brightness state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -44,10 +48,6 @@ bool button_state = false; // false = released | true = pres
4448
const uint32_t debouceTime = 250; // button debouncing time (ms)
4549
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4650

47-
// WiFi is manually set and started
48-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
49-
const char *password = "your-password"; // Change this to your WiFi password
50-
5151
// Set the RGB LED Light based on the current state of the Color Temperature Light
5252
bool setLightState(bool state, uint8_t brightness, uint16_t temperature_Mireds) {
5353

‎libraries/Matter/examples/MatterTemperatureSensor/MatterTemperatureSensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterTemperatureSensor/MatterTemperatureSensor.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
// Matter Temperature Sensor Endpoint
2828
MatterTemperatureSensor SimulatedTemperatureSensor;
2929

30+
// WiFi is manually set and started
31+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
32+
const char *password = "your-password"; // Change this to your WiFi password
33+
3034
// set your board USER BUTTON pin here - decommissioning button
3135
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
3236

@@ -35,10 +39,6 @@ uint32_t button_time_stamp = 0; // debouncing control
3539
bool button_state = false; // false = released | true = pressed
3640
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
3741

38-
// WiFi is manually set and started
39-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
40-
const char *password = "your-password"; // Change this to your WiFi password
41-
4242
// Simulate a temperature sensor - add your preferred temperature sensor library code here
4343
float getSimulatedTemperature() {
4444
// The Endpoint implementation keeps an int16_t as internal value information,

‎libraries/Matter/src/MatterEndpoints/MatterColorLight.h

Copy file name to clipboardExpand all lines: libraries/Matter/src/MatterEndpoints/MatterColorLight.h
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ class MatterColorLight : public MatterEndPoint {
3737
bool setColorHSV(espHsvColor_t hsvColor); // returns true if successful
3838
espHsvColor_t getColorHSV(); // returns current HSV Color
3939

40-
// used to update the state of the light using the current Matter Light internal state
41-
// It is necessary to set a user callback function using onChange() to handle the physical light state
42-
void updateAccessory();
43-
44-
operator bool(); // returns current on/off light state
45-
void operator=(bool state); // turns light on or off
46-
47-
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
48-
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
49-
5040
// User Callback for whenever the Light On/Off state is changed by the Matter Controller
5141
using EndPointOnOffCB = std::function<bool(bool)>;
5242
void onChangeOnOff(EndPointOnOffCB onChangeCB) {
@@ -64,6 +54,16 @@ class MatterColorLight : public MatterEndPoint {
6454
_onChangeCB = onChangeCB;
6555
}
6656

57+
// used to update the state of the light using the current Matter Light internal state
58+
// It is necessary to set a user callback function using onChange() to handle the physical light state
59+
void updateAccessory();
60+
61+
operator bool(); // returns current on/off light state
62+
void operator=(bool state); // turns light on or off
63+
64+
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
65+
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
66+
6767
protected:
6868
bool started = false;
6969
bool onOffState = false; // default initial state is off, but it can be changed by begin(bool)

‎libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.h

Copy file name to clipboardExpand all lines: libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.h
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,6 @@ class MatterColorTemperatureLight : public MatterEndPoint {
4242
bool setColorTemperature(uint16_t newTemperature); // returns true if successful
4343
uint16_t getColorTemperature(); // returns current temperature
4444

45-
// used to update the state of the light using the current Matter Light internal state
46-
// It is necessary to set a user callback function using onChange() to handle the physical light state
47-
void updateAccessory();
48-
49-
operator bool(); // returns current on/off light state
50-
void operator=(bool state); // turns light on or off
51-
52-
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
53-
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
54-
5545
// User Callback for whenever the Light On/Off state is changed by the Matter Controller
5646
using EndPointOnOffCB = std::function<bool(bool)>;
5747
void onChangeOnOff(EndPointOnOffCB onChangeCB) {
@@ -76,6 +66,16 @@ class MatterColorTemperatureLight : public MatterEndPoint {
7666
_onChangeCB = onChangeCB;
7767
}
7868

69+
// used to update the state of the light using the current Matter Light internal state
70+
// It is necessary to set a user callback function using onChange() to handle the physical light state
71+
void updateAccessory();
72+
73+
operator bool(); // returns current on/off light state
74+
void operator=(bool state); // turns light on or off
75+
76+
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
77+
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
78+
7979
protected:
8080
bool started = false;
8181
bool onOffState = false; // default initial state is off, but it can be changed by begin(bool)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.