mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
esp_matter: Add support for more device types
Also other minor doc changes.
This commit is contained in:
@@ -837,5 +837,41 @@ attribute_t *create_temperature_max_measured_value(cluster_t *cluster, int16_t v
|
||||
} /* attribute */
|
||||
} /* temperature_measurement */
|
||||
|
||||
namespace occupancy_sensing {
|
||||
namespace attribute {
|
||||
|
||||
attribute_t *create_occupancy(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::Occupancy::Id, ATTRIBUTE_FLAG_NONE,
|
||||
esp_matter_bitmap8(value));
|
||||
}
|
||||
|
||||
attribute_t *create_occupancy_sensor_type(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::OccupancySensorType::Id,
|
||||
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
|
||||
}
|
||||
|
||||
attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id,
|
||||
ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value));
|
||||
}
|
||||
|
||||
} /* attribute */
|
||||
} /* occupancy_sensing */
|
||||
|
||||
namespace boolean_state {
|
||||
namespace attribute {
|
||||
|
||||
attribute_t *state_value(cluster_t *cluster, bool value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, BooleanState::Attributes::StateValue::Id, ATTRIBUTE_FLAG_NONE,
|
||||
esp_matter_bool(value));
|
||||
}
|
||||
|
||||
} /* attribute */
|
||||
} /* boolean_state */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -257,5 +257,19 @@ attribute_t *create_temperature_max_measured_value(cluster_t *cluster, int16_t v
|
||||
} /* attribute */
|
||||
} /* temperature_measurement */
|
||||
|
||||
namespace occupancy_sensing {
|
||||
namespace attribute {
|
||||
attribute_t *create_occupancy(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_occupancy_sensor_type(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t value);
|
||||
} /* attribute */
|
||||
} /* occupancy_sensing */
|
||||
|
||||
namespace boolean_state {
|
||||
namespace attribute {
|
||||
attribute_t *state_value(cluster_t *cluster, bool value);
|
||||
} /* attribute */
|
||||
} /* boolean_state */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -1068,5 +1068,67 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
||||
}
|
||||
} /* temperature_measurement */
|
||||
|
||||
namespace occupancy_sensing {
|
||||
const function_generic_t *function_list = NULL;
|
||||
const int function_flags = CLUSTER_FLAG_NONE;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
||||
{
|
||||
cluster_t *cluster = cluster::create(endpoint, OccupancySensing::Id, flags);
|
||||
if (!cluster) {
|
||||
ESP_LOGE(TAG, "Could not create cluster");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (flags & CLUSTER_FLAG_SERVER) {
|
||||
set_plugin_server_init_callback(cluster, MatterOccupancySensingPluginServerInitCallback);
|
||||
add_function_list(cluster, function_list, function_flags);
|
||||
}
|
||||
if (flags & CLUSTER_FLAG_CLIENT) {
|
||||
set_plugin_client_init_callback(cluster, MatterOccupancySensingPluginClientInitCallback);
|
||||
}
|
||||
|
||||
if (flags & CLUSTER_FLAG_SERVER) {
|
||||
/* Attributes not managed internally */
|
||||
global::attribute::create_cluster_revision(cluster, config->cluster_revision);
|
||||
attribute::create_occupancy(cluster, config->occupancy);
|
||||
attribute::create_occupancy_sensor_type(cluster, config->occupancy_sensor_type);
|
||||
attribute::create_occupancy_sensor_type_bitmap(cluster, config->occupancy_sensor_type_bitmap);
|
||||
}
|
||||
|
||||
return cluster;
|
||||
}
|
||||
} /* occupancy_sensing */
|
||||
|
||||
namespace boolean_state {
|
||||
const function_generic_t *function_list = NULL;
|
||||
const int function_flags = CLUSTER_FLAG_NONE;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
||||
{
|
||||
cluster_t *cluster = cluster::create(endpoint, BooleanState::Id, flags);
|
||||
if (!cluster) {
|
||||
ESP_LOGE(TAG, "Could not create cluster");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (flags & CLUSTER_FLAG_SERVER) {
|
||||
set_plugin_server_init_callback(cluster, MatterBooleanStatePluginServerInitCallback);
|
||||
add_function_list(cluster, function_list, function_flags);
|
||||
}
|
||||
if (flags & CLUSTER_FLAG_CLIENT) {
|
||||
set_plugin_client_init_callback(cluster, MatterBooleanStatePluginClientInitCallback);
|
||||
}
|
||||
|
||||
if (flags & CLUSTER_FLAG_SERVER) {
|
||||
/* Attributes not managed internally */
|
||||
global::attribute::create_cluster_revision(cluster, config->cluster_revision);
|
||||
attribute::state_value(cluster, config->state_value);
|
||||
}
|
||||
|
||||
return cluster;
|
||||
}
|
||||
} /* boolean_state */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -313,5 +313,28 @@ typedef struct config {
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* temperature_measurement */
|
||||
|
||||
namespace occupancy_sensing {
|
||||
typedef struct config {
|
||||
uint16_t cluster_revision;
|
||||
uint8_t occupancy;
|
||||
uint8_t occupancy_sensor_type;
|
||||
uint8_t occupancy_sensor_type_bitmap;
|
||||
config() : cluster_revision(3), occupancy(0), occupancy_sensor_type(0),
|
||||
occupancy_sensor_type_bitmap(0) {}
|
||||
} config_t;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* occupancy_sensing */
|
||||
|
||||
namespace boolean_state {
|
||||
typedef struct config {
|
||||
uint16_t cluster_revision;
|
||||
bool state_value;
|
||||
config() : cluster_revision(3), state_value(0) {}
|
||||
} config_t;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* boolean_state */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -34,10 +34,13 @@
|
||||
#define ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010A
|
||||
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010B
|
||||
|
||||
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302
|
||||
#define ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_ID 0x0107
|
||||
#define ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_ID 0x0015
|
||||
|
||||
#define ESP_MATTER_FAN_DEVICE_TYPE_ID 0x002B
|
||||
#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID 0x0301
|
||||
#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID 0x000A
|
||||
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302
|
||||
|
||||
static const char *TAG = "esp_matter_endpoint";
|
||||
|
||||
@@ -483,6 +486,50 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
return endpoint;
|
||||
}
|
||||
} /* temperature_sensor */
|
||||
|
||||
namespace occupancy_sensor {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_OCCUPANCY_SENSOR_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER | CLUSTER_FLAG_CLIENT);
|
||||
occupancy_sensing::create(endpoint, &(config->occupancy_sensing), CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* occupancy_sensor */
|
||||
|
||||
namespace contact_sensor {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_CONTACT_SENSOR_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER | CLUSTER_FLAG_CLIENT);
|
||||
boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* contact_sensor */
|
||||
} /* endpoint */
|
||||
|
||||
namespace node {
|
||||
|
||||
@@ -244,6 +244,27 @@ typedef struct config {
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* temperature_sensor */
|
||||
|
||||
namespace occupancy_sensor {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
occupancy_sensing::config_t occupancy_sensing;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* occupancy_sensor */
|
||||
|
||||
namespace contact_sensor {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
boolean_state::config_t boolean_state;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* contact_sensor */
|
||||
|
||||
} /* endpoint */
|
||||
|
||||
namespace node {
|
||||
|
||||
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 41 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 40 KiB |
+1
-1
@@ -96,7 +96,7 @@ A1.4 Device not crashed but not responding
|
||||
|
||||
My device is not responding to commands:
|
||||
|
||||
- Make sure your device is commissioned successfully and connected is
|
||||
- Make sure your device is commissioned successfully and is connected
|
||||
to the Wi-Fi.
|
||||
- Make sure the node_id and the endpoint_id are correct in the command
|
||||
from chip-tool.
|
||||
|
||||
@@ -49,13 +49,6 @@ In addition, ESP Matter SDK also integrates `ESP RainMaker <https://rainmaker.es
|
||||
|
||||
Espressif's AIoT cloud platform `ESP RainMaker <https://rainmaker.espressif.com/>`__ can provide remote control for Matter devices and enable the Cloud-based device management of Matter devices' massive data resources.
|
||||
|
||||
todo. Add a supported services diagram similar to the one ad the end of this page https://rainmaker.espressif.com/?
|
||||
|
||||
.. figure:: ../_static/supported_services.png
|
||||
:align: center
|
||||
:alt: ESP Matter Supported Services
|
||||
:figclass: align-center
|
||||
|
||||
By combining the above-mentioned Matter hardware and software solutions with ESP RainMaker, this one-stop Matter ecosystem solution provides:
|
||||
|
||||
- Interconnection with Amazon, Google and Apple
|
||||
@@ -112,52 +105,12 @@ These can be used to control other Matter devices.
|
||||
- Touch-screen control panel
|
||||
- Hub with internet connectivity for remote control
|
||||
|
||||
1.3 Examples
|
||||
------------
|
||||
|
||||
1.3.1 Light
|
||||
~~~~~~~~~~~
|
||||
|
||||
This application creates a Color Dimmable Light device using the ESP
|
||||
Matter data model.
|
||||
|
||||
1.3.2 RainMaker Light
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This application creates a Color Dimmable Light device using the ESP
|
||||
Matter data model.
|
||||
|
||||
It also initializes ESP RainMaker which enables Device Management and
|
||||
OTA using the RainMaker cloud. If user node association is done, it also
|
||||
enables Remote Control through RainMaker.
|
||||
|
||||
1.3.3 Light Switch
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This application creates an On/Off Light Switch device using the ESP Matter
|
||||
data model.
|
||||
|
||||
It creates the On/Off client and other devices can be bound to the
|
||||
switch and then controlled from the switch.
|
||||
|
||||
1.3.4 Zap Light
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
This application creates a Color Dimmable Light device using the Zap
|
||||
data model instead of the ESP Matter data model.
|
||||
|
||||
1.3.5 ZigBee Bridge
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This application demonstrates a Matter-ZigBee Bridge that bridges ZigBee devices to Matter fabric.
|
||||
|
||||
1.4 Try it yourself
|
||||
1.3 Try it yourself
|
||||
-------------------
|
||||
|
||||
1.4.1 ESP Launchpad
|
||||
1.3.1 ESP Launchpad
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This allows you to quickly try out Matter on Espressif devices through a web browser.
|
||||
|
||||
|
||||
ESP Launchpad: https://espressif.github.io/esp-launchpad/.
|
||||
|
||||
Reference in New Issue
Block a user