diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index de9bd0d9f64193..7c0556faa26af0 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -122,7 +122,9 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml \
+ src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml \
+ src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml \
@@ -204,6 +206,8 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml \
+ src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml \
+ src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml \
"
- name: Build Apps
run: |
diff --git a/data_model/clusters/EnergyCalendar.xml b/data_model/clusters/EnergyCalendar.xml
new file mode 100644
index 00000000000000..75db315f49fcf0
--- /dev/null
+++ b/data_model/clusters/EnergyCalendar.xml
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data_model/clusters/MeterIdentification.xml b/data_model/clusters/MeterIdentification.xml
new file mode 100644
index 00000000000000..1ed47d5d3da3af
--- /dev/null
+++ b/data_model/clusters/MeterIdentification.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/zap_clusters.md b/docs/zap_clusters.md
index 7651e35b784ed1..4806931ac70e59 100644
--- a/docs/zap_clusters.md
+++ b/docs/zap_clusters.md
@@ -83,6 +83,7 @@ Generally regenerate using one of:
| 151 | 0x97 | Messages |
| 152 | 0x98 | DeviceEnergyManagement |
| 153 | 0x99 | EnergyEvse |
+| 154 | 0x9A | EnergyCalendar |
| 155 | 0x9B | EnergyPreference |
| 156 | 0x9C | PowerTopology |
| 157 | 0x9D | EnergyEvseMode |
@@ -131,6 +132,7 @@ Generally regenerate using one of:
| 1295 | 0x50F | ContentControl |
| 1296 | 0x510 | ContentAppObserver |
| 2820 | 0xB04 | ElectricalMeasurement |
+| 2822 | 0xB06 | MeterIdentification |
| 4294048773 | 0xFFF1FC05 | UnitTesting |
| 4294048774 | 0xFFF1FC06 | FaultInjection |
| 4294048800 | 0xFFF1FC20 | SampleMei |
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
index 5400a81d0fb902..3a98130f254822 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
@@ -4467,6 +4467,91 @@ cluster EnergyEvse = 153 {
timed command ClearTargets(): DefaultSuccess = 7;
}
+/** */
+cluster EnergyCalendar = 154 {
+ revision 3;
+
+ enum PeakPeriodSeverityEnum : enum8 {
+ kUnused = 0;
+ kLow = 1;
+ kMedium = 2;
+ kHigh = 3;
+ }
+
+ bitmap AuxiliaryLoadBitmap : bitmap8 {
+ kAuxiliarySwitch1 = 0x1;
+ kAuxiliarySwitch2 = 0x2;
+ kAuxiliarySwitch3 = 0x4;
+ kAuxiliarySwitch4 = 0x8;
+ kAuxiliarySwitch5 = 0x10;
+ kAuxiliarySwitch6 = 0x20;
+ kAuxiliarySwitch7 = 0x40;
+ kAuxiliarySwitch8 = 0x80;
+ }
+
+ bitmap Feature : bitmap32 {
+ kPricingTier = 0x1;
+ kFriendlyCredit = 0x2;
+ kAuxiliaryLoad = 0x4;
+ kPeakPeriod = 0x8;
+ }
+
+ bitmap TransitionDayOfWeekBitmap : bitmap8 {
+ kSunday = 0x1;
+ kMonday = 0x2;
+ kTuesday = 0x4;
+ kWednesday = 0x8;
+ kThursday = 0x10;
+ kFriday = 0x20;
+ kSaturday = 0x40;
+ }
+
+ struct TransitionStruct {
+ int16u transitionTime = 0;
+ optional int32u priceTier = 1;
+ optional boolean friendlyCredit = 2;
+ optional AuxiliaryLoadBitmap auxiliaryLoad = 3;
+ }
+
+ struct DayStruct {
+ optional date date = 0;
+ optional TransitionDayOfWeekBitmap daysOfWeek = 1;
+ TransitionStruct transitions[] = 2;
+ optional int32u calendarID = 3;
+ }
+
+ struct CalendarPeriodStruct {
+ nullable epoch_s startDate = 0;
+ DayStruct days[] = 1;
+ }
+
+ struct PeakPeriodStruct {
+ PeakPeriodSeverityEnum severity = 0;
+ int16u peakPeriod = 1;
+ nullable epoch_s startTime = 2;
+ nullable epoch_s endTime = 3;
+ }
+
+ readonly attribute nullable int32u calendarID = 0;
+ readonly attribute nullable char_string<12> name = 1;
+ readonly attribute nullable int32u providerID = 2;
+ readonly attribute nullable int32u eventID = 3;
+ readonly attribute nullable epoch_s startDate = 4;
+ readonly attribute nullable CalendarPeriodStruct calendarPeriods[] = 5;
+ readonly attribute nullable DayStruct specialDays[] = 6;
+ readonly attribute nullable DayStruct currentDay = 7;
+ readonly attribute nullable DayStruct nextDay = 8;
+ readonly attribute nullable TransitionStruct currentTransition = 9;
+ readonly attribute optional nullable PeakPeriodStruct currentPeakPeriod = 10;
+ readonly attribute optional nullable PeakPeriodStruct nextPeakPeriod = 11;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+}
+
/** This cluster provides an interface to specify preferences for how devices should consume energy. */
provisional cluster EnergyPreference = 155 {
revision 1;
@@ -6686,6 +6771,39 @@ deprecated cluster ElectricalMeasurement = 2820 {
command GetMeasurementProfileCommand(GetMeasurementProfileCommandRequest): DefaultSuccess = 1;
}
+/** */
+cluster MeterIdentification = 2822 {
+ revision 1;
+
+ enum MeterTypeEnum : enum8 {
+ kUtility = 0;
+ kPrivate = 1;
+ kGeneric = 2;
+ }
+
+ enum PowerThresholdSourceEnum : enum8 {
+ kContract = 0;
+ kRegulator = 1;
+ kEquipment = 2;
+ }
+
+ bitmap Feature : bitmap32 {
+ kPowerThreshold = 0x1;
+ }
+
+ readonly attribute nullable MeterTypeEnum meterType = 0;
+ readonly attribute nullable char_string<16> utilityName = 1;
+ readonly attribute nullable char_string<16> pointOfDelivery = 2;
+ readonly attribute optional nullable power_mw powerThreshold = 3;
+ readonly attribute optional nullable PowerThresholdSourceEnum powerThresholdSource = 4;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+}
+
/** The Test Cluster is meant to validate the generated code */
internal cluster UnitTesting = 4294048773 {
revision 1; // NOTE: Default/not specifically set
@@ -8407,6 +8525,11 @@ endpoint 1 {
handle command ClearTargets;
}
+ server cluster EnergyCalendar {
+ callback attribute featureMap;
+ ram attribute clusterRevision default = 1;
+ }
+
server cluster EnergyPreference {
callback attribute energyBalances;
ram attribute currentEnergyBalance;
@@ -8974,6 +9097,11 @@ endpoint 1 {
ram attribute clusterRevision default = 3;
}
+ server cluster MeterIdentification {
+ callback attribute featureMap;
+ ram attribute clusterRevision default = 1;
+ }
+
server cluster UnitTesting {
emits event TestEvent;
emits event TestFabricScopedEvent;
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
index f0afbd78296bd2..930b03c1fc0394 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
@@ -14232,6 +14232,240 @@
}
]
},
+ {
+ "name": "Energy Calendar",
+ "code": 154,
+ "mfgCode": null,
+ "define": "ENERGY_CALENDAR_CLUSTER",
+ "side": "server",
+ "enabled": 1,
+ "attributes": [
+ {
+ "name": "CalendarID",
+ "code": 0,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int32u",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "Name",
+ "code": 1,
+ "mfgCode": null,
+ "side": "server",
+ "type": "char_string",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ProviderID",
+ "code": 2,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int32u",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "EventID",
+ "code": 3,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int32u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "StartDate",
+ "code": 4,
+ "mfgCode": null,
+ "side": "server",
+ "type": "epoch_s",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CalendarPeriods",
+ "code": 5,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "SpecialDays",
+ "code": 6,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentDay",
+ "code": 7,
+ "mfgCode": null,
+ "side": "server",
+ "type": "DayStruct",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "NextDay",
+ "code": 8,
+ "mfgCode": null,
+ "side": "server",
+ "type": "DayStruct",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentTransition",
+ "code": 9,
+ "mfgCode": null,
+ "side": "server",
+ "type": "TransitionStruct",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentPeakPeriod",
+ "code": 10,
+ "mfgCode": null,
+ "side": "server",
+ "type": "PeakPeriodStruct",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "NextPeakPeriod",
+ "code": 11,
+ "mfgCode": null,
+ "side": "server",
+ "type": "PeakPeriodStruct",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "server",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
{
"name": "Energy Preference",
"code": 155,
@@ -21739,6 +21973,128 @@
}
]
},
+ {
+ "name": "Meter Identification",
+ "code": 2822,
+ "mfgCode": null,
+ "define": "METER_IDENTIFICATION_CLUSTER",
+ "side": "server",
+ "enabled": 1,
+ "attributes": [
+ {
+ "name": "MeterType",
+ "code": 0,
+ "mfgCode": null,
+ "side": "server",
+ "type": "MeterTypeEnum",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "UtilityName",
+ "code": 1,
+ "mfgCode": null,
+ "side": "server",
+ "type": "char_string",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "PointOfDelivery",
+ "code": 2,
+ "mfgCode": null,
+ "side": "server",
+ "type": "char_string",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "PowerThreshold",
+ "code": 3,
+ "mfgCode": null,
+ "side": "server",
+ "type": "power_mw",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "PowerThresholdSource",
+ "code": 4,
+ "mfgCode": null,
+ "side": "server",
+ "type": "PowerThresholdSourceEnum",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "server",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
{
"name": "Unit Testing",
"code": 4294048773,
diff --git a/examples/all-clusters-app/all-clusters-common/include/energy-calendar-instance.h b/examples/all-clusters-app/all-clusters-common/include/energy-calendar-instance.h
new file mode 100644
index 00000000000000..fdcdfae10c4f02
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/include/energy-calendar-instance.h
@@ -0,0 +1,94 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyCalendar {
+
+/** @brief
+ * CalendarProvider is interface of the Calendar Provider
+ */
+class CalendarProviderInstance : public CalendarProvider
+{
+public:
+ CalendarProviderInstance() : CalendarProvider(1) {}
+ CalendarProviderInstance(EndpointId ep) : CalendarProvider(ep) {}
+ ~CalendarProviderInstance();
+
+ void Init(void);
+
+ void SetDefault(void);
+
+ CHIP_ERROR LoadJson(Json::Value & root);
+
+ /* owerride */
+ CHIP_ERROR GetDays(EndpointId ep, DataModel::Nullable & CurrentDay,
+ DataModel::Nullable & NextDay) override;
+
+private:
+ uint32_t mDate;
+ uint32_t mTime;
+
+ // Attributes contaners allocated memory
+ DataModel::Nullable mName;
+ DataModel::List mCalendarPeriods;
+ DataModel::List mSpecialDays;
+ Structs::DayStruct::Type mCurrentDay;
+ Structs::DayStruct::Type mNextDay;
+
+ DataModel::Nullable GetDay(uint32_t date);
+ bool CheckSpecialDays();
+ bool CheckDay(const Structs::DayStruct::Type & day);
+ bool CheckPeriods();
+
+ void JsonToCalendarPeriodStruct(Json::Value & root, Structs::CalendarPeriodStruct::Type & value);
+ void JsonToDayStruct(Json::Value & root, Structs::DayStruct::Type & value);
+ void JsonToPeakPeriodStruct(Json::Value & root, Structs::PeakPeriodStruct::Type & value);
+
+ void JsonToCalendarPeriodStructList(Json::Value & root, DataModel::List & value);
+ void JsonToDayStructList(Json::Value & root, DataModel::List & value);
+ void JsonToTransitionStructList(Json::Value & root, DataModel::List & value);
+
+ void FreeMemoryDayStruct(Structs::DayStruct::Type & value);
+ void FreeMemoryDayStructList(DataModel::List & value);
+ void FreeMemoryCalendarPeriodStruct(Structs::CalendarPeriodStruct::Type & value);
+ void FreeMemoryCalendarPeriodStructList(DataModel::List & value);
+};
+
+CalendarProviderInstance * GetProvider();
+
+} // namespace EnergyCalendar
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-calendar-instance.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-calendar-instance.cpp
new file mode 100644
index 00000000000000..0202f29744cd7e
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/src/energy-calendar-instance.cpp
@@ -0,0 +1,572 @@
+/*
+ * Copyright (c) 2024 Project CHIP Authors
+ *
+ * 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.
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include "energy-calendar-instance.h"
+
+using namespace chip;
+using namespace chip::app;
+using namespace chip::app::DataModel;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyCalendar;
+using namespace chip::app::Clusters::EnergyCalendar::Attributes;
+
+constexpr uint32_t kOneDay = 24 * 60 * 60;
+
+static TransitionDayOfWeekBitmap GetWeekDate(uint32_t date)
+{
+ tm calendarTime{};
+ time_t dt = date;
+ localtime_r(&dt, &calendarTime);
+ return (TransitionDayOfWeekBitmap) (calendarTime.tm_wday);
+}
+
+static uint32_t GetCurrentDateTime(void)
+{
+ System::Clock::Timestamp time = System::SystemClock().GetMonotonicTimestamp();
+ using cast = std::chrono::duration;
+ uint64_t msec = std::chrono::duration_cast(time).count();
+
+ return static_cast(msec / 1000);
+}
+
+chip::app::Clusters::EnergyCalendar::CalendarProviderInstance::~CalendarProviderInstance()
+{
+ FreeMemoryCalendarPeriodStructList(mCalendarPeriods);
+ FreeMemoryDayStructList(mSpecialDays);
+ FreeMemoryDayStruct(mCurrentDay);
+ FreeMemoryDayStruct(mNextDay);
+ if (!mName.IsNull())
+ {
+ chip::Platform::MemoryFree((void *) mName.Value().data());
+ mName.SetNull();
+ }
+}
+
+void CalendarProviderInstance::Init(void)
+{
+ SetDefault();
+}
+
+void CalendarProviderInstance::SetDefault(void)
+{
+ uint32_t date = GetCurrentDateTime();
+ uint32_t time = date % kOneDay;
+ date -= time;
+
+ Structs::DayStruct::Type day = { .date = {},
+ .transitions = {
+// { .transitionTime = 0, .PriceTier = 10},
+// { .transitionTime = 1000, .PriceTier = 20}
+ },
+ .calendarID = chip::Optional(123) };
+
+ Structs::TransitionStruct::Type * buffer =
+ (Structs::TransitionStruct::Type *) chip::Platform::MemoryCalloc(2, sizeof(Structs::TransitionStruct::Type));
+
+ day.transitions = Span(buffer, 2);
+ buffer[0].transitionTime = 0;
+ buffer[0].priceTier.SetValue(10);
+ buffer[1].transitionTime = 1000;
+ buffer[1].priceTier.SetValue(20);
+
+ Structs::PeakPeriodStruct::Type peak = {
+ .severity = PeakPeriodSeverityEnum::kHigh, .peakPeriod = 100, .startTime = 2000, .endTime = 2200
+ };
+
+ // DataModel::List calendarPeriods = {};
+ // DataModel::List specialDays = {};
+
+ char * str = (char *) chip::Platform::MemoryAlloc(5);
+ memcpy(str, "Test", 5);
+ CharSpan nameString(str, 5);
+ mName = MakeNullable(static_cast(nameString));
+
+ SetCommonAttributes(1, mName, 123, 1);
+ SetCalendarPeriod(date, mCalendarPeriods);
+ SetSpecialDays(mSpecialDays);
+ SetCurrentAndNextDays(DataModel::MakeNullable(day), DataModel::MakeNullable(day));
+ SetPeakPeriods(DataModel::MakeNullable(peak), DataModel::MakeNullable(peak));
+}
+
+CHIP_ERROR CalendarProviderInstance::LoadJson(Json::Value & root)
+{
+ DataModel::Nullable calendarID;
+ DataModel::Nullable providerID;
+ DataModel::Nullable eventID;
+ DataModel::Nullable startDate;
+ Structs::PeakPeriodStruct::Type currentPeak;
+ Structs::PeakPeriodStruct::Type nextPeak;
+
+ Json::Value value = root.get("CalendarID", Json::Value());
+ if (!value.empty() && value.isInt())
+ {
+ calendarID.SetNonNull(value.asInt());
+ }
+
+ value = root.get("Name", Json::Value());
+ if (!mName.IsNull())
+ {
+ chip::Platform::MemoryFree((void *) mName.Value().data());
+ mName.SetNull();
+ }
+ if (!value.empty() && value.isString())
+ {
+ size_t len = value.asString().size() + 1;
+ char * str = (char *) chip::Platform::MemoryAlloc(len);
+ memcpy(str, value.asCString(), len);
+ CharSpan nameString(str, len);
+ mName = MakeNullable(static_cast(nameString));
+ }
+
+ value = root.get("ProviderID", Json::Value());
+ if (!value.empty() && value.isInt())
+ {
+ providerID.SetNonNull(value.asInt());
+ }
+
+ value = root.get("EventID", Json::Value());
+ if (!value.empty() && value.isInt())
+ {
+ eventID.SetNonNull(value.asInt());
+ }
+
+ SetCommonAttributes(calendarID, mName, providerID, eventID);
+
+ value = root.get("StartDate", Json::Value());
+ if (!value.empty() && value.isInt())
+ {
+ startDate.SetNonNull(value.asInt());
+ }
+
+ value = root.get("CalendarPeriods", Json::Value());
+ FreeMemoryCalendarPeriodStructList(mCalendarPeriods);
+ if (!value.empty() && value.isArray())
+ {
+ JsonToCalendarPeriodStructList(value, mCalendarPeriods);
+ }
+ SetCalendarPeriod(startDate, mCalendarPeriods);
+
+ value = root.get("SpecialDays", Json::Value());
+ FreeMemoryDayStructList(mSpecialDays);
+ if (!value.empty() && value.isArray())
+ {
+ JsonToDayStructList(value, mSpecialDays);
+ }
+ SetSpecialDays(mSpecialDays);
+
+ value = root.get("CurrentDay", Json::Value());
+ FreeMemoryDayStruct(mCurrentDay);
+ if (!value.empty())
+ {
+ JsonToDayStruct(value, mCurrentDay);
+ }
+
+ value = root.get("NextDay", Json::Value());
+ FreeMemoryDayStruct(mNextDay);
+ if (!value.empty())
+ {
+ JsonToDayStruct(value, mNextDay);
+ }
+
+ SetCurrentAndNextDays(mCurrentDay, mNextDay);
+
+ value = root.get("CurrentPeak", Json::Value());
+ if (!value.empty())
+ {
+ JsonToPeakPeriodStruct(value, currentPeak);
+ }
+
+ value = root.get("NextPeak", Json::Value());
+ if (!value.empty())
+ {
+ JsonToPeakPeriodStruct(value, nextPeak);
+ }
+
+ SetPeakPeriods(currentPeak, nextPeak);
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR CalendarProviderInstance::GetDays(EndpointId ep, DataModel::Nullable & CurrentDay,
+ DataModel::Nullable & NextDay)
+{
+ CurrentDay = mCurrentDay;
+ NextDay = mNextDay;
+
+ return CHIP_NO_ERROR;
+}
+
+DataModel::Nullable CalendarProviderInstance::GetDay(uint32_t date)
+{
+ for (auto & day : mSpecialDays)
+ {
+ if (day.date.HasValue() && day.date.Value() == date)
+ {
+ return day;
+ }
+ }
+
+ TransitionDayOfWeekBitmap week_day = GetWeekDate(date);
+
+ for (auto & period : mCalendarPeriods)
+ {
+ if (!period.startDate.IsNull() && period.startDate.Value() < date)
+ continue;
+ for (auto & day : period.days)
+ {
+ if ((day.daysOfWeek.HasValue() && (day.daysOfWeek.Value().GetField(week_day))) ||
+ (day.date.HasValue() && (day.date.Value() == date)))
+ {
+ return day;
+ }
+ }
+ }
+
+ return DataModel::Nullable();
+}
+
+#if 0
+CHIP_ERROR EnergyCalendarContent::UpdateDateRelativeAttributes()
+{
+ uint32_t date = get_current_utc();
+ //uint32_t time = date % kOneDay;
+ //date -= time;
+
+ if ((currentDate <= date) && (date < currentDate + kOneDay))
+ {
+ return CHIP_NO_ERROR;
+ }
+
+ currentDate = date;
+ CurrentDay = nullptr;
+ NextDay = nullptr;
+ CurrentTransition = nullptr;
+ //CurrentPeakPeriod = nullptr;
+ //NextPeakPeriod = nullptr;
+
+ CurrentDay = EnergyCalendarContent::GetDay(date);
+ if (!CurrentDay.IsNull())
+ {
+ auto &day = CurrentDay.Value();
+ currentDate = day.Date;
+ auto transition_iterator = day.Transitions.begin();
+ uint32_t next_tr_time = kOneDay;
+
+ while (transition_iterator.Next())
+ {
+ auto & transition = transition_iterator.GetValue();
+ auto tr_time = transition.TransitionTime;
+ if (tr_time <= time && (CurrentTransition == nullptr || CurrentTransition.TransitionTime < tr_time))
+ {
+ CurrentTransition = transition;
+ }
+ if ((time > tr_time) && (time < next_tr_time))
+ {
+ next_tr_time = time;
+ }
+ }
+
+ //CurrentPeakPeriod.Value() = DayToPeak(day);
+ }
+
+ NextDay = EnergyCalendarContent::GetDay(date + kOneDay);
+ //if (!NextDay.IsNull())
+ //{
+ // NexytPeakPeriod.Value() = DayToPeak(NextDay.Value());
+ //}
+
+ return CHIP_NO_ERROR;
+}
+
+#endif
+
+bool CalendarProviderInstance::CheckPeriods()
+{
+ uint32_t date = 0;
+ for (auto & period : mCalendarPeriods)
+ {
+ if (!period.startDate.IsNull())
+ {
+ if (period.startDate.Value() < date)
+ {
+ return false;
+ }
+ date = period.startDate.Value();
+ }
+
+ for (auto & day : period.days)
+ {
+ if (!CheckDay(day))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CalendarProviderInstance::CheckSpecialDays()
+{
+ uint32_t date = 0;
+ for (auto & day : mSpecialDays)
+ {
+ if (!day.daysOfWeek.HasValue() || !day.calendarID.HasValue() || !CheckDay(day) || day.date.HasValue() ||
+ day.date.Value() > date)
+ {
+ return false;
+ }
+ date = day.date.Value();
+ }
+
+ return true;
+}
+
+bool CalendarProviderInstance::CheckDay(const Structs::DayStruct::Type & day)
+{
+ if ((day.daysOfWeek.HasValue() && day.date.HasValue()) || (!day.daysOfWeek.HasValue() && !day.date.HasValue()))
+ {
+ return false;
+ }
+
+ if (day.transitions.size() == 0)
+ {
+ return false;
+ }
+
+ uint32_t time = 0;
+ for (auto & transition : day.transitions)
+ {
+ auto tr_time = transition.transitionTime;
+ if (tr_time < time)
+ {
+ return false;
+ }
+ time = tr_time;
+ }
+
+ return true;
+}
+
+void CalendarProviderInstance::JsonToCalendarPeriodStruct(Json::Value & root, Structs::CalendarPeriodStruct::Type & value)
+{
+ Json::Value t = root.get("startDate", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.startDate.SetNonNull(t.asInt());
+ }
+
+ t = root.get("days", Json::Value());
+ if (!t.empty() && t.isArray())
+ {
+ DataModel::List * days = (DataModel::List *) &value.days;
+ JsonToDayStructList(t, *days);
+ }
+}
+
+void CalendarProviderInstance::JsonToDayStruct(Json::Value & root, Structs::DayStruct::Type & value)
+{
+ Json::Value t = root.get("date", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.date.SetValue(t.asInt());
+ }
+
+ t = root.get("daysOfWeek", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.daysOfWeek.SetValue(chip::BitMask((uint8_t) t.asInt()));
+ }
+
+ t = root.get("transitions", Json::Value());
+ if (!t.empty() && t.isArray())
+ {
+ DataModel::List * transitions =
+ (DataModel::List *) &value.transitions;
+ JsonToTransitionStructList(t, *transitions);
+ }
+
+ t = root.get("calendarID", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.calendarID.SetValue(t.asInt());
+ }
+}
+
+void CalendarProviderInstance::JsonToPeakPeriodStruct(Json::Value & root, Structs::PeakPeriodStruct::Type & value)
+{
+ Json::Value t = root.get("severity", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.severity = static_cast(t.asInt());
+ }
+
+ t = root.get("peakPeriod", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.peakPeriod = static_cast(t.asInt());
+ }
+
+ t = root.get("startTime", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.startTime.SetNonNull(t.asInt());
+ }
+
+ t = root.get("endTime", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value.endTime.SetNonNull(t.asInt());
+ }
+}
+
+void CalendarProviderInstance::JsonToCalendarPeriodStructList(Json::Value & root,
+ DataModel::List & value)
+{
+ Structs::CalendarPeriodStruct::Type * buffer = (Structs::CalendarPeriodStruct::Type *) chip::Platform::MemoryCalloc(
+ root.size(), sizeof(Structs::CalendarPeriodStruct::Type));
+
+ value = Span(buffer, root.size());
+
+ for (Json::ArrayIndex i = 0; i < root.size(); ++i)
+ {
+ Json::Value v = root[i];
+ JsonToCalendarPeriodStruct(root[i], value[i]);
+ }
+}
+
+void CalendarProviderInstance::JsonToDayStructList(Json::Value & root, DataModel::List & value)
+{
+ Structs::DayStruct::Type * buffer =
+ (Structs::DayStruct::Type *) chip::Platform::MemoryCalloc(root.size(), sizeof(Structs::DayStruct::Type));
+
+ value = Span(buffer, root.size());
+
+ for (Json::ArrayIndex i = 0; i < root.size(); ++i)
+ {
+ Json::Value v = root[i];
+ JsonToDayStruct(root[i], value[i]);
+ }
+}
+
+void CalendarProviderInstance::JsonToTransitionStructList(Json::Value & root,
+ DataModel::List & value)
+{
+ Structs::TransitionStruct::Type * buffer =
+ (Structs::TransitionStruct::Type *) chip::Platform::MemoryCalloc(root.size(), sizeof(Structs::TransitionStruct::Type));
+
+ value = Span(buffer, root.size());
+
+ for (Json::ArrayIndex i = 0; i < root.size(); ++i)
+ {
+ Json::Value v = root[i];
+
+ Json::Value t = v.get("transitionTime", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value[i].transitionTime = static_cast(t.asInt());
+ }
+
+ t = v.get("priceTier", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value[i].priceTier.SetValue(t.asInt());
+ }
+
+ t = v.get("friendlyCredit", Json::Value());
+ if (!t.empty() && t.isBool())
+ {
+ value[i].friendlyCredit.SetValue(t.asBool());
+ }
+
+ t = v.get("auxiliaryLoad", Json::Value());
+ if (!t.empty() && t.isInt())
+ {
+ value[i].auxiliaryLoad.SetValue(chip::BitMask((uint8_t) t.asInt()));
+ }
+ }
+}
+
+void CalendarProviderInstance::FreeMemoryDayStruct(Structs::DayStruct::Type & value)
+{
+ DataModel::List tmp;
+ std::swap(tmp, value.transitions);
+ chip::Platform::MemoryFree((void *) tmp.data());
+}
+
+void CalendarProviderInstance::FreeMemoryDayStructList(DataModel::List & value)
+{
+ for (auto & item : value)
+ {
+ FreeMemoryDayStruct(item);
+ }
+ chip::Platform::MemoryFree(value.data());
+ value = Span();
+}
+
+void CalendarProviderInstance::FreeMemoryCalendarPeriodStruct(Structs::CalendarPeriodStruct::Type & value)
+{
+ for (auto & item : value.days)
+ {
+ Structs::DayStruct::Type * day = (Structs::DayStruct::Type *) &item;
+ FreeMemoryDayStruct(*day);
+ }
+
+ DataModel::List tmp;
+ std::swap(tmp, value.days);
+ chip::Platform::MemoryFree((void *) tmp.data());
+}
+
+void CalendarProviderInstance::FreeMemoryCalendarPeriodStructList(DataModel::List & value)
+{
+ for (auto & item : value)
+ {
+ FreeMemoryCalendarPeriodStruct(item);
+ }
+ chip::Platform::MemoryFree(value.data());
+ value = Span();
+}
+
+static std::unique_ptr gMIDelegate;
+static std::unique_ptr gMIInstance;
+
+void emberAfEnergyCalendarClusterInitCallback(chip::EndpointId endpointId)
+{
+ VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
+ VerifyOrDie(!gMIInstance);
+
+ gMIDelegate = std::make_unique(endpointId);
+ if (gMIDelegate)
+ {
+ gMIDelegate->Init();
+
+ gMIInstance = std::make_unique(BitMask(
+ Feature::kPricingTier, Feature::kFriendlyCredit, Feature::kAuxiliaryLoad, Feature::kPeakPeriod));
+
+ gMIInstance->AddCalendarProvider(&(*gMIDelegate));
+ }
+}
+
+CalendarProviderInstance * chip::app::Clusters::EnergyCalendar::GetProvider()
+{
+ return &(*gMIDelegate);
+}
diff --git a/examples/all-clusters-app/all-clusters-common/src/meter-identification-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/meter-identification-stub.cpp
new file mode 100644
index 00000000000000..b75172951946a4
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/src/meter-identification-stub.cpp
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include
+
+using namespace chip;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::MeterIdentification;
+using Feature = chip::app::Clusters::MeterIdentification::Feature;
+
+static std::unique_ptr gMIDelegate;
+static std::unique_ptr gMIInstance;
+
+void emberAfMeterIdentificationClusterInitCallback(chip::EndpointId endpointId)
+{
+ VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
+ VerifyOrDie(!gMIInstance);
+
+ gMIDelegate = std::make_unique();
+ if (gMIDelegate)
+ {
+ gMIDelegate->Init();
+
+ gMIInstance = std::make_unique(endpointId, *gMIDelegate,
+ BitMask(Feature::kPowerThreshold));
+
+ gMIInstance->Init();
+ }
+}
+
+MeterIdentificationDelegate * chip::app::Clusters::MeterIdentification::GetDelegate()
+{
+ return &(*gMIDelegate);
+}
diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp
index 8effe6426cc49d..bc70767a252094 100644
--- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp
+++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp
@@ -28,6 +28,8 @@
#include
#include
+#include "energy-calendar-instance.h"
+#include
#include
#include
#include
@@ -190,6 +192,14 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context)
std::string operation = self->mJsonValue["Operation"].asString();
self->OnOperationalStateChange(device, operation, self->mJsonValue["Param"]);
}
+ else if (name == "EnergyCalendar")
+ {
+ self->OnEnergyCalendarHandler(self->mJsonValue);
+ }
+ else if (name == "MeterIdentification")
+ {
+ self->OnMeterIdentificationHandler(self->mJsonValue);
+ }
else
{
ChipLogError(NotSpecified, "Unhandled command: Should never happens");
@@ -495,6 +505,18 @@ void AllClustersAppCommandHandler::OnOperationalStateChange(std::string device,
}
}
+void AllClustersAppCommandHandler::OnEnergyCalendarHandler(Json::Value param)
+{
+ EnergyCalendar::CalendarProviderInstance * provider = EnergyCalendar::GetProvider();
+ provider->LoadJson(param);
+}
+
+void AllClustersAppCommandHandler::OnMeterIdentificationHandler(Json::Value param)
+{
+ MeterIdentification::MeterIdentificationDelegate * delegate = MeterIdentification::GetDelegate();
+ delegate->LoadJson(param);
+}
+
void AllClustersAppCommandHandler::OnAirQualityChange(uint32_t aNewValue)
{
AirQuality::Instance * airQualityInstance = AirQuality::GetInstance();
diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h
index f097c539b54fb6..042b53bd4d7b61 100644
--- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h
+++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h
@@ -105,6 +105,16 @@ class AllClustersAppCommandHandler
* Should be called when it is necessary to change the operational state as a manual operation.
*/
void OnOperationalStateChange(std::string device, std::string operation, Json::Value param);
+
+ /**
+ * Should be called when it is necessary to change one or some attributes.
+ */
+ void OnEnergyCalendarHandler(Json::Value param);
+
+ /**
+ * Should be called when it is necessary to change one or some attributes.
+ */
+ void OnMeterIdentificationHandler(Json::Value param);
};
class AllClustersCommandDelegate : public NamedPipeCommandDelegate
diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn
index 3d52ef748de90d..ce71836a757aa5 100644
--- a/examples/all-clusters-app/linux/BUILD.gn
+++ b/examples/all-clusters-app/linux/BUILD.gn
@@ -39,12 +39,14 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp",
+ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-calendar-instance.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp",
+ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/meter-identification-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp",
@@ -63,6 +65,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
+ "${chip_root}/examples/energy-management-app/energy-management-common/src/MeterIdentificationDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
"AllClustersCommandDelegate.cpp",
diff --git a/examples/energy-management-app/energy-management-common/include/MeterIdentificationDelegate.h b/examples/energy-management-app/energy-management-common/include/MeterIdentificationDelegate.h
new file mode 100644
index 00000000000000..a9a03e90ba8700
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/MeterIdentificationDelegate.h
@@ -0,0 +1,91 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+#pragma once
+
+#include
+#include
+#include
+#include
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace MeterIdentification {
+
+class MeterIdentificationDelegate : public MeterIdentification::Delegate
+{
+public:
+ ~MeterIdentificationDelegate() = default;
+
+ void Init();
+
+ CHIP_ERROR LoadJson(Json::Value & root);
+
+ // Attribute Accessors
+
+ DataModel::Nullable GetMeterType() override { return mMeterType; };
+ CharSpan GetUtilityName() override { return mUtilityName; };
+ CharSpan GetPointOfDelivery() override { return mPointOfDelivery; };
+ DataModel::Nullable GetPowerThreshold() override { return mPowerThreshold; };
+ DataModel::Nullable GetPowerThresholdSource() override { return mPowerThresholdSource; };
+
+ // Internal Application API to set attribute values
+ CHIP_ERROR SetMeterType(DataModel::Nullable);
+ CHIP_ERROR SetUtilityName(CharSpan value);
+ CHIP_ERROR SetPointOfDelivery(CharSpan value);
+ CHIP_ERROR SetPowerThreshold(DataModel::Nullable);
+ CHIP_ERROR SetPowerThresholdSource(DataModel::Nullable);
+
+private:
+ // Attribute storage
+ DataModel::Nullable mMeterType;
+ CharSpan mUtilityName;
+ CharSpan mPointOfDelivery;
+ DataModel::Nullable mPowerThreshold;
+ DataModel::Nullable mPowerThresholdSource;
+};
+
+class MeterIdentificationInstance : public Instance
+{
+public:
+ MeterIdentificationInstance(EndpointId aEndpointId, MeterIdentificationDelegate & aDelegate, Feature aFeature) :
+ MeterIdentification::Instance(aEndpointId, aDelegate, aFeature)
+ {
+ mDelegate = &aDelegate;
+ }
+
+ // Delete copy constructor and assignment operator.
+ MeterIdentificationInstance(const MeterIdentificationInstance &) = delete;
+ MeterIdentificationInstance(const MeterIdentificationInstance &&) = delete;
+ MeterIdentificationInstance & operator=(const MeterIdentificationInstance &) = delete;
+
+ CHIP_ERROR Init();
+ void Shutdown();
+
+ MeterIdentificationDelegate * GetDelegate() { return mDelegate; };
+
+private:
+ MeterIdentificationDelegate * mDelegate;
+};
+
+MeterIdentificationDelegate * GetDelegate();
+
+} // namespace MeterIdentification
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/src/MeterIdentificationDelegate.cpp b/examples/energy-management-app/energy-management-common/src/MeterIdentificationDelegate.cpp
new file mode 100644
index 00000000000000..986130bd99ee34
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/MeterIdentificationDelegate.cpp
@@ -0,0 +1,214 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include
+#include
+
+#include
+
+using namespace chip;
+using namespace chip::app;
+using namespace chip::app::DataModel;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::MeterIdentification;
+using namespace chip::app::Clusters::MeterIdentification::Attributes;
+
+using chip::app::Clusters::MeterIdentification::MeterTypeEnum;
+using chip::app::Clusters::MeterIdentification::PowerThresholdSourceEnum;
+
+CHIP_ERROR MeterIdentificationInstance::Init()
+{
+ return Instance::Init();
+}
+
+void MeterIdentificationInstance::Shutdown()
+{
+ Instance::Shutdown();
+}
+
+// --------------- Internal Attribute Set APIs
+
+void MeterIdentificationDelegate::Init()
+{
+ ChipLogProgress(Zcl, "MeterIdentificationDelegate::Init");
+
+ SetMeterType(MeterTypeEnum::kPrivate);
+ SetUtilityName(CharSpan::fromCharString("Test Utility Name"));
+ SetPointOfDelivery(CharSpan::fromCharString("Test PointOfDelivery"));
+ SetPowerThreshold(100);
+ SetPowerThresholdSource(PowerThresholdSourceEnum::kEquipment);
+}
+
+CHIP_ERROR MeterIdentificationDelegate::LoadJson(Json::Value & root)
+{
+ Json::Value value = root.get("MeterType", Json::Value());
+ if (!value.empty())
+ {
+ if(value.isInt())
+ {
+ SetMeterType(static_cast(value.asInt()));
+ }
+ else
+ {
+ SetMeterType(std::nullopt);
+ }
+ }
+
+ value = root.get("UtilityName", Json::Value());
+ if (!value.empty())
+ {
+ if(value.isString())
+ {
+ SetUtilityName(CharSpan::fromCharString(value.asCString()));
+ }
+ else
+ {
+ SetUtilityName(CharSpan());
+ }
+ }
+
+ value = root.get("PointOfDelivery", Json::Value());
+ if (!value.empty())
+ {
+ if(value.isString())
+ {
+ SetPointOfDelivery(CharSpan::fromCharString(value.asCString()));
+ }
+ else
+ {
+ SetPointOfDelivery(CharSpan());
+ }
+ }
+
+ value = root.get("PowerThreshold", Json::Value());
+ if (!value.empty())
+ {
+ if(value.isInt())
+ {
+ SetPowerThreshold(value.asInt());
+ }
+ else
+ {
+ SetPowerThreshold(std::nullopt);
+ }
+ }
+
+ value = root.get("PowerThresholdSource", Json::Value());
+ if (!value.empty())
+ {
+ if(value.isInt())
+ {
+ SetPowerThresholdSource(static_cast(value.asInt()));
+ }
+ else
+ {
+ SetPowerThresholdSource(std::nullopt);
+ }
+ }
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR MeterIdentificationDelegate::SetMeterType(DataModel::Nullable newValue)
+{
+ // DataModel::Nullable oldValue = mMeterType;
+
+ mMeterType = newValue;
+ // if (oldValue != newValue)
+ //{
+ MatterReportingAttributeChangeCallback(mEndpointId, MeterIdentification::Id, MeterType::Id);
+ // }
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR MeterIdentificationDelegate::SetUtilityName(CharSpan newValue)
+{
+ // CharSpan oldValue = mUtilityName;
+
+ chip::Platform::MemoryFree((void*)mUtilityName.data());
+ if (!newValue.empty())
+ {
+ size_t len = newValue.size();
+ char *str = (char*)chip::Platform::MemoryAlloc(len);
+ memcpy(str, newValue.data(), len);
+ mUtilityName = CharSpan(str, len);
+ }
+ else
+ {
+ mUtilityName = CharSpan();
+ }
+
+ // if (!oldValue.data_equal(newValue))
+ //{
+ // MatterReportingAttributeChangeCallback(mEndpointId, MeterIdentification::Id, UtilityName::Id);
+ // }
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR MeterIdentificationDelegate::SetPointOfDelivery(CharSpan newValue)
+{
+ // CharSpan oldValue = mPointOfDelivery;
+
+ chip::Platform::MemoryFree((void*)mPointOfDelivery.data());
+ if (!newValue.empty())
+ {
+ size_t len = newValue.size();
+ char *str = (char*)chip::Platform::MemoryAlloc(len);
+ memcpy(str, newValue.data(), len);
+ mPointOfDelivery = CharSpan(str, len);
+ }
+ else
+ {
+ mPointOfDelivery = CharSpan();
+ }
+
+ // if (!oldValue.data_equal(newValue))
+ //{
+ // MatterReportingAttributeChangeCallback(mEndpointId, MeterIdentification::Id, PointOfDelivery::Id);
+ // }
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR MeterIdentificationDelegate::SetPowerThreshold(DataModel::Nullable newValue)
+{
+ // DataModel::Nullable oldValue = mPowerThreshold;
+
+ mPowerThreshold = newValue;
+ // if (oldValue != newValue)
+ //{
+ // MatterReportingAttributeChangeCallback(mEndpointId, MeterIdentification::Id, PowerThreshold::Id);
+ // }
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR MeterIdentificationDelegate::SetPowerThresholdSource(DataModel::Nullable newValue)
+{
+ // DataModel::Nullable oldValue = mPowerThresholdSource;
+
+ mPowerThresholdSource = newValue;
+ // if (oldValue != newValue)
+ //{
+ // MatterReportingAttributeChangeCallback(mEndpointId, MeterIdentification::Id, PowerThresholdSource::Id);
+ // }
+
+ return CHIP_NO_ERROR;
+}
diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/large_all_clusters_app/cpp-app/cluster-init-callback.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/large_all_clusters_app/cpp-app/cluster-init-callback.cpp
index 8144c53c404e9f..78b2327f80e5cd 100644
--- a/scripts/py_matter_idl/matter_idl/tests/outputs/large_all_clusters_app/cpp-app/cluster-init-callback.cpp
+++ b/scripts/py_matter_idl/matter_idl/tests/outputs/large_all_clusters_app/cpp-app/cluster-init-callback.cpp
@@ -64,6 +64,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case app::Clusters::DoorLock::Id:
emberAfDoorLockClusterInitCallback(endpoint);
break;
+ case app::Clusters::EnergyCalendar::Id:
+ emberAfEnergyCalendarClusterInitCallback(endpoint);
+ break;
case app::Clusters::ElectricalMeasurement::Id:
emberAfElectricalMeasurementClusterInitCallback(endpoint);
break;
@@ -121,6 +124,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case app::Clusters::MediaPlayback::Id:
emberAfMediaPlaybackClusterInitCallback(endpoint);
break;
+ case app::Clusters::MeterIdentification::Id:
+ emberAfMeterIdentificationClusterInitCallback(endpoint);
+ break;
case app::Clusters::ModeSelect::Id:
emberAfModeSelectClusterInitCallback(endpoint);
break;
diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint
index 335e37436be00c..0495da8aac2837 100644
--- a/scripts/rules.matterlint
+++ b/scripts/rules.matterlint
@@ -29,7 +29,9 @@ load "../src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode
load "../src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml";
+load "../src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml";
+load "../src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml";
diff --git a/src/app/clusters/energy-calendar-server/energy-calendar-server.cpp b/src/app/clusters/energy-calendar-server/energy-calendar-server.cpp
new file mode 100644
index 00000000000000..04afab9f4618cc
--- /dev/null
+++ b/src/app/clusters/energy-calendar-server/energy-calendar-server.cpp
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2024 Project CHIP Authors
+ *
+ * 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.
+ */
+
+#include "energy-calendar-server.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace chip;
+using namespace chip::app;
+using namespace chip::app::DataModel;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyCalendar;
+using namespace chip::app::Clusters::EnergyCalendar::Attributes;
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyCalendar {
+
+constexpr uint32_t kSecInOneDay = 60 * 60 * 24;
+
+#if 0
+static TransitionDayOfWeekBitmap GetWeekDate(uint32_t date)
+{
+ tm calendarTime{};
+ time_t tm = date;
+ localtime_r(&tm, &calendarTime);
+ return (TransitionDayOfWeekBitmap)(calendarTime.tm_wday);
+}
+#endif
+
+static uint32_t GetCurrentTime(void)
+{
+ System::Clock::Timestamp time = System::SystemClock().GetMonotonicTimestamp();
+ using cast = std::chrono::duration;
+ uint64_t msec = std::chrono::duration_cast(time).count();
+
+ uint32_t sec = static_cast((msec / 1000) % kSecInOneDay);
+ return sec;
+}
+
+void LockThreadTask(void)
+{
+ chip::DeviceLayer::ThreadStackMgr().LockThreadStack();
+}
+
+void UnlockThreadTask(void)
+{
+ chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack();
+}
+
+CHIP_ERROR CalendarProvider::SetCommonAttributes(DataModel::Nullable CalendarID, DataModel::Nullable Name,
+ DataModel::Nullable ProviderID, DataModel::Nullable EventID)
+{
+ bool change;
+
+ change = _calendarID != CalendarID;
+ if (change)
+ {
+ _calendarID.SetNonNull(*CalendarID);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, CalendarID::Id);
+ }
+
+ change = true; // Name != _name;
+ if (change)
+ {
+ _name.SetNonNull(*Name);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, Name::Id);
+ }
+
+ change = ProviderID != _providerID;
+ if (change)
+ {
+ _providerID.SetNonNull(*ProviderID);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, ProviderID::Id);
+ }
+
+ change = EventID != _eventID;
+ if (change)
+ {
+ _eventID.SetNonNull(*EventID);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, EventID::Id);
+ }
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR CalendarProvider::SetCalendarPeriod(DataModel::Nullable StartDate,
+ DataModel::List CalendarPeriods)
+{
+ bool change;
+
+ LockThreadTask();
+
+ change = StartDate != _startDate;
+ if (change)
+ {
+ _startDate.SetNonNull(*StartDate);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, StartDate::Id);
+ }
+
+ _calendarPeriods = CalendarPeriods;
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, CalendarPeriods::Id);
+
+ UnlockThreadTask();
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR CalendarProvider::SetSpecialDays(DataModel::List SpecialDays)
+{
+ LockThreadTask();
+
+ _specialDays = SpecialDays;
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, SpecialDays::Id);
+
+ UnlockThreadTask();
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR CalendarProvider::SetCurrentAndNextDays(DataModel::Nullable CurrentDay,
+ DataModel::Nullable NextDay)
+{
+ bool change;
+
+ LockThreadTask();
+
+ change = true; // *CurrentDay != *_currentDay;
+ if (change)
+ {
+ _currentDay.SetNonNull(*CurrentDay);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, CurrentDay::Id);
+ }
+
+ change = true; // *NextDay != *_nextDay;
+ if (change)
+ {
+ _nextDay.SetNonNull(*NextDay);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, NextDay::Id);
+ }
+
+ UnlockThreadTask();
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR CalendarProvider::SetPeakPeriods(DataModel::Nullable CurrentPeakPeriod,
+ DataModel::Nullable NextPeakPeriod)
+{
+ bool change;
+ LockThreadTask();
+
+ change = true; // CurrentPeakPeriod != _currentPeakPeriod;
+ if (change)
+ {
+ _currentPeakPeriod.SetNonNull(*CurrentPeakPeriod);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, CurrentPeakPeriod::Id);
+ }
+
+ change = true; // NextPeakPeriod != _nextPeakPeriod;
+ if (change)
+ {
+ _nextPeakPeriod.SetNonNull(*NextPeakPeriod);
+ // MatterReportingAttributeChangeCallback(_endpoint, EnergyCalendar::Id, NextPeakPeriod::Id);
+ }
+
+ UnlockThreadTask();
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR CalendarProvider::UpdateDays(void)
+{
+ CHIP_ERROR status;
+ DataModel::Nullable currentDay;
+ DataModel::Nullable nextDay;
+
+ status = GetDays(_endpoint, currentDay, nextDay);
+ if (status == CHIP_NO_ERROR)
+ {
+ status = SetCurrentAndNextDays(currentDay, nextDay);
+ }
+
+ return status;
+}
+
+EnergyCalendarServer::EnergyCalendarServer() : AttributeAccessInterface(NullOptional, EnergyCalendar::Id), feature(0)
+{
+ uint32_t time = GetCurrentTime();
+
+ chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(kSecInOneDay - time), MidnightTimerCallback, this);
+}
+
+EnergyCalendarServer::EnergyCalendarServer(Feature aFeature) :
+ AttributeAccessInterface(NullOptional, EnergyCalendar::Id), feature(aFeature)
+{
+ uint32_t time = GetCurrentTime();
+
+ chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(kSecInOneDay - time), MidnightTimerCallback, this);
+}
+
+bool EnergyCalendarServer::HasFeature(Feature aFeature) const
+{
+ return feature.Has(aFeature);
+}
+
+CHIP_ERROR EnergyCalendarServer::AddCalendarProvider(CalendarProvider * provider)
+{
+ for (auto i = 0; i < kNumSupportedEndpoints; ++i)
+ {
+ if (calendars[i] == nullptr)
+ {
+ calendars[i] = provider;
+ return CHIP_NO_ERROR;
+ }
+ }
+ return CHIP_ERROR_NO_MEMORY;
+}
+
+CalendarProvider * EnergyCalendarServer::GetProvider(EndpointId ep)
+{
+ for (auto i = 0; i < kNumSupportedEndpoints; ++i)
+ {
+ if (calendars[i] != nullptr && calendars[i]->endpoint() == ep)
+ {
+ return calendars[i];
+ }
+ }
+ return nullptr;
+}
+
+DataModel::Nullable EnergyCalendarServer::GetTransition(EndpointId ep)
+{
+ CalendarProvider * provider = GetProvider(ep);
+ if (provider == nullptr || provider->GetCurrentDay().IsNull())
+ {
+ return DataModel::Nullable();
+ }
+
+ Structs::DayStruct::Type & currentDay = provider->GetCurrentDay().Value();
+
+ uint32_t time = GetCurrentTime();
+
+ auto transition = currentDay.transitions.begin();
+ uint32_t next_tr_time = kSecInOneDay;
+
+ const Structs::TransitionStruct::Type * current = nullptr;
+
+ while (transition != currentDay.transitions.end())
+ {
+ auto tr_time = transition->transitionTime;
+ if (tr_time <= time && (current == nullptr || current->transitionTime < tr_time))
+ {
+ current = transition;
+ }
+ if ((time > tr_time) && (time < next_tr_time))
+ {
+ next_tr_time = time;
+ }
+ }
+ return DataModel::Nullable(*current);
+}
+
+// AttributeAccessInterface
+CHIP_ERROR EnergyCalendarServer::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
+{
+ CalendarProvider * provider = GetProvider(aPath.mEndpointId);
+ switch (aPath.mAttributeId)
+ {
+ case CalendarID::Id:
+ return aEncoder.Encode(provider->GetCalendarID());
+ case Name::Id:
+ return aEncoder.Encode(provider->GetName());
+ /* case ProviderID::Id:
+ return aEncoder.Encode(provider->GetProviderID());
+ case EventID::Id:
+ return aEncoder.Encode(provider->GetEventID());
+ case StartDate::Id:
+ return aEncoder.Encode(provider->GetStartDate());
+ case CalendarPeriods::Id:
+ return aEncoder.Encode(provider->GetCalendarPeriods());
+ case SpecialDays::Id:
+ return aEncoder.Encode(provider->GetSpecialDays());
+ */ /* Date relative attributes */
+ /* case CurrentDay::Id:
+ return aEncoder.Encode(provider->GetCurrentDay());
+ case NextDay::Id:
+ return aEncoder.Encode(provider->GetNextDay());
+ case CurrentTransition::Id:
+ return aEncoder.Encode(GetTransition(aPath.mEndpointId));
+ case CurrentPeakPeriod::Id:
+ return aEncoder.Encode(provider->GetCurrentPeakPeriod());
+ case NextPeakPeriod::Id:
+ return aEncoder.Encode(provider->GetNextPeakPeriod());
+ */
+ /* FeatureMap - is held locally */
+ case FeatureMap::Id:
+ return aEncoder.Encode(feature);
+ }
+
+ /* Allow all other unhandled attributes to fall through to Ember */
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR EnergyCalendarServer::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
+{
+ switch (aPath.mAttributeId)
+ {
+ default:
+ // Unknown attribute; return error. None of the other attributes for
+ // this cluster are writable, so should not be ending up in this code to
+ // start with.
+ return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+ }
+}
+
+// void EnergyCalendarServer::InvokeCommand(HandlerContext & handlerContext)
+//{
+// //using namespace Commands;
+//
+// //switch (handlerContext.mRequestPath.mCommandId)
+// //{
+// //}
+// return;
+// }
+
+void EnergyCalendarServer::MidnightTimerCallback(chip::System::Layer *, void * callbackContext)
+{
+ EnergyCalendarServer * instance = (EnergyCalendarServer *) callbackContext;
+
+ for (int i = 0; i < kNumSupportedEndpoints; ++i)
+ {
+ if (instance->calendars[i] != nullptr)
+ {
+ instance->calendars[i]->UpdateDays();
+ }
+ }
+
+ uint32_t time = GetCurrentTime();
+ chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(kSecInOneDay - time), MidnightTimerCallback,
+ callbackContext);
+}
+
+} // namespace EnergyCalendar
+} // namespace Clusters
+} // namespace app
+} // namespace chip
+
+// -----------------------------------------------------------------------------
+// Plugin initialization
+
+void MatterEnergyCalendarPluginServerInitCallback() {}
diff --git a/src/app/clusters/energy-calendar-server/energy-calendar-server.h b/src/app/clusters/energy-calendar-server/energy-calendar-server.h
new file mode 100644
index 00000000000000..7c9ab868dd05f7
--- /dev/null
+++ b/src/app/clusters/energy-calendar-server/energy-calendar-server.h
@@ -0,0 +1,142 @@
+/*
+ *
+ * Copyright (c) 2023 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyCalendar {
+
+// Spec-defined constants
+constexpr uint32_t kMaximumNameLenght = 12;
+constexpr uint32_t kMinimumCalendarPeriodsLength = 1;
+constexpr uint32_t kMaximumCalendarPeriodsLength = 4;
+constexpr uint32_t kMaximumSpecialDaysLength = 50;
+
+constexpr int kNumSupportedEndpoints = 1;
+
+/** @brief
+ * CalendarProvider is interface of the Calendar Provider
+ */
+class CalendarProvider
+{
+public:
+ CalendarProvider(EndpointId ep) : _endpoint(ep) {}
+ virtual ~CalendarProvider() = default;
+
+ EndpointId endpoint() const { return _endpoint; };
+
+ CHIP_ERROR SetCommonAttributes(DataModel::Nullable CalendarID, DataModel::Nullable Name,
+ DataModel::Nullable ProviderID, DataModel::Nullable EventID);
+
+ CHIP_ERROR SetCalendarPeriod(DataModel::Nullable StartDate,
+ DataModel::List CalendarPeriods);
+
+ CHIP_ERROR SetSpecialDays(DataModel::List SpecialDays);
+
+ CHIP_ERROR SetCurrentAndNextDays(DataModel::Nullable CurrentDay,
+ DataModel::Nullable NextDay);
+
+ CHIP_ERROR SetPeakPeriods(DataModel::Nullable CurrentPeakPeriod,
+ DataModel::Nullable NextPeakPeriod);
+
+ CHIP_ERROR UpdateDays(void);
+
+ virtual CHIP_ERROR GetDays(EndpointId ep, DataModel::Nullable & CurrentDay,
+ DataModel::Nullable & NextDay) = 0;
+
+ DataModel::Nullable GetCalendarID(void) { return _calendarID; }
+ DataModel::Nullable GetName(void) { return _name; }
+ DataModel::Nullable GetProviderID(void) { return _providerID; }
+ DataModel::Nullable GetEventID(void) { return _eventID; }
+ DataModel::Nullable GetStartDate(void) { return _startDate; }
+ DataModel::List GetCalendarPeriods(void) { return _calendarPeriods; }
+ DataModel::List GetSpecialDays(void) { return _specialDays; }
+ DataModel::Nullable GetCurrentDay(void) { return _currentDay; }
+ DataModel::Nullable GetNextDay(void) { return _nextDay; }
+ // DataModel::Nullable GetCurrentTransition(_void);
+ DataModel::Nullable GetCurrentPeakPeriod(void) { return _currentPeakPeriod; }
+ DataModel::Nullable GetNextPeakPeriod(void) { return _nextPeakPeriod; }
+
+private:
+ EndpointId _endpoint;
+
+ DataModel::Nullable _calendarID;
+ DataModel::Nullable _name;
+ DataModel::Nullable _providerID;
+ DataModel::Nullable _eventID;
+ DataModel::Nullable _startDate;
+ DataModel::List _calendarPeriods;
+ DataModel::List _specialDays;
+ DataModel::Nullable _currentDay;
+ DataModel::Nullable _nextDay;
+ // Structs::TransitionStruct::Type _currentTransition;
+ DataModel::Nullable _currentPeakPeriod;
+ DataModel::Nullable _nextPeakPeriod;
+};
+
+/** @brief
+ * EnergyCalendarServer implements both Attributes and Commands
+ */
+class EnergyCalendarServer : public AttributeAccessInterface
+{
+public:
+ EnergyCalendarServer();
+ EnergyCalendarServer(Feature aFeature);
+
+ bool HasFeature(Feature aFeature) const;
+
+ CHIP_ERROR AddCalendarProvider(CalendarProvider * provider);
+
+ //(...)
+ // Attributes
+ CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;
+ CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override;
+
+ // Commands
+ // void InvokeCommand(HandlerContext & ctx) override;
+
+private:
+ BitMask feature;
+ CalendarProvider * calendars[kNumSupportedEndpoints] = { 0 };
+
+ void UpdateCurrentAttrs(void);
+ CalendarProvider * GetProvider(EndpointId ep);
+ DataModel::Nullable GetTransition(EndpointId ep);
+
+ static void MidnightTimerCallback(chip::System::Layer *, void * callbackContext);
+};
+
+} // namespace EnergyCalendar
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/src/app/clusters/meter-identification-server/meter-identification-server.cpp b/src/app/clusters/meter-identification-server/meter-identification-server.cpp
new file mode 100644
index 00000000000000..cb5e11951f1ffe
--- /dev/null
+++ b/src/app/clusters/meter-identification-server/meter-identification-server.cpp
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+#include "meter-identification-server.h"
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+using namespace chip;
+using namespace chip::app;
+using namespace chip::app::DataModel;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::MeterIdentification;
+using namespace chip::app::Clusters::MeterIdentification::Attributes;
+
+using chip::Protocols::InteractionModel::Status;
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace MeterIdentification {
+
+CHIP_ERROR Instance::Init()
+{
+ VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE);
+ return CHIP_NO_ERROR;
+}
+
+void Instance::Shutdown()
+{
+ unregisterAttributeAccessOverride(this);
+}
+
+bool Instance::HasFeature(Feature aFeature) const
+{
+ return mFeature.Has(aFeature);
+}
+
+// static CHIP_ERROR EncodeStringOnSuccess(CHIP_ERROR status, AttributeValueEncoder & encoder, const char * buf, size_t maxBufSize)
+//{
+// ReturnErrorOnFailure(status);
+// return encoder.Encode(chip::CharSpan(buf, strnlen(buf, maxBufSize)));
+// }
+
+// AttributeAccessInterface
+CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
+{
+ ChipLogProgress(Zcl, "Meter Ind read attr %d", aPath.mAttributeId);
+ switch (aPath.mAttributeId)
+ {
+ case FeatureMap::Id:
+ ReturnErrorOnFailure(aEncoder.Encode(mFeature));
+ break;
+ case MeterType::Id:
+ ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetMeterType()));
+ break;
+
+ case UtilityName::Id:
+ ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetUtilityName()));
+ break;
+
+ case PointOfDelivery::Id:
+ ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetPointOfDelivery()));
+ break;
+
+ case PowerThreshold::Id:
+ ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetPowerThreshold()));
+ break;
+
+ case PowerThresholdSource::Id:
+ ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetPowerThresholdSource()));
+ break;
+ }
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
+{
+ /*
+
+ switch (aPath.mAttributeId)
+ {
+
+ default:
+ break;
+ }
+ */
+ return CHIP_NO_ERROR;
+}
+
+} // namespace MeterIdentification
+} // namespace Clusters
+} // namespace app
+} // namespace chip
+
+// -----------------------------------------------------------------------------
+// Plugin initialization
+
+void MatterMeterIdentificationPluginServerInitCallback() {}
diff --git a/src/app/clusters/meter-identification-server/meter-identification-server.h b/src/app/clusters/meter-identification-server/meter-identification-server.h
new file mode 100644
index 00000000000000..08adef122aae2c
--- /dev/null
+++ b/src/app/clusters/meter-identification-server/meter-identification-server.h
@@ -0,0 +1,84 @@
+/**
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+using chip::app::Clusters::MeterIdentification::MeterTypeEnum;
+using chip::app::Clusters::MeterIdentification::PowerThresholdSourceEnum;
+using Feature = chip::app::Clusters::MeterIdentification::Feature;
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace MeterIdentification {
+
+struct Delegate
+{
+public:
+ virtual ~Delegate() = default;
+
+ void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; }
+
+ virtual DataModel::Nullable GetMeterType() = 0;
+ virtual CharSpan GetUtilityName() = 0;
+ virtual CharSpan GetPointOfDelivery() = 0;
+ virtual DataModel::Nullable GetPowerThreshold() = 0;
+ virtual DataModel::Nullable GetPowerThresholdSource() = 0;
+
+protected:
+ EndpointId mEndpointId = 0;
+};
+
+class Instance : public AttributeAccessInterface
+{
+public:
+ Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask aFeature) :
+ AttributeAccessInterface(MakeOptional(aEndpointId), Id), mDelegate(aDelegate), mFeature(aFeature)
+ {
+ /* set the base class delegates endpointId */
+ mDelegate.SetEndpointId(aEndpointId);
+ }
+ ~Instance() { Shutdown(); }
+
+ CHIP_ERROR Init();
+ void Shutdown();
+
+ bool HasFeature(Feature aFeature) const;
+
+private:
+ Delegate & mDelegate;
+ BitMask mFeature;
+
+ // AttributeAccessInterface
+ CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;
+ CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override;
+};
+
+} // namespace MeterIdentification
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml
index 23709faca1ace5..df83054511e0af 100644
--- a/src/app/zap-templates/zcl/data-model/all.xml
+++ b/src/app/zap-templates/zcl/data-model/all.xml
@@ -112,6 +112,8 @@
+
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml
new file mode 100644
index 00000000000000..404b91048d0dd3
--- /dev/null
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Energy Management
+ Energy Calendar
+ 0x009A
+ ENERGY_CALENDAR_CLUSTER
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+ CalendarID
+ Name
+ ProviderID
+ EventID
+ StartDate
+ CalendarPeriods
+ SpecialDays
+ CurrentDay
+ NextDay
+ CurrentTransition
+ CurrentPeakPeriod
+ NextPeakPeriod
+
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml
new file mode 100644
index 00000000000000..ec84fa77a5c0ee
--- /dev/null
+++ b/src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Energy Management
+ Meter Identification
+ 0x0B06
+ METER_IDENTIFICATION_CLUSTER
+
+ true
+
+
+
+
+
+ true
+
+ MeterType
+ UtilityName
+ PointOfDelivery
+ PowerThreshold
+ PowerThresholdSource
+
+
diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
index b253dd55e72831..94c076d606becb 100644
--- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json
+++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
@@ -44,6 +44,8 @@
"dishwasher-alarm-cluster.xml",
"dishwasher-mode-cluster.xml",
"drlc-cluster.xml",
+ "energy-calendar-cluster.xml",
+ "meter-identification-cluster.xml",
"microwave-oven-mode-cluster.xml",
"microwave-oven-control-cluster.xml",
"door-lock-cluster.xml",
@@ -637,6 +639,13 @@
"NeutralCurrent",
"FeatureMap"
],
+ "Energy Calendar": [
+ "CurrentDay",
+ "NextDay",
+ "CurrentTransition",
+ "CurrentPeakPeriod",
+ "NextPeakPeriod"
+ ],
"Power Topology": ["FeatureMap"],
"Valve Configuration and Control": ["RemainingDuration"],
"Boolean State Configuration": ["CurrentSensitivityLevel"],
diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json
index 6b361e507a3cf3..fc44c7b519cc0a 100644
--- a/src/app/zap-templates/zcl/zcl.json
+++ b/src/app/zap-templates/zcl/zcl.json
@@ -42,6 +42,8 @@
"diagnostic-logs-cluster.xml",
"dishwasher-alarm-cluster.xml",
"dishwasher-mode-cluster.xml",
+ "energy-calendar-cluster.xml",
+ "meter-identification-cluster.xml",
"microwave-oven-mode-cluster.xml",
"door-lock-cluster.xml",
"drlc-cluster.xml",
@@ -635,6 +637,13 @@
"NeutralCurrent",
"FeatureMap"
],
+ "Energy Calendar": [
+ "CurrentDay",
+ "NextDay",
+ "CurrentTransition",
+ "CurrentPeakPeriod",
+ "NextPeakPeriod"
+ ],
"Power Topology": ["FeatureMap"],
"Valve Configuration and Control": ["RemainingDuration"],
"Boolean State Configuration": ["CurrentSensitivityLevel"],
diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json
index 4c7757224b1a7d..985459b333306d 100644
--- a/src/app/zap_cluster_list.json
+++ b/src/app/zap_cluster_list.json
@@ -34,6 +34,8 @@
"DIAGNOSTIC_LOGS_CLUSTER": [],
"DISHWASHER_ALARM_CLUSTER": [],
"DISHWASHER_MODE_CLUSTER": [],
+ "ENERGY_CALENDAR_CLUSTER": [],
+ "METER_IDENTIFICATION_CLUSTER": [],
"MICROWAVE_OVEN_MODE_CLUSTER": [],
"DOOR_LOCK_CLUSTER": [],
"ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [],
@@ -179,6 +181,8 @@
"DIAGNOSTIC_LOGS_CLUSTER": ["diagnostic-logs-server"],
"DISHWASHER_ALARM_CLUSTER": ["dishwasher-alarm-server"],
"DISHWASHER_MODE_CLUSTER": ["mode-base-server"],
+ "ENERGY_CALENDAR_CLUSTER": ["energy-calendar-server"],
+ "METER_IDENTIFICATION_CLUSTER": ["meter-identification-server"],
"MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"],
"DOOR_LOCK_CLUSTER": ["door-lock-server"],
"ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index a8567d591b1f7a..f74b2da8a5b9b4 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4999,6 +4999,91 @@ cluster EnergyEvse = 153 {
timed command ClearTargets(): DefaultSuccess = 7;
}
+/** */
+cluster EnergyCalendar = 154 {
+ revision 3;
+
+ enum PeakPeriodSeverityEnum : enum8 {
+ kUnused = 0;
+ kLow = 1;
+ kMedium = 2;
+ kHigh = 3;
+ }
+
+ bitmap AuxiliaryLoadBitmap : bitmap8 {
+ kAuxiliarySwitch1 = 0x1;
+ kAuxiliarySwitch2 = 0x2;
+ kAuxiliarySwitch3 = 0x4;
+ kAuxiliarySwitch4 = 0x8;
+ kAuxiliarySwitch5 = 0x10;
+ kAuxiliarySwitch6 = 0x20;
+ kAuxiliarySwitch7 = 0x40;
+ kAuxiliarySwitch8 = 0x80;
+ }
+
+ bitmap Feature : bitmap32 {
+ kPricingTier = 0x1;
+ kFriendlyCredit = 0x2;
+ kAuxiliaryLoad = 0x4;
+ kPeakPeriod = 0x8;
+ }
+
+ bitmap TransitionDayOfWeekBitmap : bitmap8 {
+ kSunday = 0x1;
+ kMonday = 0x2;
+ kTuesday = 0x4;
+ kWednesday = 0x8;
+ kThursday = 0x10;
+ kFriday = 0x20;
+ kSaturday = 0x40;
+ }
+
+ struct TransitionStruct {
+ int16u transitionTime = 0;
+ optional int32u priceTier = 1;
+ optional boolean friendlyCredit = 2;
+ optional AuxiliaryLoadBitmap auxiliaryLoad = 3;
+ }
+
+ struct DayStruct {
+ optional date date = 0;
+ optional TransitionDayOfWeekBitmap daysOfWeek = 1;
+ TransitionStruct transitions[] = 2;
+ optional int32u calendarID = 3;
+ }
+
+ struct CalendarPeriodStruct {
+ nullable epoch_s startDate = 0;
+ DayStruct days[] = 1;
+ }
+
+ struct PeakPeriodStruct {
+ PeakPeriodSeverityEnum severity = 0;
+ int16u peakPeriod = 1;
+ nullable epoch_s startTime = 2;
+ nullable epoch_s endTime = 3;
+ }
+
+ readonly attribute nullable int32u calendarID = 0;
+ readonly attribute nullable char_string<12> name = 1;
+ readonly attribute nullable int32u providerID = 2;
+ readonly attribute nullable int32u eventID = 3;
+ readonly attribute nullable epoch_s startDate = 4;
+ readonly attribute nullable CalendarPeriodStruct calendarPeriods[] = 5;
+ readonly attribute nullable DayStruct specialDays[] = 6;
+ readonly attribute nullable DayStruct currentDay = 7;
+ readonly attribute nullable DayStruct nextDay = 8;
+ readonly attribute nullable TransitionStruct currentTransition = 9;
+ readonly attribute optional nullable PeakPeriodStruct currentPeakPeriod = 10;
+ readonly attribute optional nullable PeakPeriodStruct nextPeakPeriod = 11;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+}
+
/** This cluster provides an interface to specify preferences for how devices should consume energy. */
provisional cluster EnergyPreference = 155 {
revision 1;
@@ -9275,6 +9360,39 @@ deprecated cluster ElectricalMeasurement = 2820 {
command GetMeasurementProfileCommand(GetMeasurementProfileCommandRequest): DefaultSuccess = 1;
}
+/** */
+cluster MeterIdentification = 2822 {
+ revision 1;
+
+ enum MeterTypeEnum : enum8 {
+ kUtility = 0;
+ kPrivate = 1;
+ kGeneric = 2;
+ }
+
+ enum PowerThresholdSourceEnum : enum8 {
+ kContract = 0;
+ kRegulator = 1;
+ kEquipment = 2;
+ }
+
+ bitmap Feature : bitmap32 {
+ kPowerThreshold = 0x1;
+ }
+
+ readonly attribute nullable MeterTypeEnum meterType = 0;
+ readonly attribute nullable char_string<16> utilityName = 1;
+ readonly attribute nullable char_string<16> pointOfDelivery = 2;
+ readonly attribute optional nullable power_mw powerThreshold = 3;
+ readonly attribute optional nullable PowerThresholdSourceEnum powerThresholdSource = 4;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+}
+
/** The Test Cluster is meant to validate the generated code */
internal cluster UnitTesting = 4294048773 {
revision 1; // NOTE: Default/not specifically set
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
index 4b762e1ef39f37..0e5759d7ee7851 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
@@ -32689,14 +32689,21 @@ public void onSuccess(byte[] tlv) {
}
}
- public static class EnergyPreferenceCluster extends BaseChipCluster {
- public static final long CLUSTER_ID = 155L;
-
- private static final long ENERGY_BALANCES_ATTRIBUTE_ID = 0L;
- private static final long CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID = 1L;
- private static final long ENERGY_PRIORITIES_ATTRIBUTE_ID = 2L;
- private static final long LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID = 3L;
- private static final long CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID = 4L;
+ public static class EnergyCalendarCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 154L;
+
+ private static final long CALENDAR_I_D_ATTRIBUTE_ID = 0L;
+ private static final long NAME_ATTRIBUTE_ID = 1L;
+ private static final long PROVIDER_I_D_ATTRIBUTE_ID = 2L;
+ private static final long EVENT_I_D_ATTRIBUTE_ID = 3L;
+ private static final long START_DATE_ATTRIBUTE_ID = 4L;
+ private static final long CALENDAR_PERIODS_ATTRIBUTE_ID = 5L;
+ private static final long SPECIAL_DAYS_ATTRIBUTE_ID = 6L;
+ private static final long CURRENT_DAY_ATTRIBUTE_ID = 7L;
+ private static final long NEXT_DAY_ATTRIBUTE_ID = 8L;
+ private static final long CURRENT_TRANSITION_ATTRIBUTE_ID = 9L;
+ private static final long CURRENT_PEAK_PERIOD_ATTRIBUTE_ID = 10L;
+ private static final long NEXT_PEAK_PERIOD_ATTRIBUTE_ID = 11L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
@@ -32704,7 +32711,7 @@ public static class EnergyPreferenceCluster extends BaseChipCluster {
private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
- public EnergyPreferenceCluster(long devicePtr, int endpointId) {
+ public EnergyCalendarCluster(long devicePtr, int endpointId) {
super(devicePtr, endpointId, CLUSTER_ID);
}
@@ -32714,16 +32721,52 @@ public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}
- public interface EnergyBalancesAttributeCallback extends BaseAttributeCallback {
- void onSuccess(List value);
+ public interface CalendarIDAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Long value);
}
- public interface EnergyPrioritiesAttributeCallback extends BaseAttributeCallback {
- void onSuccess(List value);
+ public interface NameAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable String value);
}
- public interface LowPowerModeSensitivitiesAttributeCallback extends BaseAttributeCallback {
- void onSuccess(List value);
+ public interface ProviderIDAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Long value);
+ }
+
+ public interface EventIDAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Long value);
+ }
+
+ public interface StartDateAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Long value);
+ }
+
+ public interface CalendarPeriodsAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable List value);
+ }
+
+ public interface SpecialDaysAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable List value);
+ }
+
+ public interface CurrentDayAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterDayStruct value);
+ }
+
+ public interface NextDayAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterDayStruct value);
+ }
+
+ public interface CurrentTransitionAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value);
+ }
+
+ public interface CurrentPeakPeriodAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value);
+ }
+
+ public interface NextPeakPeriodAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value);
}
public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
@@ -32742,152 +32785,316 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List value);
}
- public void readEnergyBalancesAttribute(
- EnergyBalancesAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_BALANCES_ATTRIBUTE_ID);
+ public void readCalendarIDAttribute(
+ CalendarIDAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_I_D_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ENERGY_BALANCES_ATTRIBUTE_ID, true);
+ }, CALENDAR_I_D_ATTRIBUTE_ID, true);
}
- public void subscribeEnergyBalancesAttribute(
- EnergyBalancesAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_BALANCES_ATTRIBUTE_ID);
+ public void subscribeCalendarIDAttribute(
+ CalendarIDAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_I_D_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ENERGY_BALANCES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, CALENDAR_I_D_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readCurrentEnergyBalanceAttribute(
- IntegerAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID);
+ public void readNameAttribute(
+ NameAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NAME_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, true);
+ }, NAME_ATTRIBUTE_ID, true);
}
- public void writeCurrentEnergyBalanceAttribute(DefaultClusterCallback callback, Integer value) {
- writeCurrentEnergyBalanceAttribute(callback, value, 0);
+ public void subscribeNameAttribute(
+ NameAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NAME_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, NAME_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void writeCurrentEnergyBalanceAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
- BaseTLVType tlvValue = new UIntType(value);
- writeAttribute(new WriteAttributesCallbackImpl(callback), CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ public void readProviderIDAttribute(
+ ProviderIDAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_I_D_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, PROVIDER_I_D_ATTRIBUTE_ID, true);
}
- public void subscribeCurrentEnergyBalanceAttribute(
- IntegerAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID);
+ public void subscribeProviderIDAttribute(
+ ProviderIDAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_I_D_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, PROVIDER_I_D_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readEnergyPrioritiesAttribute(
- EnergyPrioritiesAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_PRIORITIES_ATTRIBUTE_ID);
+ public void readEventIDAttribute(
+ EventIDAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_I_D_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ENERGY_PRIORITIES_ATTRIBUTE_ID, true);
+ }, EVENT_I_D_ATTRIBUTE_ID, true);
}
- public void subscribeEnergyPrioritiesAttribute(
- EnergyPrioritiesAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_PRIORITIES_ATTRIBUTE_ID);
+ public void subscribeEventIDAttribute(
+ EventIDAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_I_D_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ENERGY_PRIORITIES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, EVENT_I_D_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readLowPowerModeSensitivitiesAttribute(
- LowPowerModeSensitivitiesAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID);
+ public void readStartDateAttribute(
+ StartDateAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_DATE_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID, true);
+ }, START_DATE_ATTRIBUTE_ID, true);
}
- public void subscribeLowPowerModeSensitivitiesAttribute(
- LowPowerModeSensitivitiesAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID);
+ public void subscribeStartDateAttribute(
+ StartDateAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_DATE_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, START_DATE_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readCurrentLowPowerModeSensitivityAttribute(
- IntegerAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID);
+ public void readCalendarPeriodsAttribute(
+ CalendarPeriodsAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_PERIODS_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, true);
+ }, CALENDAR_PERIODS_ATTRIBUTE_ID, true);
}
- public void writeCurrentLowPowerModeSensitivityAttribute(DefaultClusterCallback callback, Integer value) {
- writeCurrentLowPowerModeSensitivityAttribute(callback, value, 0);
+ public void subscribeCalendarPeriodsAttribute(
+ CalendarPeriodsAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_PERIODS_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CALENDAR_PERIODS_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void writeCurrentLowPowerModeSensitivityAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
- BaseTLVType tlvValue = new UIntType(value);
- writeAttribute(new WriteAttributesCallbackImpl(callback), CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ public void readSpecialDaysAttribute(
+ SpecialDaysAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPECIAL_DAYS_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SPECIAL_DAYS_ATTRIBUTE_ID, true);
}
- public void subscribeCurrentLowPowerModeSensitivityAttribute(
- IntegerAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID);
+ public void subscribeSpecialDaysAttribute(
+ SpecialDaysAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPECIAL_DAYS_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, SPECIAL_DAYS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentDayAttribute(
+ CurrentDayAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_DAY_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_DAY_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeCurrentDayAttribute(
+ CurrentDayAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_DAY_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_DAY_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readNextDayAttribute(
+ NextDayAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_DAY_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, NEXT_DAY_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeNextDayAttribute(
+ NextDayAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_DAY_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, NEXT_DAY_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentTransitionAttribute(
+ CurrentTransitionAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_TRANSITION_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_TRANSITION_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeCurrentTransitionAttribute(
+ CurrentTransitionAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_TRANSITION_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_TRANSITION_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentPeakPeriodAttribute(
+ CurrentPeakPeriodAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeCurrentPeakPeriodAttribute(
+ CurrentPeakPeriodAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readNextPeakPeriodAttribute(
+ NextPeakPeriodAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_PEAK_PERIOD_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, NEXT_PEAK_PERIOD_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeNextPeakPeriodAttribute(
+ NextPeakPeriodAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_PEAK_PERIOD_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, NEXT_PEAK_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval);
}
public void readGeneratedCommandListAttribute(
@@ -33047,11 +33254,14 @@ public void onSuccess(byte[] tlv) {
}
}
- public static class PowerTopologyCluster extends BaseChipCluster {
- public static final long CLUSTER_ID = 156L;
+ public static class EnergyPreferenceCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 155L;
- private static final long AVAILABLE_ENDPOINTS_ATTRIBUTE_ID = 0L;
- private static final long ACTIVE_ENDPOINTS_ATTRIBUTE_ID = 1L;
+ private static final long ENERGY_BALANCES_ATTRIBUTE_ID = 0L;
+ private static final long CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID = 1L;
+ private static final long ENERGY_PRIORITIES_ATTRIBUTE_ID = 2L;
+ private static final long LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID = 3L;
+ private static final long CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID = 4L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
@@ -33059,7 +33269,7 @@ public static class PowerTopologyCluster extends BaseChipCluster {
private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
- public PowerTopologyCluster(long devicePtr, int endpointId) {
+ public EnergyPreferenceCluster(long devicePtr, int endpointId) {
super(devicePtr, endpointId, CLUSTER_ID);
}
@@ -33069,14 +33279,18 @@ public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}
- public interface AvailableEndpointsAttributeCallback extends BaseAttributeCallback {
- void onSuccess(List value);
+ public interface EnergyBalancesAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
}
- public interface ActiveEndpointsAttributeCallback extends BaseAttributeCallback {
+ public interface EnergyPrioritiesAttributeCallback extends BaseAttributeCallback {
void onSuccess(List value);
}
+ public interface LowPowerModeSensitivitiesAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List value);
}
@@ -33093,35 +33307,70 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List value);
}
- public void readAvailableEndpointsAttribute(
- AvailableEndpointsAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID);
+ public void readEnergyBalancesAttribute(
+ EnergyBalancesAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_BALANCES_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, true);
+ }, ENERGY_BALANCES_ATTRIBUTE_ID, true);
}
- public void subscribeAvailableEndpointsAttribute(
- AvailableEndpointsAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID);
+ public void subscribeEnergyBalancesAttribute(
+ EnergyBalancesAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_BALANCES_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, ENERGY_BALANCES_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readActiveEndpointsAttribute(
- ActiveEndpointsAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID);
+ public void readCurrentEnergyBalanceAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, true);
+ }
+
+ public void writeCurrentEnergyBalanceAttribute(DefaultClusterCallback callback, Integer value) {
+ writeCurrentEnergyBalanceAttribute(callback, value, 0);
+ }
+
+ public void writeCurrentEnergyBalanceAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
+ BaseTLVType tlvValue = new UIntType(value);
+ writeAttribute(new WriteAttributesCallbackImpl(callback), CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }
+
+ public void subscribeCurrentEnergyBalanceAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readEnergyPrioritiesAttribute(
+ EnergyPrioritiesAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_PRIORITIES_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
@@ -33129,12 +33378,12 @@ public void onSuccess(byte[] tlv) {
List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, true);
+ }, ENERGY_PRIORITIES_ATTRIBUTE_ID, true);
}
- public void subscribeActiveEndpointsAttribute(
- ActiveEndpointsAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID);
+ public void subscribeEnergyPrioritiesAttribute(
+ EnergyPrioritiesAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENERGY_PRIORITIES_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
@@ -33142,7 +33391,68 @@ public void onSuccess(byte[] tlv) {
List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, ENERGY_PRIORITIES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readLowPowerModeSensitivitiesAttribute(
+ LowPowerModeSensitivitiesAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeLowPowerModeSensitivitiesAttribute(
+ LowPowerModeSensitivitiesAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentLowPowerModeSensitivityAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, true);
+ }
+
+ public void writeCurrentLowPowerModeSensitivityAttribute(DefaultClusterCallback callback, Integer value) {
+ writeCurrentLowPowerModeSensitivityAttribute(callback, value, 0);
+ }
+
+ public void writeCurrentLowPowerModeSensitivityAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
+ BaseTLVType tlvValue = new UIntType(value);
+ writeAttribute(new WriteAttributesCallbackImpl(callback), CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }
+
+ public void subscribeCurrentLowPowerModeSensitivityAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, minInterval, maxInterval);
}
public void readGeneratedCommandListAttribute(
@@ -33302,13 +33612,11 @@ public void onSuccess(byte[] tlv) {
}
}
- public static class EnergyEvseModeCluster extends BaseChipCluster {
- public static final long CLUSTER_ID = 157L;
+ public static class PowerTopologyCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 156L;
- private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L;
- private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L;
- private static final long START_UP_MODE_ATTRIBUTE_ID = 2L;
- private static final long ON_MODE_ATTRIBUTE_ID = 3L;
+ private static final long AVAILABLE_ENDPOINTS_ATTRIBUTE_ID = 0L;
+ private static final long ACTIVE_ENDPOINTS_ATTRIBUTE_ID = 1L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
@@ -33316,7 +33624,7 @@ public static class EnergyEvseModeCluster extends BaseChipCluster {
private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
- public EnergyEvseModeCluster(long devicePtr, int endpointId) {
+ public PowerTopologyCluster(long devicePtr, int endpointId) {
super(devicePtr, endpointId, CLUSTER_ID);
}
@@ -33326,57 +33634,12 @@ public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}
- public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode) {
- changeToMode(callback, newMode, 0);
- }
-
- public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode, int timedInvokeTimeoutMs) {
- final long commandId = 0L;
-
- ArrayList elements = new ArrayList<>();
- final long newModeFieldID = 0L;
- BaseTLVType newModetlvValue = new UIntType(newMode);
- elements.add(new StructElement(newModeFieldID, newModetlvValue));
-
- StructType commandArgs = new StructType(elements);
- invoke(new InvokeCallbackImpl(callback) {
- @Override
- public void onResponse(StructType invokeStructValue) {
- final long statusFieldID = 0L;
- Integer status = null;
- final long statusTextFieldID = 1L;
- Optional statusText = Optional.empty();
- for (StructElement element: invokeStructValue.value()) {
- if (element.contextTagNum() == statusFieldID) {
- if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
- UIntType castingValue = element.value(UIntType.class);
- status = castingValue.value(Integer.class);
- }
- } else if (element.contextTagNum() == statusTextFieldID) {
- if (element.value(BaseTLVType.class).type() == TLVType.String) {
- StringType castingValue = element.value(StringType.class);
- statusText = Optional.of(castingValue.value(String.class));
- }
- }
- }
- callback.onSuccess(status, statusText);
- }}, commandId, commandArgs, timedInvokeTimeoutMs);
- }
-
- public interface ChangeToModeResponseCallback extends BaseClusterCallback {
- void onSuccess(Integer status, Optional statusText);
- }
-
- public interface SupportedModesAttributeCallback extends BaseAttributeCallback {
- void onSuccess(List value);
- }
-
- public interface StartUpModeAttributeCallback extends BaseAttributeCallback {
- void onSuccess(@Nullable Integer value);
+ public interface AvailableEndpointsAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
}
- public interface OnModeAttributeCallback extends BaseAttributeCallback {
- void onSuccess(@Nullable Integer value);
+ public interface ActiveEndpointsAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
}
public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
@@ -33395,165 +33658,95 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List value);
}
- public void readSupportedModesAttribute(
- SupportedModesAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_ATTRIBUTE_ID);
+ public void readAvailableEndpointsAttribute(
+ AvailableEndpointsAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, SUPPORTED_MODES_ATTRIBUTE_ID, true);
+ }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, true);
}
- public void subscribeSupportedModesAttribute(
- SupportedModesAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_ATTRIBUTE_ID);
+ public void subscribeAvailableEndpointsAttribute(
+ AvailableEndpointsAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readCurrentModeAttribute(
- IntegerAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID);
+ public void readActiveEndpointsAttribute(
+ ActiveEndpointsAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, CURRENT_MODE_ATTRIBUTE_ID, true);
+ }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, true);
}
- public void subscribeCurrentModeAttribute(
- IntegerAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID);
+ public void subscribeActiveEndpointsAttribute(
+ ActiveEndpointsAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readStartUpModeAttribute(
- StartUpModeAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID);
+ public void readGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, START_UP_MODE_ATTRIBUTE_ID, true);
- }
-
- public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value) {
- writeStartUpModeAttribute(callback, value, 0);
- }
-
- public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
- BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType();
- writeAttribute(new WriteAttributesCallbackImpl(callback), START_UP_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true);
}
- public void subscribeStartUpModeAttribute(
- StartUpModeAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID);
+ public void subscribeGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
}
- public void readOnModeAttribute(
- OnModeAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID);
+ public void readAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
- }, ON_MODE_ATTRIBUTE_ID, true);
- }
-
- public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value) {
- writeOnModeAttribute(callback, value, 0);
- }
-
- public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
- BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType();
- writeAttribute(new WriteAttributesCallbackImpl(callback), ON_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
- }
-
- public void subscribeOnModeAttribute(
- OnModeAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID);
-
- subscribeAttribute(new ReportCallbackImpl(callback, path) {
- @Override
- public void onSuccess(byte[] tlv) {
- @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
- callback.onSuccess(value);
- }
- }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
- }
-
- public void readGeneratedCommandListAttribute(
- GeneratedCommandListAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
-
- readAttribute(new ReportCallbackImpl(callback, path) {
- @Override
- public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
- callback.onSuccess(value);
- }
- }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true);
- }
-
- public void subscribeGeneratedCommandListAttribute(
- GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
-
- subscribeAttribute(new ReportCallbackImpl(callback, path) {
- @Override
- public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
- callback.onSuccess(value);
- }
- }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
- }
-
- public void readAcceptedCommandListAttribute(
- AcceptedCommandListAttributeCallback callback) {
- ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
-
- readAttribute(new ReportCallbackImpl(callback, path) {
- @Override
- public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
- callback.onSuccess(value);
- }
- }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true);
}
public void subscribeAcceptedCommandListAttribute(
@@ -33674,8 +33867,8 @@ public void onSuccess(byte[] tlv) {
}
}
- public static class DeviceEnergyManagementModeCluster extends BaseChipCluster {
- public static final long CLUSTER_ID = 159L;
+ public static class EnergyEvseModeCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 157L;
private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L;
private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L;
@@ -33688,7 +33881,7 @@ public static class DeviceEnergyManagementModeCluster extends BaseChipCluster {
private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
- public DeviceEnergyManagementModeCluster(long devicePtr, int endpointId) {
+ public EnergyEvseModeCluster(long devicePtr, int endpointId) {
super(devicePtr, endpointId, CLUSTER_ID);
}
@@ -33740,7 +33933,7 @@ public interface ChangeToModeResponseCallback extends BaseClusterCallback {
}
public interface SupportedModesAttributeCallback extends BaseAttributeCallback {
- void onSuccess(List value);
+ void onSuccess(List value);
}
public interface StartUpModeAttributeCallback extends BaseAttributeCallback {
@@ -33774,7 +33967,7 @@ public void readSupportedModesAttribute(
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, SUPPORTED_MODES_ATTRIBUTE_ID, true);
@@ -33787,7 +33980,7 @@ public void subscribeSupportedModesAttribute(
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval);
@@ -34046,54 +34239,13 @@ public void onSuccess(byte[] tlv) {
}
}
- public static class DoorLockCluster extends BaseChipCluster {
- public static final long CLUSTER_ID = 257L;
+ public static class DeviceEnergyManagementModeCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 159L;
- private static final long LOCK_STATE_ATTRIBUTE_ID = 0L;
- private static final long LOCK_TYPE_ATTRIBUTE_ID = 1L;
- private static final long ACTUATOR_ENABLED_ATTRIBUTE_ID = 2L;
- private static final long DOOR_STATE_ATTRIBUTE_ID = 3L;
- private static final long DOOR_OPEN_EVENTS_ATTRIBUTE_ID = 4L;
- private static final long DOOR_CLOSED_EVENTS_ATTRIBUTE_ID = 5L;
- private static final long OPEN_PERIOD_ATTRIBUTE_ID = 6L;
- private static final long NUMBER_OF_TOTAL_USERS_SUPPORTED_ATTRIBUTE_ID = 17L;
- private static final long NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID = 18L;
- private static final long NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID = 19L;
- private static final long NUMBER_OF_WEEK_DAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 20L;
- private static final long NUMBER_OF_YEAR_DAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 21L;
- private static final long NUMBER_OF_HOLIDAY_SCHEDULES_SUPPORTED_ATTRIBUTE_ID = 22L;
- private static final long MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID = 23L;
- private static final long MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID = 24L;
- private static final long MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID = 25L;
- private static final long MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID = 26L;
- private static final long CREDENTIAL_RULES_SUPPORT_ATTRIBUTE_ID = 27L;
- private static final long NUMBER_OF_CREDENTIALS_SUPPORTED_PER_USER_ATTRIBUTE_ID = 28L;
- private static final long LANGUAGE_ATTRIBUTE_ID = 33L;
- private static final long L_E_D_SETTINGS_ATTRIBUTE_ID = 34L;
- private static final long AUTO_RELOCK_TIME_ATTRIBUTE_ID = 35L;
- private static final long SOUND_VOLUME_ATTRIBUTE_ID = 36L;
- private static final long OPERATING_MODE_ATTRIBUTE_ID = 37L;
- private static final long SUPPORTED_OPERATING_MODES_ATTRIBUTE_ID = 38L;
- private static final long DEFAULT_CONFIGURATION_REGISTER_ATTRIBUTE_ID = 39L;
- private static final long ENABLE_LOCAL_PROGRAMMING_ATTRIBUTE_ID = 40L;
- private static final long ENABLE_ONE_TOUCH_LOCKING_ATTRIBUTE_ID = 41L;
- private static final long ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID = 42L;
- private static final long ENABLE_PRIVACY_MODE_BUTTON_ATTRIBUTE_ID = 43L;
- private static final long LOCAL_PROGRAMMING_FEATURES_ATTRIBUTE_ID = 44L;
- private static final long WRONG_CODE_ENTRY_LIMIT_ATTRIBUTE_ID = 48L;
- private static final long USER_CODE_TEMPORARY_DISABLE_TIME_ATTRIBUTE_ID = 49L;
- private static final long SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID = 50L;
- private static final long REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID = 51L;
- private static final long EXPIRING_USER_TIMEOUT_ATTRIBUTE_ID = 53L;
- private static final long ALIRO_READER_VERIFICATION_KEY_ATTRIBUTE_ID = 128L;
- private static final long ALIRO_READER_GROUP_IDENTIFIER_ATTRIBUTE_ID = 129L;
- private static final long ALIRO_READER_GROUP_SUB_IDENTIFIER_ATTRIBUTE_ID = 130L;
- private static final long ALIRO_EXPEDITED_TRANSACTION_SUPPORTED_PROTOCOL_VERSIONS_ATTRIBUTE_ID = 131L;
- private static final long ALIRO_GROUP_RESOLVING_KEY_ATTRIBUTE_ID = 132L;
- private static final long ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID = 133L;
- private static final long ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID = 134L;
- private static final long NUMBER_OF_ALIRO_CREDENTIAL_ISSUER_KEYS_SUPPORTED_ATTRIBUTE_ID = 135L;
- private static final long NUMBER_OF_ALIRO_ENDPOINT_KEYS_SUPPORTED_ATTRIBUTE_ID = 136L;
+ private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L;
+ private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L;
+ private static final long START_UP_MODE_ATTRIBUTE_ID = 2L;
+ private static final long ON_MODE_ATTRIBUTE_ID = 3L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
@@ -34101,7 +34253,7 @@ public static class DoorLockCluster extends BaseChipCluster {
private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
- public DoorLockCluster(long devicePtr, int endpointId) {
+ public DeviceEnergyManagementModeCluster(long devicePtr, int endpointId) {
super(devicePtr, endpointId, CLUSTER_ID);
}
@@ -34111,80 +34263,493 @@ public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}
+ public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode) {
+ changeToMode(callback, newMode, 0);
+ }
- public void lockDoor(DefaultClusterCallback callback, Optional PINCode, int timedInvokeTimeoutMs) {
+ public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode, int timedInvokeTimeoutMs) {
final long commandId = 0L;
ArrayList