From f0cb1bb5f85ff6b6e62756ab888fec081f416584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:57:21 +0100 Subject: [PATCH 1/7] fix(zigbee): Remove the need of native ieee802154 radio --- libraries/Zigbee/src/ZigbeeCore.cpp | 4 ++-- libraries/Zigbee/src/ZigbeeCore.h | 4 ++-- libraries/Zigbee/src/ZigbeeEP.cpp | 4 ++-- libraries/Zigbee/src/ZigbeeEP.h | 4 ++-- libraries/Zigbee/src/ZigbeeHandlers.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeAnalog.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeAnalog.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeContactSwitch.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp | 2 +- libraries/Zigbee/src/ep/ZigbeeDimmableLight.h | 2 +- libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeFlowSensor.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeLight.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeLight.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeOccupancySensor.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeePressureSensor.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeRangeExtender.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeSwitch.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeSwitch.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeTempSensor.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeThermostat.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeThermostat.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeVibrationSensor.h | 4 ++-- libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp | 4 ++-- libraries/Zigbee/src/ep/ZigbeeWindowCovering.h | 4 ++-- 39 files changed, 76 insertions(+), 76 deletions(-) diff --git a/libraries/Zigbee/src/ZigbeeCore.cpp b/libraries/Zigbee/src/ZigbeeCore.cpp index 19f4d0872b8..0fad546bb15 100644 --- a/libraries/Zigbee/src/ZigbeeCore.cpp +++ b/libraries/Zigbee/src/ZigbeeCore.cpp @@ -1,7 +1,7 @@ /* Zigbee Core Functions */ #include "ZigbeeCore.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeHandlers.cpp" #include "Arduino.h" @@ -526,4 +526,4 @@ const char *ZigbeeCore::getDeviceTypeString(esp_zb_ha_standard_devices_t deviceI ZigbeeCore Zigbee = ZigbeeCore(); -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ZigbeeCore.h b/libraries/Zigbee/src/ZigbeeCore.h index 02dce54e5ff..1d6e32babe0 100644 --- a/libraries/Zigbee/src/ZigbeeCore.h +++ b/libraries/Zigbee/src/ZigbeeCore.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "esp_zigbee_core.h" #include "zdo/esp_zigbee_zdo_common.h" @@ -144,4 +144,4 @@ class ZigbeeCore { extern ZigbeeCore Zigbee; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ZigbeeEP.cpp b/libraries/Zigbee/src/ZigbeeEP.cpp index f3f890393eb..8320215707b 100644 --- a/libraries/Zigbee/src/ZigbeeEP.cpp +++ b/libraries/Zigbee/src/ZigbeeEP.cpp @@ -2,7 +2,7 @@ #include "ZigbeeEP.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "esp_zigbee_cluster.h" #include "zcl/esp_zigbee_zcl_power_config.h" @@ -431,4 +431,4 @@ void ZigbeeEP::requestOTAUpdate() { esp_zb_lock_release(); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ZigbeeEP.h b/libraries/Zigbee/src/ZigbeeEP.h index 3bdd7f22b23..14b9ff61040 100644 --- a/libraries/Zigbee/src/ZigbeeEP.h +++ b/libraries/Zigbee/src/ZigbeeEP.h @@ -3,7 +3,7 @@ #pragma once #include "ZigbeeCore.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include #include @@ -157,4 +157,4 @@ class ZigbeeEP { friend class ZigbeeCore; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ZigbeeHandlers.cpp b/libraries/Zigbee/src/ZigbeeHandlers.cpp index 3af1b6c52aa..eeeb1e8013a 100644 --- a/libraries/Zigbee/src/ZigbeeHandlers.cpp +++ b/libraries/Zigbee/src/ZigbeeHandlers.cpp @@ -2,7 +2,7 @@ #include "ZigbeeCore.h" #include "Arduino.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "esp_ota_ops.h" #if CONFIG_ZB_DELTA_OTA // Delta OTA, code is prepared for this feature but not enabled by default @@ -397,4 +397,4 @@ static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_m return ESP_OK; } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeAnalog.cpp b/libraries/Zigbee/src/ep/ZigbeeAnalog.cpp index 25c199b345b..9d1b53fd310 100644 --- a/libraries/Zigbee/src/ep/ZigbeeAnalog.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeAnalog.cpp @@ -1,5 +1,5 @@ #include "ZigbeeAnalog.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED esp_zb_cluster_list_t *zigbee_analog_clusters_create(zigbee_analog_cfg_t *analog_sensor) { esp_zb_basic_cluster_cfg_t *basic_cfg = analog_sensor ? &(analog_sensor->basic_cfg) : NULL; @@ -121,4 +121,4 @@ void ZigbeeAnalog::setAnalogInputReporting(uint16_t min_interval, uint16_t max_i esp_zb_lock_release(); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeAnalog.h b/libraries/Zigbee/src/ep/ZigbeeAnalog.h index e3b22594324..8993c6ea1a4 100644 --- a/libraries/Zigbee/src/ep/ZigbeeAnalog.h +++ b/libraries/Zigbee/src/ep/ZigbeeAnalog.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -73,4 +73,4 @@ class ZigbeeAnalog : public ZigbeeEP { uint8_t _analog_clusters; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp b/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp index ad351f1a75d..15e13d04d7e 100644 --- a/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp @@ -1,5 +1,5 @@ #include "ZigbeeCarbonDioxideSensor.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if 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_basic_cluster_cfg_t *basic_cfg = carbon_dioxide_sensor ? &(carbon_dioxide_sensor->basic_cfg) : NULL; @@ -90,4 +90,4 @@ void ZigbeeCarbonDioxideSensor::report() { log_v("Carbon dioxide report sent"); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.h b/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.h index 7744fd02f00..41a9a4fb355 100644 --- a/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.h +++ b/libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -58,4 +58,4 @@ class ZigbeeCarbonDioxideSensor : public ZigbeeEP { void report(); }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp b/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp index 7ffd6976e1f..585b1549816 100644 --- a/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp @@ -1,5 +1,5 @@ #include "ZigbeeColorDimmableLight.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED ZigbeeColorDimmableLight::ZigbeeColorDimmableLight(uint8_t endpoint) : ZigbeeEP(endpoint) { _device_id = ESP_ZB_HA_COLOR_DIMMABLE_LIGHT_DEVICE_ID; @@ -177,4 +177,4 @@ void ZigbeeColorDimmableLight::setLightColor(espHsvColor_t hsv_color) { setLight(_current_state, _current_level, rgb_color.r, rgb_color.g, rgb_color.b); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h b/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h index 265fec1b37c..64df3565793 100644 --- a/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h +++ b/libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -105,4 +105,4 @@ class ZigbeeColorDimmableLight : public ZigbeeEP { espRgbColor_t _current_color; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp b/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp index 7bdd8b8ad6a..68f287153cb 100644 --- a/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp @@ -1,5 +1,5 @@ #include "ZigbeeColorDimmerSwitch.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED // Initialize the static instance pointer ZigbeeColorDimmerSwitch *ZigbeeColorDimmerSwitch::_instance = nullptr; @@ -481,4 +481,4 @@ void ZigbeeColorDimmerSwitch::setLightColor(uint8_t red, uint8_t green, uint8_t } } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h b/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h index ca67fb4ba62..dbe50a20230 100644 --- a/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h +++ b/libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -55,4 +55,4 @@ class ZigbeeColorDimmerSwitch : public ZigbeeEP { void calculateXY(uint8_t red, uint8_t green, uint8_t blue, uint16_t &x, uint16_t &y); }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp b/libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp index 9a3551b0581..6237315d5d9 100644 --- a/libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp @@ -1,5 +1,5 @@ #include "ZigbeeContactSwitch.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED esp_zb_cluster_list_t *zigbee_contact_switch_clusters_create(zigbee_contact_switch_cfg_t *contact_switch) { esp_zb_basic_cluster_cfg_t *basic_cfg = contact_switch ? &(contact_switch->basic_cfg) : NULL; @@ -93,4 +93,4 @@ void ZigbeeContactSwitch::zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_enro } } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeContactSwitch.h b/libraries/Zigbee/src/ep/ZigbeeContactSwitch.h index 692caf092ba..f44ce1cec40 100644 --- a/libraries/Zigbee/src/ep/ZigbeeContactSwitch.h +++ b/libraries/Zigbee/src/ep/ZigbeeContactSwitch.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -64,4 +64,4 @@ class ZigbeeContactSwitch : public ZigbeeEP { uint8_t _ias_cie_endpoint; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp index 00d3aac3752..34622d1d2db 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp @@ -1,6 +1,6 @@ #include "ZigbeeDimmableLight.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "esp_zigbee_cluster.h" diff --git a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h index 6f92c3315e4..45c3e97c00b 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h +++ b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" diff --git a/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp b/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp index 364b3ef6d9d..70008fbab10 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp @@ -1,5 +1,5 @@ #include "ZigbeeDoorWindowHandle.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED esp_zb_cluster_list_t *zigbee_door_window_handle_clusters_create(zigbee_door_window_handle_cfg_t *door_window_handle) { esp_zb_basic_cluster_cfg_t *basic_cfg = door_window_handle ? &(door_window_handle->basic_cfg) : NULL; @@ -105,4 +105,4 @@ void ZigbeeDoorWindowHandle::zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_e } } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.h b/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.h index e60316f8764..8d4eff9e45a 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.h +++ b/libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -68,4 +68,4 @@ class ZigbeeDoorWindowHandle : public ZigbeeEP { uint8_t _ias_cie_endpoint; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp b/libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp index 36d66840967..d8fea88342e 100644 --- a/libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp @@ -1,5 +1,5 @@ #include "ZigbeeFlowSensor.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED 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; @@ -86,4 +86,4 @@ void ZigbeeFlowSensor::report() { log_v("Flow report sent"); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeFlowSensor.h b/libraries/Zigbee/src/ep/ZigbeeFlowSensor.h index 7d5ec26f7ec..5e9e20e4d1a 100644 --- a/libraries/Zigbee/src/ep/ZigbeeFlowSensor.h +++ b/libraries/Zigbee/src/ep/ZigbeeFlowSensor.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -57,4 +57,4 @@ class ZigbeeFlowSensor : public ZigbeeEP { void report(); }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeLight.cpp b/libraries/Zigbee/src/ep/ZigbeeLight.cpp index 100efe34a86..2a87db71287 100644 --- a/libraries/Zigbee/src/ep/ZigbeeLight.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeLight.cpp @@ -1,5 +1,5 @@ #include "ZigbeeLight.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED ZigbeeLight::ZigbeeLight(uint8_t endpoint) : ZigbeeEP(endpoint) { _device_id = ESP_ZB_HA_ON_OFF_LIGHT_DEVICE_ID; @@ -46,4 +46,4 @@ void ZigbeeLight::setLight(bool state) { esp_zb_lock_release(); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeLight.h b/libraries/Zigbee/src/ep/ZigbeeLight.h index 8cf8c35f781..807802be9b3 100644 --- a/libraries/Zigbee/src/ep/ZigbeeLight.h +++ b/libraries/Zigbee/src/ep/ZigbeeLight.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -38,4 +38,4 @@ class ZigbeeLight : public ZigbeeEP { bool _current_state; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp b/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp index dec7910ac03..830e4397137 100644 --- a/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp @@ -1,5 +1,5 @@ #include "ZigbeeOccupancySensor.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED 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; @@ -56,4 +56,4 @@ void ZigbeeOccupancySensor::report() { log_v("Occupancy report sent"); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.h b/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.h index 40c5eddbbdd..fa622d5a707 100644 --- a/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.h +++ b/libraries/Zigbee/src/ep/ZigbeeOccupancySensor.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -51,4 +51,4 @@ class ZigbeeOccupancySensor : public ZigbeeEP { void report(); }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp b/libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp index b887680076d..9c181710bc2 100644 --- a/libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp +++ b/libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp @@ -1,5 +1,5 @@ #include "ZigbeePressureSensor.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED 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; @@ -82,4 +82,4 @@ void ZigbeePressureSensor::report() { log_v("Pressure report sent"); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeePressureSensor.h b/libraries/Zigbee/src/ep/ZigbeePressureSensor.h index 2d72ef04c06..db14dd1c341 100644 --- a/libraries/Zigbee/src/ep/ZigbeePressureSensor.h +++ b/libraries/Zigbee/src/ep/ZigbeePressureSensor.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -57,4 +57,4 @@ class ZigbeePressureSensor : public ZigbeeEP { void report(); }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp b/libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp index b29e926c201..20db20d758a 100644 --- a/libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp @@ -1,5 +1,5 @@ #include "ZigbeeRangeExtender.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED ZigbeeRangeExtender::ZigbeeRangeExtender(uint8_t endpoint) : ZigbeeEP(endpoint) { _device_id = ESP_ZB_HA_RANGE_EXTENDER_DEVICE_ID; @@ -12,4 +12,4 @@ ZigbeeRangeExtender::ZigbeeRangeExtender(uint8_t endpoint) : ZigbeeEP(endpoint) _ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_RANGE_EXTENDER_DEVICE_ID, .app_device_version = 0}; } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeRangeExtender.h b/libraries/Zigbee/src/ep/ZigbeeRangeExtender.h index 7441f48ea7a..f9e4a963164 100644 --- a/libraries/Zigbee/src/ep/ZigbeeRangeExtender.h +++ b/libraries/Zigbee/src/ep/ZigbeeRangeExtender.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -15,4 +15,4 @@ class ZigbeeRangeExtender : public ZigbeeEP { ~ZigbeeRangeExtender() {} }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeSwitch.cpp b/libraries/Zigbee/src/ep/ZigbeeSwitch.cpp index f6b36d7f0d4..86c68ae1870 100644 --- a/libraries/Zigbee/src/ep/ZigbeeSwitch.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeSwitch.cpp @@ -1,5 +1,5 @@ #include "ZigbeeSwitch.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED // Initialize the static instance pointer ZigbeeSwitch *ZigbeeSwitch::_instance = nullptr; @@ -313,4 +313,4 @@ void ZigbeeSwitch::lightOnWithTimedOff(uint8_t on_off_control, uint16_t time_on, } } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeSwitch.h b/libraries/Zigbee/src/ep/ZigbeeSwitch.h index b638bfe823a..5c527bec6e3 100644 --- a/libraries/Zigbee/src/ep/ZigbeeSwitch.h +++ b/libraries/Zigbee/src/ep/ZigbeeSwitch.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -43,4 +43,4 @@ class ZigbeeSwitch : public ZigbeeEP { static void findCb(esp_zb_zdp_status_t zdo_status, uint16_t addr, uint8_t endpoint, void *user_ctx); }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp b/libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp index 90df37b91f5..c3991593422 100644 --- a/libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp @@ -1,5 +1,5 @@ #include "ZigbeeTempSensor.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED ZigbeeTempSensor::ZigbeeTempSensor(uint8_t endpoint) : ZigbeeEP(endpoint) { _device_id = ESP_ZB_HA_TEMPERATURE_SENSOR_DEVICE_ID; @@ -150,4 +150,4 @@ void ZigbeeTempSensor::report() { } } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeTempSensor.h b/libraries/Zigbee/src/ep/ZigbeeTempSensor.h index e610ff8d356..41da03d9db8 100644 --- a/libraries/Zigbee/src/ep/ZigbeeTempSensor.h +++ b/libraries/Zigbee/src/ep/ZigbeeTempSensor.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -48,4 +48,4 @@ class ZigbeeTempSensor : public ZigbeeEP { bool _humidity_sensor; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeThermostat.cpp b/libraries/Zigbee/src/ep/ZigbeeThermostat.cpp index f8957f073a5..357bcaed1bc 100644 --- a/libraries/Zigbee/src/ep/ZigbeeThermostat.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeThermostat.cpp @@ -1,5 +1,5 @@ #include "ZigbeeThermostat.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED static float zb_s16_to_temperature(int16_t value) { return 1.0 * value / 100; @@ -202,4 +202,4 @@ void ZigbeeThermostat::setTemperatureReporting(uint16_t min_interval, uint16_t m esp_zb_lock_release(); } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeThermostat.h b/libraries/Zigbee/src/ep/ZigbeeThermostat.h index 669ed9ab50a..7895115e1d1 100644 --- a/libraries/Zigbee/src/ep/ZigbeeThermostat.h +++ b/libraries/Zigbee/src/ep/ZigbeeThermostat.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -62,4 +62,4 @@ class ZigbeeThermostat : public ZigbeeEP { void zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute) override; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp b/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp index 2f2172c89df..9fc75297262 100644 --- a/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp @@ -1,5 +1,5 @@ #include "ZigbeeVibrationSensor.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED esp_zb_cluster_list_t *zigbee_vibration_sensor_clusters_create(zigbee_vibration_sensor_cfg_t *vibration_sensor) { esp_zb_basic_cluster_cfg_t *basic_cfg = vibration_sensor ? &(vibration_sensor->basic_cfg) : NULL; @@ -83,4 +83,4 @@ void ZigbeeVibrationSensor::zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_en } } -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.h b/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.h index 799cc943cdb..1ee3740dcc3 100644 --- a/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.h +++ b/libraries/Zigbee/src/ep/ZigbeeVibrationSensor.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -61,4 +61,4 @@ class ZigbeeVibrationSensor : public ZigbeeEP { uint8_t _ias_cie_endpoint; }; -#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp b/libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp index 970017165e2..f6d6ec268ea 100644 --- a/libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp @@ -1,6 +1,6 @@ #include "ZigbeeWindowCovering.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED esp_zb_cluster_list_t *ZigbeeWindowCovering::zigbee_window_covering_clusters_create(zigbee_window_covering_cfg_t *window_covering_cfg) { esp_zb_attribute_list_t *esp_zb_basic_cluster = esp_zb_basic_cluster_create(&window_covering_cfg->basic_cfg); @@ -305,4 +305,4 @@ void ZigbeeWindowCovering::setTiltPercentage(uint8_t tilt_percentage) { esp_zb_lock_release(); } -#endif // SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeWindowCovering.h b/libraries/Zigbee/src/ep/ZigbeeWindowCovering.h index 08e0a35f737..f3a368370c4 100644 --- a/libraries/Zigbee/src/ep/ZigbeeWindowCovering.h +++ b/libraries/Zigbee/src/ep/ZigbeeWindowCovering.h @@ -4,7 +4,7 @@ #include "soc/soc_caps.h" #include "sdkconfig.h" -#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#if CONFIG_ZB_ENABLED #include "ZigbeeEP.h" #include "ha/esp_zigbee_ha_standard.h" @@ -144,4 +144,4 @@ class ZigbeeWindowCovering : public ZigbeeEP { uint16_t _physical_closed_limit_tilt; }; -#endif // SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED +#endif // CONFIG_ZB_ENABLED From 7ff80d6a6bc5af57a697d1087b7bbcbb104c23e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:14:21 +0100 Subject: [PATCH 2/7] feat(zigbee): Add ZigbeeGateway endpoint support --- .../Zigbee/examples/Zigbee_Gateway/README.md | 64 +++++++++ .../Zigbee_Gateway/Zigbee_Gateway.ino | 130 ++++++++++++++++++ .../Zigbee/examples/Zigbee_Gateway/ci.json | 10 ++ libraries/Zigbee/src/Zigbee.h | 1 + libraries/Zigbee/src/ZigbeeCore.cpp | 8 +- libraries/Zigbee/src/ZigbeeCore.h | 19 +++ libraries/Zigbee/src/ep/ZigbeeGateway.cpp | 15 ++ libraries/Zigbee/src/ep/ZigbeeGateway.h | 18 +++ 8 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 libraries/Zigbee/examples/Zigbee_Gateway/README.md create mode 100644 libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino create mode 100644 libraries/Zigbee/examples/Zigbee_Gateway/ci.json create mode 100644 libraries/Zigbee/src/ep/ZigbeeGateway.cpp create mode 100644 libraries/Zigbee/src/ep/ZigbeeGateway.h diff --git a/libraries/Zigbee/examples/Zigbee_Gateway/README.md b/libraries/Zigbee/examples/Zigbee_Gateway/README.md new file mode 100644 index 00000000000..4156538ccd9 --- /dev/null +++ b/libraries/Zigbee/examples/Zigbee_Gateway/README.md @@ -0,0 +1,64 @@ +# Arduino-ESP32 Zigbee Gateway Example + +This example shows how to configure Zigbee Gateway device, running on SoCs without native IEEE 802.15.4. + +# Supported Targets + +Currently, this example supports the following targets. + +| Supported Targets | ESP32 | ESP32-S2 | ESP32-S3 | ESP32-C3 | +| ----------------- | ----- | -------- | -------- | -------- | + +## Hardware Required + +* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee Radio Co-processor loaded with [ot_rcp example](https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_rcp). +* A USB cable for power supply and programming. +* Choose another board from supported targets as Zigbee coordinator/router and upload the Zigbee_Gateway example. + +### Configure the Project + +Set the RCP connection (UART) by changing the `GATEWAY_RCP_UART_PORT`, `GATEWAY_RCP_RX_PIN` and `GATEWAY_RCP_TX_PIN` definition. + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the Coordinator Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator/router)`. +* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`. +* Select the COM port: `Tools -> Port: xxx where the `xxx` is the detected COM port. +* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`. + +## Troubleshooting + +* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`. + +By default, the coordinator network is closed after rebooting or flashing new firmware. +To open the network you have 2 options: + +* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`. +* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join. + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +* **LED not blinking:** Check the wiring connection and the IO selection. +* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed. +* **COM port not detected:** Check the USB cable and the USB to Serial driver installation. + +If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute). + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) +* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino b/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino new file mode 100644 index 00000000000..5485951bb42 --- /dev/null +++ b/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino @@ -0,0 +1,130 @@ +// Copyright 2025 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @brief This example demonstrates simple Zigbee Gateway functionality. + * + * The example demonstrates how to use Zigbee library on ESP32s to create a Zigbee Gateway, updating the time from NTP server. + * The Gateway is able to communicate with Zigbee end devices and send/receive data to/from them. + * The Gateway is also able to communicate with the cloud or other devices over Wi-Fi / BLE. + * + * Proper Zigbee mode must be selected in Tools->Zigbee mode->Zigbee ZCZR (coordinator/router) + * and also the correct partition scheme must be selected in Tools->Partition Scheme->Zigbee ZCZR + * + * Please check the README.md for instructions and more detailed description. + * + * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/) + */ + +#ifndef ZIGBEE_MODE_ZCZR +#error "Zigbee coordinator mode is not selected in Tools->Zigbee mode" +#endif + +#include "Zigbee.h" +#include +#include "time.h" +#include "esp_sntp.h" + +/* Zigbee gateway configuration */ +#define GATEWAY_ENDPOINT_NUMBER 1 +#define GATEWAY_RCP_UART_PORT UART_NUM_1 // UART 0 is used for Serial communication +#define GATEWAY_RCP_RX_PIN 4 +#define GATEWAY_RCP_TX_PIN 5 + +ZigbeeGateway zbGateway = ZigbeeGateway(GATEWAY_ENDPOINT_NUMBER); + +/* Wi-Fi credentials */ +const char *ssid = "your-ssid"; +const char *password = "your-password"; + +/* NTP server configuration */ +const char *ntpServer1 = "pool.ntp.org"; +const char *ntpServer2 = "time.nist.gov"; +const long gmtOffset_sec = 3600; +const int daylightOffset_sec = 3600; +const char *time_zone = "CET-1CEST,M3.5.0,M10.5.0/3"; // TimeZone rule for Europe/Rome including daylight adjustment rules (optional) + +/* Time structure */ +struct tm timeinfo; + +/********************* Arduino functions **************************/ +void setup() { + Serial.begin(115200); + + // Initialize Wi-Fi and connect to AP + WiFi.begin(ssid, password); + esp_sntp_servermode_dhcp(1); // (optional) + + Serial.print("Connecting to WiFi"); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + Serial.println("WiFi connected"); + + // Initialize Zigbee and Begin Zigbee stack + // Optional: set Zigbee device name and model + zbGateway.setManufacturerAndModel("Espressif", "ZigbeeGateway"); + zbGateway.addTimeCluster(timeinfo, gmtOffset_sec); + + // Add endpoint to Zigbee Core + Serial.println("Adding Zigbee Gateway endpoint"); + Zigbee.addEndpoint(&zbGateway); + + // Optional: Open network for 180 seconds after boot + Zigbee.setRebootOpenNetwork(180); + + // Set custom radio configuration for RCP communication + esp_zb_radio_config_t radio_config = ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG(); + radio_config.radio_uart_config.port = GATEWAY_RCP_UART_PORT; + radio_config.radio_uart_config.rx_pin = (gpio_num_t)GATEWAY_RCP_RX_PIN; + radio_config.radio_uart_config.tx_pin = (gpio_num_t)GATEWAY_RCP_TX_PIN; + + Zigbee.setRadioConfig(radio_config); + + // When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR or ZIGBEE_ROUTER mode + if (!Zigbee.begin(ZIGBEE_COORDINATOR)) { + Serial.println("Zigbee failed to start!"); + Serial.println("Rebooting..."); + ESP.restart(); + } + + // set notification call-back function + sntp_set_time_sync_notification_cb(timeavailable); + sntp_set_sync_interval(30000); // sync every 30 seconds + + // config time zone and NTP servers + configTime(gmtOffset_sec, daylightOffset_sec, ntpServer1, ntpServer2); +} + +void loop() { + // Nothing to do here in this example +} + +void printLocalTime() { + if (!getLocalTime(&timeinfo)) { + Serial.println("No time available (yet)"); + return; + } + Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); + zbGateway.setTime(timeinfo); + Serial.println("Time updated in Zigbee Gateway"); +} + +// Callback function (gets called when time adjusts via NTP) +void timeavailable(struct timeval *t) { + Serial.println("Got time adjustment from NTP!"); + printLocalTime(); +} diff --git a/libraries/Zigbee/examples/Zigbee_Gateway/ci.json b/libraries/Zigbee/examples/Zigbee_Gateway/ci.json new file mode 100644 index 00000000000..660679dbe1e --- /dev/null +++ b/libraries/Zigbee/examples/Zigbee_Gateway/ci.json @@ -0,0 +1,10 @@ +{ + "fqbn_append": "PartitionScheme=zigbee_zczr,ZigbeeMode=zczr", + "requires": [ + "CONFIG_ZB_ENABLED=y" + ], + "targets": { + "esp32c6": false, + "esp32h2": false + } +} diff --git a/libraries/Zigbee/src/Zigbee.h b/libraries/Zigbee/src/Zigbee.h index c8e7481e58f..9ccf1e7d8f2 100644 --- a/libraries/Zigbee/src/Zigbee.h +++ b/libraries/Zigbee/src/Zigbee.h @@ -24,3 +24,4 @@ #include "ep/ZigbeeWindowCovering.h" #include "ep/ZigbeeVibrationSensor.h" #include "ep/ZigbeeRangeExtender.h" +#include "ep/ZigbeeGateway.h" diff --git a/libraries/Zigbee/src/ZigbeeCore.cpp b/libraries/Zigbee/src/ZigbeeCore.cpp index 0fad546bb15..947ddd6c854 100644 --- a/libraries/Zigbee/src/ZigbeeCore.cpp +++ b/libraries/Zigbee/src/ZigbeeCore.cpp @@ -87,7 +87,11 @@ void ZigbeeCore::addEndpoint(ZigbeeEP *ep) { return; } - esp_zb_ep_list_add_ep(_zb_ep_list, ep->_cluster_list, ep->_ep_config); + if(ep->_device_id == ESP_ZB_HA_HOME_GATEWAY_DEVICE_ID) { + esp_zb_ep_list_add_gateway_ep(_zb_ep_list, ep->_cluster_list, ep->_ep_config); + } else { + esp_zb_ep_list_add_ep(_zb_ep_list, ep->_cluster_list, ep->_ep_config); + } } static void esp_zb_task(void *pvParameters) { @@ -156,7 +160,7 @@ bool ZigbeeCore::zigbeeInit(esp_zb_cfg_t *zb_cfg, bool erase_nvs) { } // Create Zigbee task and start Zigbee stack - xTaskCreate(esp_zb_task, "Zigbee_main", 4096, NULL, 5, NULL); + xTaskCreate(esp_zb_task, "Zigbee_main", 8192, NULL, 5, NULL); return true; } diff --git a/libraries/Zigbee/src/ZigbeeCore.h b/libraries/Zigbee/src/ZigbeeCore.h index 1d6e32babe0..8be5f803813 100644 --- a/libraries/Zigbee/src/ZigbeeCore.h +++ b/libraries/Zigbee/src/ZigbeeCore.h @@ -60,6 +60,25 @@ typedef enum { } \ } +#define ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG() \ + { \ + .radio_mode = ZB_RADIO_MODE_UART_RCP, \ + .radio_uart_config = { \ + .port = UART_NUM_1, \ + .rx_pin = GPIO_NUM_NC, \ + .tx_pin = GPIO_NUM_NC, \ + .uart_config = { \ + .baud_rate = 460800, \ + .data_bits = UART_DATA_8_BITS, \ + .parity = UART_PARITY_DISABLE, \ + .stop_bits = UART_STOP_BITS_1, \ + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \ + .rx_flow_ctrl_thresh = 0, \ + .source_clk = UART_SCLK_DEFAULT, \ + }, \ + }, \ + } + class ZigbeeCore { private: esp_zb_radio_config_t _radio_config; diff --git a/libraries/Zigbee/src/ep/ZigbeeGateway.cpp b/libraries/Zigbee/src/ep/ZigbeeGateway.cpp new file mode 100644 index 00000000000..b0be81395ca --- /dev/null +++ b/libraries/Zigbee/src/ep/ZigbeeGateway.cpp @@ -0,0 +1,15 @@ +#include "ZigbeeGateway.h" +#if CONFIG_ZB_ENABLED + +ZigbeeGateway::ZigbeeGateway(uint8_t endpoint) : ZigbeeEP(endpoint) { + _device_id = ESP_ZB_HA_HOME_GATEWAY_DEVICE_ID; + + _cluster_list = esp_zb_zcl_cluster_list_create(); + esp_zb_cluster_list_add_basic_cluster(_cluster_list, esp_zb_basic_cluster_create(NULL), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + esp_zb_cluster_list_add_identify_cluster(_cluster_list, esp_zb_identify_cluster_create(NULL), 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_CLIENT_ROLE); + + _ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_HOME_GATEWAY_DEVICE_ID, .app_device_version = 0}; +} + +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeeGateway.h b/libraries/Zigbee/src/ep/ZigbeeGateway.h new file mode 100644 index 00000000000..3925630c0b8 --- /dev/null +++ b/libraries/Zigbee/src/ep/ZigbeeGateway.h @@ -0,0 +1,18 @@ +/* Class of Zigbee Gateway endpoint inherited from common EP class */ + +#pragma once + +#include "soc/soc_caps.h" +#include "sdkconfig.h" +#if CONFIG_ZB_ENABLED + +#include "ZigbeeEP.h" +#include "ha/esp_zigbee_ha_standard.h" + +class ZigbeeGateway : public ZigbeeEP { +public: + ZigbeeGateway(uint8_t endpoint); + ~ZigbeeGateway() {} +}; + +#endif // CONFIG_ZB_ENABLED From be9c9688a554de8df7de38db245906eba07869d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:14:41 +0100 Subject: [PATCH 3/7] fix(zigbee): Fix TimeCluster missing status attribute --- libraries/Zigbee/src/ZigbeeEP.cpp | 15 +++++++++++++-- libraries/Zigbee/src/ZigbeeEP.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/Zigbee/src/ZigbeeEP.cpp b/libraries/Zigbee/src/ZigbeeEP.cpp index 8320215707b..fc706107e58 100644 --- a/libraries/Zigbee/src/ZigbeeEP.cpp +++ b/libraries/Zigbee/src/ZigbeeEP.cpp @@ -19,6 +19,7 @@ ZigbeeEP::ZigbeeEP(uint8_t endpoint) { _ep_config.endpoint = 0; _cluster_list = nullptr; _on_identify = nullptr; + _time_status = 0; if (!lock) { lock = xSemaphoreCreateBinary(); if (lock == NULL) { @@ -240,7 +241,6 @@ void ZigbeeEP::zbIdentify(const esp_zb_zcl_set_attr_value_message_t *message) { void ZigbeeEP::addTimeCluster(tm time, int32_t gmt_offset) { time_t utc_time = 0; - // Check if time is set if (time.tm_year > 0) { // Convert time to UTC @@ -251,6 +251,7 @@ void ZigbeeEP::addTimeCluster(tm time, int32_t gmt_offset) { esp_zb_attribute_list_t *time_cluster_server = esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_TIME); esp_zb_time_cluster_add_attr(time_cluster_server, ESP_ZB_ZCL_ATTR_TIME_TIME_ZONE_ID, (void *)&gmt_offset); esp_zb_time_cluster_add_attr(time_cluster_server, ESP_ZB_ZCL_ATTR_TIME_TIME_ID, (void *)&utc_time); + esp_zb_time_cluster_add_attr(time_cluster_server, ESP_ZB_ZCL_ATTR_TIME_TIME_STATUS_ID, (void *)&_time_status); // Create time cluster client attributes esp_zb_attribute_list_t *time_cluster_client = esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_TIME); // Add time clusters to cluster list @@ -260,6 +261,7 @@ void ZigbeeEP::addTimeCluster(tm time, int32_t gmt_offset) { void ZigbeeEP::setTime(tm time) { time_t utc_time = mktime(&time); + log_d("Setting time to %lld", utc_time); esp_zb_lock_acquire(portMAX_DELAY); esp_zb_zcl_set_attribute_val(_endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_ID, &utc_time, false); esp_zb_lock_release(); @@ -306,6 +308,14 @@ tm ZigbeeEP::getTime(uint8_t endpoint, int32_t short_addr, esp_zb_ieee_addr_t ie struct tm *timeinfo = localtime(&_read_time); if (timeinfo) { + // Update time + setTime(*timeinfo); + // Update time status to synced + _time_status |= 0x02; + esp_zb_lock_acquire(portMAX_DELAY); + esp_zb_zcl_set_attribute_val(_endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_STATUS_ID, &_time_status, false); + esp_zb_lock_release(); + return *timeinfo; } else { log_e("Error while converting time"); @@ -343,8 +353,9 @@ int32_t ZigbeeEP::getTimezone(uint8_t endpoint, int32_t short_addr, esp_zb_ieee_ //Wait for response or timeout if (xSemaphoreTake(lock, ZB_CMD_TIMEOUT) != pdTRUE) { log_e("Error while reading timezone"); + return 0; } - + setTimezone(_read_timezone); return _read_timezone; } diff --git a/libraries/Zigbee/src/ZigbeeEP.h b/libraries/Zigbee/src/ZigbeeEP.h index 14b9ff61040..0a4e3e9d252 100644 --- a/libraries/Zigbee/src/ZigbeeEP.h +++ b/libraries/Zigbee/src/ZigbeeEP.h @@ -153,6 +153,7 @@ class ZigbeeEP { std::list _bound_devices; SemaphoreHandle_t lock; zb_power_source_t _power_source; + uint8_t _time_status; friend class ZigbeeCore; }; From 6ca00fe19b6a81c44944589879d8adc89160513a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:28:23 +0100 Subject: [PATCH 4/7] feat(zigbee): Add new src to CMakeLists --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97ad068eb48..32d17e5f68d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,6 +297,7 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp libraries/Zigbee/src/ep/ZigbeeAnalog.cpp libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp + libraries/Zigbee/src/ep/ZigbeeGateway.cpp ) set(ARDUINO_LIBRARY_BLE_SRCS From 86f453036a95ce607c1297ecb3876830afd5308d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:41:20 +0100 Subject: [PATCH 5/7] feaz(zigbee): Update keywords.txt with latest updates --- libraries/Zigbee/keywords.txt | 50 +++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/libraries/Zigbee/keywords.txt b/libraries/Zigbee/keywords.txt index 483d54eb712..2eeed5878a7 100644 --- a/libraries/Zigbee/keywords.txt +++ b/libraries/Zigbee/keywords.txt @@ -21,12 +21,22 @@ ZigbeeThermostat KEYWORD1 ZigbeeFlowSensor KEYWORD1 ZigbeePressureSensor KEYWORD1 ZigbeeOccupancySensor KEYWORD1 +ZigbeeAnalog KEYWORD1 +ZigbeeCarbonDioxideSensor KEYWORD1 +ZigbeeContactSwitch KEYWORD1 +ZigbeeDoorWindowHandle KEYWORD1 +ZigbeeGateway KEYWORD1 +ZigbeeRangeExtender KEYWORD1 +ZigbeeVibrationSensor KEYWORD1 +ZigbeeWindowCovering KEYWORD1 # Other zigbee_role_t KEYWORD1 zbstring_t KEYWORD1 zb_device_params_t KEYWORD1 zigbee_scan_result_t KEYWORD1 +zb_power_source_t KEYWORD1 +ZigbeeWindowCoveringType KEYWORD1 ####################################### # Methods and Functions (KEYWORD2) @@ -126,6 +136,43 @@ setSensorType KEYWORD2 # ZigbeeCarbonDioxideSensor setCarbonDioxide KEYWORD2 +# ZigbeeAnalog +addAnalogValue KEYWORD2 +addAnalogInput KEYWORD2 +addAnalogOutput KEYWORD2 +onAnalogOutputChange KEYWORD2 +setAnalogValue KEYWORD2 +setAnalogInput KEYWORD2 +reportAnalogInput KEYWORD2 +setAnalogInputReporting KEYWORD2 + +# ZigbeeCarbonDioxideSensor +setCarbonDioxide KEYWORD2 + +# ZigbeeContactSwitch + ZigbeeDoorWindowHandle +setIASClientEndpoint KEYWORD2 +setClosed KEYWORD2 +setOpen KEYWORD2 +setTilted KEYWORD2 + +# ZigbeeVibrationSensor +setVibration KEYWORD2 + +ZigbeeWindowCovering +onOpen KEYWORD2 +onClose KEYWORD2 +onGoToLiftPercentage KEYWORD2 +onGoToTiltPercentage KEYWORD2 +onStop KEYWORD2 +setLiftPosition KEYWORD2 +setLiftPercentage KEYWORD2 +setTiltPosition KEYWORD2 +setTiltPercentage KEYWORD2 +setCoveringType KEYWORD2 +setConfigStatus KEYWORD2 +setMode KEYWORD2 +setLimits KEYWORD2 + ####################################### # Constants (LITERAL1) ####################################### @@ -137,7 +184,6 @@ ZIGBEE_DEFAULT_ED_CONFIG LITERAL1 ZIGBEE_DEFAULT_ROUTER_CONFIG LITERAL1 ZIGBEE_DEFAULT_COORDINATOR_CONFIG LITERAL1 ZIGBEE_DEFAULT_RADIO_CONFIG LITERAL1 +ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG LITERAL1 ZIGBEE_DEFAULT_HOST_CONFIG LITERAL1 ZB_ARRAY_LENTH LITERAL1 -XYZ_TO_RGB LITERAL1 -RGB_TO_XYZ LITERAL1 From a9d322b2b925e97e87058091fdf2462af6e13b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 25 Feb 2025 14:13:26 +0100 Subject: [PATCH 6/7] feat(zigbee): Add 8MB Zigbee ZCZR partitions to other socs --- boards.txt | 12 ++++++++++++ libraries/Zigbee/examples/Zigbee_Gateway/ci.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/boards.txt b/boards.txt index e1c9283f197..2afe45f50a6 100644 --- a/boards.txt +++ b/boards.txt @@ -947,6 +947,9 @@ esp32s3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 esp32s3.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs esp32s3.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr esp32s3.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +esp32s3.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +esp32s3.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +esp32s3.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 esp32s3.menu.PartitionScheme.custom=Custom esp32s3.menu.PartitionScheme.custom.build.partitions= esp32s3.menu.PartitionScheme.custom.upload.maximum_size=16777216 @@ -1108,6 +1111,9 @@ esp32c3.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 esp32c3.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs esp32c3.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr esp32c3.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +esp32c3.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +esp32c3.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +esp32c3.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 esp32c3.menu.PartitionScheme.custom=Custom esp32c3.menu.PartitionScheme.custom.build.partitions= esp32c3.menu.PartitionScheme.custom.upload.maximum_size=16777216 @@ -1313,6 +1319,9 @@ esp32s2.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 esp32s2.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs esp32s2.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr esp32s2.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +esp32s2.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +esp32s2.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +esp32s2.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 esp32s2.menu.PartitionScheme.custom=Custom esp32s2.menu.PartitionScheme.custom.build.partitions= esp32s2.menu.PartitionScheme.custom.upload.maximum_size=16777216 @@ -1493,6 +1502,9 @@ esp32.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 esp32.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs esp32.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr esp32.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +esp32.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +esp32.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +esp32.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 esp32.menu.PartitionScheme.custom=Custom esp32.menu.PartitionScheme.custom.build.partitions= esp32.menu.PartitionScheme.custom.upload.maximum_size=16777216 diff --git a/libraries/Zigbee/examples/Zigbee_Gateway/ci.json b/libraries/Zigbee/examples/Zigbee_Gateway/ci.json index 660679dbe1e..23e1c59d1da 100644 --- a/libraries/Zigbee/examples/Zigbee_Gateway/ci.json +++ b/libraries/Zigbee/examples/Zigbee_Gateway/ci.json @@ -1,5 +1,5 @@ { - "fqbn_append": "PartitionScheme=zigbee_zczr,ZigbeeMode=zczr", + "fqbn_append": "PartitionScheme=zigbee_zczr_8MB,ZigbeeMode=zczr", "requires": [ "CONFIG_ZB_ENABLED=y" ], From 9f9d8f78a6539779c9dfcbdbb1dd354bc99a7f83 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 19:46:24 +0000 Subject: [PATCH 7/7] ci(pre-commit): Apply automatic fixes --- .../Zigbee_Gateway/Zigbee_Gateway.ino | 12 +++---- libraries/Zigbee/src/ZigbeeCore.cpp | 2 +- libraries/Zigbee/src/ZigbeeCore.h | 35 ++++++++++--------- libraries/Zigbee/src/ZigbeeEP.cpp | 4 ++- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino b/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino index 5485951bb42..402227b9a3d 100644 --- a/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino +++ b/libraries/Zigbee/examples/Zigbee_Gateway/Zigbee_Gateway.ino @@ -38,9 +38,9 @@ /* Zigbee gateway configuration */ #define GATEWAY_ENDPOINT_NUMBER 1 -#define GATEWAY_RCP_UART_PORT UART_NUM_1 // UART 0 is used for Serial communication -#define GATEWAY_RCP_RX_PIN 4 -#define GATEWAY_RCP_TX_PIN 5 +#define GATEWAY_RCP_UART_PORT UART_NUM_1 // UART 0 is used for Serial communication +#define GATEWAY_RCP_RX_PIN 4 +#define GATEWAY_RCP_TX_PIN 5 ZigbeeGateway zbGateway = ZigbeeGateway(GATEWAY_ENDPOINT_NUMBER); @@ -90,12 +90,12 @@ void setup() { esp_zb_radio_config_t radio_config = ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG(); radio_config.radio_uart_config.port = GATEWAY_RCP_UART_PORT; radio_config.radio_uart_config.rx_pin = (gpio_num_t)GATEWAY_RCP_RX_PIN; - radio_config.radio_uart_config.tx_pin = (gpio_num_t)GATEWAY_RCP_TX_PIN; + radio_config.radio_uart_config.tx_pin = (gpio_num_t)GATEWAY_RCP_TX_PIN; Zigbee.setRadioConfig(radio_config); // When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR or ZIGBEE_ROUTER mode - if (!Zigbee.begin(ZIGBEE_COORDINATOR)) { + if (!Zigbee.begin(ZIGBEE_COORDINATOR)) { Serial.println("Zigbee failed to start!"); Serial.println("Rebooting..."); ESP.restart(); @@ -103,7 +103,7 @@ void setup() { // set notification call-back function sntp_set_time_sync_notification_cb(timeavailable); - sntp_set_sync_interval(30000); // sync every 30 seconds + sntp_set_sync_interval(30000); // sync every 30 seconds // config time zone and NTP servers configTime(gmtOffset_sec, daylightOffset_sec, ntpServer1, ntpServer2); diff --git a/libraries/Zigbee/src/ZigbeeCore.cpp b/libraries/Zigbee/src/ZigbeeCore.cpp index 947ddd6c854..bd5849bb4b8 100644 --- a/libraries/Zigbee/src/ZigbeeCore.cpp +++ b/libraries/Zigbee/src/ZigbeeCore.cpp @@ -87,7 +87,7 @@ void ZigbeeCore::addEndpoint(ZigbeeEP *ep) { return; } - if(ep->_device_id == ESP_ZB_HA_HOME_GATEWAY_DEVICE_ID) { + if (ep->_device_id == ESP_ZB_HA_HOME_GATEWAY_DEVICE_ID) { esp_zb_ep_list_add_gateway_ep(_zb_ep_list, ep->_cluster_list, ep->_ep_config); } else { esp_zb_ep_list_add_ep(_zb_ep_list, ep->_cluster_list, ep->_ep_config); diff --git a/libraries/Zigbee/src/ZigbeeCore.h b/libraries/Zigbee/src/ZigbeeCore.h index 8be5f803813..a26e17e58a7 100644 --- a/libraries/Zigbee/src/ZigbeeCore.h +++ b/libraries/Zigbee/src/ZigbeeCore.h @@ -60,23 +60,24 @@ typedef enum { } \ } -#define ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG() \ - { \ - .radio_mode = ZB_RADIO_MODE_UART_RCP, \ - .radio_uart_config = { \ - .port = UART_NUM_1, \ - .rx_pin = GPIO_NUM_NC, \ - .tx_pin = GPIO_NUM_NC, \ - .uart_config = { \ - .baud_rate = 460800, \ - .data_bits = UART_DATA_8_BITS, \ - .parity = UART_PARITY_DISABLE, \ - .stop_bits = UART_STOP_BITS_1, \ - .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \ - .rx_flow_ctrl_thresh = 0, \ - .source_clk = UART_SCLK_DEFAULT, \ - }, \ - }, \ +#define ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG() \ + { \ + .radio_mode = ZB_RADIO_MODE_UART_RCP, \ + .radio_uart_config = { \ + .port = UART_NUM_1, \ + .rx_pin = GPIO_NUM_NC, \ + .tx_pin = GPIO_NUM_NC, \ + .uart_config = \ + { \ + .baud_rate = 460800, \ + .data_bits = UART_DATA_8_BITS, \ + .parity = UART_PARITY_DISABLE, \ + .stop_bits = UART_STOP_BITS_1, \ + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \ + .rx_flow_ctrl_thresh = 0, \ + .source_clk = UART_SCLK_DEFAULT, \ + }, \ + }, \ } class ZigbeeCore { diff --git a/libraries/Zigbee/src/ZigbeeEP.cpp b/libraries/Zigbee/src/ZigbeeEP.cpp index fc706107e58..6774e9111f1 100644 --- a/libraries/Zigbee/src/ZigbeeEP.cpp +++ b/libraries/Zigbee/src/ZigbeeEP.cpp @@ -313,7 +313,9 @@ tm ZigbeeEP::getTime(uint8_t endpoint, int32_t short_addr, esp_zb_ieee_addr_t ie // Update time status to synced _time_status |= 0x02; esp_zb_lock_acquire(portMAX_DELAY); - esp_zb_zcl_set_attribute_val(_endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_STATUS_ID, &_time_status, false); + esp_zb_zcl_set_attribute_val( + _endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_STATUS_ID, &_time_status, false + ); esp_zb_lock_release(); return *timeinfo;