ci(pre-commit): Apply automatic fixes
This commit is contained in:
parent
6bc971c1a3
commit
b6d0553fa5
13 changed files with 70 additions and 81 deletions
|
|
@ -81,7 +81,7 @@ void loop() {
|
|||
// Read carbon dioxide sensor every 2s
|
||||
if (!(timeCounter++ % 20)) { // delaying for 100ms x 20 = 2s
|
||||
// Read sensor value - here is chip temperature used + 300 as a dummy value for demonstration
|
||||
uint16_t carbon_dioxide_value = 300+(uint16_t)temperatureRead();
|
||||
uint16_t carbon_dioxide_value = 300 + (uint16_t)temperatureRead();
|
||||
Serial.printf("Updating carbon dioxide sensor value to %d ppm\r\n", carbon_dioxide_value);
|
||||
zbCarbonDioxideSensor.setCarbonDioxide(carbon_dioxide_value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void setup() {
|
|||
void loop() {
|
||||
// Checking PIR sensor for occupancy change
|
||||
static bool occupancy = false;
|
||||
if(digitalRead(sensor_pin) == HIGH && !occupancy) {
|
||||
if (digitalRead(sensor_pin) == HIGH && !occupancy) {
|
||||
// Update occupancy sensor value
|
||||
zbOccupancySensor.setOccupancy(true);
|
||||
zbOccupancySensor.report();
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void loop() {
|
|||
// Read flow and pressure sensors every 2s
|
||||
if (!(timeCounter++ % 20)) { // delaying for 100ms x 20 = 2s
|
||||
float flow_value = temperatureRead();
|
||||
uint16_t pressure_value = (uint16_t)temperatureRead()*100; //*100 for demonstration so the value is in 1000-3000hPa
|
||||
uint16_t pressure_value = (uint16_t)temperatureRead() * 100; //*100 for demonstration so the value is in 1000-3000hPa
|
||||
Serial.printf("Updating flow sensor value to %.2f m3/h\r\n", flow_value);
|
||||
zbFlowSensor.setFlow(flow_value);
|
||||
Serial.printf("Updating pressure sensor value to %d hPa\r\n", pressure_value);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
#include "ZigbeeCarbonDioxideSensor.h"
|
||||
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
|
||||
|
||||
esp_zb_cluster_list_t *zigbee_carbon_dioxide_sensor_clusters_create(zigbee_carbon_dioxide_sensor_cfg_t *carbon_dioxide_sensor)
|
||||
{
|
||||
esp_zb_cluster_list_t *zigbee_carbon_dioxide_sensor_clusters_create(zigbee_carbon_dioxide_sensor_cfg_t *carbon_dioxide_sensor) {
|
||||
esp_zb_basic_cluster_cfg_t *basic_cfg = carbon_dioxide_sensor ? &(carbon_dioxide_sensor->basic_cfg) : NULL;
|
||||
esp_zb_identify_cluster_cfg_t *identify_cfg = carbon_dioxide_sensor ? &(carbon_dioxide_sensor->identify_cfg) : NULL;
|
||||
esp_zb_carbon_dioxide_measurement_cluster_cfg_t *carbon_dioxide_meas_cfg = carbon_dioxide_sensor ? &(carbon_dioxide_sensor->carbon_dioxide_meas_cfg) : NULL;
|
||||
esp_zb_cluster_list_t *cluster_list = esp_zb_zcl_cluster_list_create();
|
||||
esp_zb_cluster_list_add_basic_cluster(cluster_list, esp_zb_basic_cluster_create(basic_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
|
||||
esp_zb_cluster_list_add_identify_cluster(cluster_list, esp_zb_identify_cluster_create(identify_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
|
||||
esp_zb_cluster_list_add_carbon_dioxide_measurement_cluster(cluster_list, esp_zb_carbon_dioxide_measurement_cluster_create(carbon_dioxide_meas_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
|
||||
esp_zb_cluster_list_add_carbon_dioxide_measurement_cluster(
|
||||
cluster_list, esp_zb_carbon_dioxide_measurement_cluster_create(carbon_dioxide_meas_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE
|
||||
);
|
||||
esp_zb_cluster_list_add_identify_cluster(cluster_list, esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_IDENTIFY), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
|
||||
return cluster_list;
|
||||
}
|
||||
|
|
@ -21,14 +22,12 @@ ZigbeeCarbonDioxideSensor::ZigbeeCarbonDioxideSensor(uint8_t endpoint) : ZigbeeE
|
|||
zigbee_carbon_dioxide_sensor_cfg_t carbon_dioxide_sensor_cfg = ZIGBEE_DEFAULT_CARBON_DIOXIDE_SENSOR_CONFIG();
|
||||
_cluster_list = zigbee_carbon_dioxide_sensor_clusters_create(&carbon_dioxide_sensor_cfg);
|
||||
|
||||
_ep_config = {
|
||||
.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0
|
||||
};
|
||||
_ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0};
|
||||
}
|
||||
|
||||
void ZigbeeCarbonDioxideSensor::setMinMaxValue(float min, float max) {
|
||||
float zb_min = min/1000000.0f;
|
||||
float zb_max = max/1000000.0f;
|
||||
float zb_min = min / 1000000.0f;
|
||||
float zb_max = max / 1000000.0f;
|
||||
esp_zb_attribute_list_t *carbon_dioxide_measure_cluster =
|
||||
esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
|
||||
esp_zb_cluster_update_attr(carbon_dioxide_measure_cluster, ESP_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID, (void *)&zb_min);
|
||||
|
|
@ -36,14 +35,14 @@ void ZigbeeCarbonDioxideSensor::setMinMaxValue(float min, float max) {
|
|||
}
|
||||
|
||||
void ZigbeeCarbonDioxideSensor::setTolerance(float tolerance) {
|
||||
float zb_tolerance = tolerance/1000000.0f;
|
||||
float zb_tolerance = tolerance / 1000000.0f;
|
||||
esp_zb_attribute_list_t *carbon_dioxide_measure_cluster =
|
||||
esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
|
||||
esp_zb_temperature_meas_cluster_add_attr(carbon_dioxide_measure_cluster, ESP_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID, (void *)&zb_tolerance);
|
||||
}
|
||||
|
||||
void ZigbeeCarbonDioxideSensor::setReporting(uint16_t min_interval, uint16_t max_interval, uint16_t delta) {
|
||||
if(delta > 0) {
|
||||
if (delta > 0) {
|
||||
log_e("Delta reporting is currently not supported by the carbon dioxide sensor");
|
||||
}
|
||||
// clang-format off
|
||||
|
|
@ -80,13 +79,14 @@ void ZigbeeCarbonDioxideSensor::setReporting(uint16_t min_interval, uint16_t max
|
|||
}
|
||||
|
||||
void ZigbeeCarbonDioxideSensor::setCarbonDioxide(float carbon_dioxide) {
|
||||
float zb_carbon_dioxide = carbon_dioxide/1000000.0f;
|
||||
float zb_carbon_dioxide = carbon_dioxide / 1000000.0f;
|
||||
log_v("Updating carbon dioxide sensor value...");
|
||||
/* Update carbon dioxide sensor measured value */
|
||||
log_d("Setting carbon dioxide to %0.1f", carbon_dioxide);
|
||||
esp_zb_lock_acquire(portMAX_DELAY);
|
||||
esp_zb_zcl_set_attribute_val(
|
||||
_endpoint, ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID, &zb_carbon_dioxide, false
|
||||
_endpoint, ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID,
|
||||
&zb_carbon_dioxide, false
|
||||
);
|
||||
esp_zb_lock_release();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include "ZigbeeFlowSensor.h"
|
||||
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
|
||||
|
||||
esp_zb_cluster_list_t *zigbee_flow_sensor_clusters_create(zigbee_flow_sensor_cfg_t *flow_sensor)
|
||||
{
|
||||
esp_zb_cluster_list_t *zigbee_flow_sensor_clusters_create(zigbee_flow_sensor_cfg_t *flow_sensor) {
|
||||
esp_zb_basic_cluster_cfg_t *basic_cfg = flow_sensor ? &(flow_sensor->basic_cfg) : NULL;
|
||||
esp_zb_identify_cluster_cfg_t *identify_cfg = flow_sensor ? &(flow_sensor->identify_cfg) : NULL;
|
||||
esp_zb_flow_meas_cluster_cfg_t *flow_meas_cfg = flow_sensor ? &(flow_sensor->flow_meas_cfg) : NULL;
|
||||
|
|
@ -21,9 +20,7 @@ ZigbeeFlowSensor::ZigbeeFlowSensor(uint8_t endpoint) : ZigbeeEP(endpoint) {
|
|||
zigbee_flow_sensor_cfg_t flow_sensor_cfg = ZIGBEE_DEFAULT_FLOW_SENSOR_CONFIG();
|
||||
_cluster_list = zigbee_flow_sensor_clusters_create(&flow_sensor_cfg);
|
||||
|
||||
_ep_config = {
|
||||
.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0
|
||||
};
|
||||
_ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0};
|
||||
}
|
||||
|
||||
void ZigbeeFlowSensor::setMinMaxValue(float min, float max) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include "ZigbeeOccupancySensor.h"
|
||||
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
|
||||
|
||||
esp_zb_cluster_list_t *zigbee_occupancy_sensor_clusters_create(zigbee_occupancy_sensor_cfg_t *occupancy_sensor)
|
||||
{
|
||||
esp_zb_cluster_list_t *zigbee_occupancy_sensor_clusters_create(zigbee_occupancy_sensor_cfg_t *occupancy_sensor) {
|
||||
esp_zb_basic_cluster_cfg_t *basic_cfg = occupancy_sensor ? &(occupancy_sensor->basic_cfg) : NULL;
|
||||
esp_zb_identify_cluster_cfg_t *identify_cfg = occupancy_sensor ? &(occupancy_sensor->identify_cfg) : NULL;
|
||||
esp_zb_occupancy_sensing_cluster_cfg_t *occupancy_meas_cfg = occupancy_sensor ? &(occupancy_sensor->occupancy_meas_cfg) : NULL;
|
||||
|
|
@ -21,9 +20,7 @@ ZigbeeOccupancySensor::ZigbeeOccupancySensor(uint8_t endpoint) : ZigbeeEP(endpoi
|
|||
zigbee_occupancy_sensor_cfg_t occupancy_sensor_cfg = ZIGBEE_DEFAULT_OCCUPANCY_SENSOR_CONFIG();
|
||||
_cluster_list = zigbee_occupancy_sensor_clusters_create(&occupancy_sensor_cfg);
|
||||
|
||||
_ep_config = {
|
||||
.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0
|
||||
};
|
||||
_ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0};
|
||||
}
|
||||
|
||||
void ZigbeeOccupancySensor::setSensorType(uint8_t sensor_type) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include "ZigbeePressureSensor.h"
|
||||
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
|
||||
|
||||
esp_zb_cluster_list_t *zigbee_pressure_sensor_clusters_create(zigbee_pressure_sensor_cfg_t *pressure_sensor)
|
||||
{
|
||||
esp_zb_cluster_list_t *zigbee_pressure_sensor_clusters_create(zigbee_pressure_sensor_cfg_t *pressure_sensor) {
|
||||
esp_zb_basic_cluster_cfg_t *basic_cfg = pressure_sensor ? &(pressure_sensor->basic_cfg) : NULL;
|
||||
esp_zb_identify_cluster_cfg_t *identify_cfg = pressure_sensor ? &(pressure_sensor->identify_cfg) : NULL;
|
||||
esp_zb_pressure_meas_cluster_cfg_t *pressure_meas_cfg = pressure_sensor ? &(pressure_sensor->pressure_meas_cfg) : NULL;
|
||||
|
|
@ -21,9 +20,7 @@ ZigbeePressureSensor::ZigbeePressureSensor(uint8_t endpoint) : ZigbeeEP(endpoint
|
|||
zigbee_pressure_sensor_cfg_t presssure_sensor_cfg = ZIGBEE_DEFAULT_PRESSURE_SENSOR_CONFIG();
|
||||
_cluster_list = zigbee_pressure_sensor_clusters_create(&presssure_sensor_cfg);
|
||||
|
||||
_ep_config = {
|
||||
.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0
|
||||
};
|
||||
_ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0};
|
||||
}
|
||||
|
||||
void ZigbeePressureSensor::setMinMaxValue(int16_t min, int16_t max) {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ public:
|
|||
|
||||
private:
|
||||
bool _humidity_sensor;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
|
||||
|
|
|
|||
Loading…
Reference in a new issue