Skip to content

Commit

Permalink
update valve configuration and control cluster according to latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
fessehaeve committed Dec 12, 2023
1 parent cce6c24 commit ae68cd1
Show file tree
Hide file tree
Showing 42 changed files with 871 additions and 1,636 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,30 @@ limitations under the License.

<bitmap name="Feature" type="bitmap32">
<cluster code="0x0081"/>
<field name="TimeSync" mask="0x1"/>
<field name="Level" mask="0x2"/>
<field name="TimeSync" mask="0x01"/>
<field name="Level" mask="0x02"/>
</bitmap>

<bitmap name="ValveFaultBitmap" type="bitmap16">
<cluster code="0x0081"/>
<field name="GeneralFault" mask="0x1"/>
<field name="Blocked" mask="0x2"/>
<field name="Leaking" mask="0x4"/>
<field name="GeneralFault" mask="0x01"/>
<field name="Blocked" mask="0x02"/>
<field name="Leaking" mask="0x04"/>
<field name="NotConnected" mask="0x08"/>
<field name="ShortCircuit" mask="0x10"/>
<field name="CurrentExceeded" mask="0x20"/>
</bitmap>

<enum name="ValveStateEnum" type="enum8">
<cluster code="0x0081"/>
<item name="Open" value="0x0"/>
<item name="Closed" value="0x1"/>
<item name="Closed" value="0x0"/>
<item name="Open" value="0x1"/>
<item name="Transitioning" value="0x2"/>
</enum>

<enum name="StatusCodeEnum" type="enum8">
<cluster code="0x0081"/>
<item name="FailureDueToFault" value="0x02"/>
</enum>

<cluster apiMaturity="provisional">
Expand All @@ -48,51 +57,37 @@ limitations under the License.

<!-- min max definition for attribute size larger than 2 bytes is not allowed by zap codegen https://github.com/project-chip/zap/issues/1187 -->
<!-- Therefore, this check needs to be done in code. -->
<attribute side="server" code="0x0000" define="OPEN_DURATION" type="elapsed_s" isNullable="true" writable="true" optional="false">
<description>OpenDuration</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0001" define="AUTO_CLOSE_TIME" type="epoch_us" isNullable="true" writable="false" optional="true">AutoCloseTime</attribute>
<attribute side="server" code="0x0002" define="REMAINING_DURATION" type="elapsed_s" isNullable="true" writable="false" optional="true">RemainingDuration</attribute>
<attribute side="server" code="0x0003" define="CURRENT_STATE" type="ValveStateEnum" isNullable="true" writable="false" optional="false">CurrentState</attribute>
<attribute side="server" code="0x0004" define="TARGET_STATE" type="ValveStateEnum" isNullable="true" writable="false" optional="false">TargetState</attribute>
<attribute side="server" code="0x0005" define="START_UP_STATE" type="ValveStateEnum" isNullable="false" writable="true" optional="true">
<description>StartUpState</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0000" define="OPEN_DURATION" type="elapsed_s" isNullable="true" writable="false" optional="false">OpenDuration</attribute>
<!-- min max definition for attribute size larger than 2 bytes is not allowed by zap codegen https://github.com/project-chip/zap/issues/1187 -->
<!-- Therefore, this check needs to be done in code. -->
<attribute side="server" code="0x0001" define="DEFAULT_OPEN_DURATION" type="elapsed_s" isNullable="true" writable="false" optional="false">DefaultOpenDuration</attribute>
<attribute side="server" code="0x0002" define="AUTO_CLOSE_TIME" type="epoch_us" isNullable="true" writable="false" optional="true">AutoCloseTime</attribute>
<attribute side="server" code="0x0003" define="REMAINING_DURATION" type="elapsed_s" isNullable="true" writable="false" optional="false">RemainingDuration</attribute>
<attribute side="server" code="0x0004" define="CURRENT_STATE" type="ValveStateEnum" isNullable="true" writable="false" optional="false">CurrentState</attribute>
<attribute side="server" code="0x0005" define="TARGET_STATE" type="ValveStateEnum" isNullable="true" writable="false" optional="false">TargetState</attribute>
<attribute side="server" code="0x0006" define="CURRENT_LEVEL" type="percent" isNullable="true" min="0" max="100" writable="false" optional="true">CurrentLevel</attribute>
<attribute side="server" code="0x0007" define="TARGET_LEVEL" type="percent" isNullable="true" min="0" max="100" writable="false" optional="true">TargetLevel</attribute>
<attribute side="server" code="0x0008" define="OPEN_LEVEL" type="percent" isNullable="true" min="1" max="100" writable="true" default="100" optional="true">
<description>OpenLevel</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0008" define="DEFAULT_OPEN_LEVEL" type="percent" isNullable="false" min="1" max="100" writable="true" default="100" optional="true">DefaultOpenLevel</attribute>
<attribute side="server" code="0x0009" define="VALVE_FAULT" type="ValveFaultBitmap" isNullable="false" writable="false" optional="true">ValveFault</attribute>

<command source="client" code="0x00" name="Open" optional="false">
<description>This command is used to set the valve to its fully open position.</description>
<arg name="OpenDuration" type="elapsed_s" optional="true"/>
<description>This command is used to set the valve to its open position.</description>
<arg name="OpenDuration" type="elapsed_s" optional="true" isNullable="true"/>
<arg name="TargetLevel" type="percent" optional="true"/>
</command>

<command source="client" code="0x01" name="Close" optional="false">
<description>This command is used to set the valve to its fully closed position.</description>
</command>

<command source="client" code="0x02" name="SetLevel" optional="true">
<description>This command is used to set the valve to a specific level.</description>
<arg name="Level" type="percent"/>
<arg name="OpenDuration" type="elapsed_s" optional="true"/>
<description>This command is used to set the valve to its closed position.</description>
</command>

<event side="server" code="0x00" priority="info" name="ValveStateChanged" optional="true">
<description>This event SHALL be generated when the valve changes state, either opens or closes.</description>
<description>This event SHALL be generated when the valve state changed.</description>
<field id="0" name="ValveState" type="ValveStateEnum"/>
<field id="1" name="ValveLevel" type="percent" optional="true"/>
</event>

<event side="server" code="0x01" priority="info" name="ValveFault" optional="true">
<description>This event SHALL be generated when the valve registers a fault.</description>
<description>This event SHALL be generated when the valve registers or clears a fault.</description>
<field id="0" name="ValveFault" type="ValveFaultBitmap"/>
</event>
</cluster>
Expand Down
41 changes: 22 additions & 19 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -4049,9 +4049,14 @@ provisional cluster BooleanSensorConfiguration = 128 {
provisional cluster ValveConfigurationAndControl = 129 {
revision 1;

enum StatusCodeEnum : enum8 {
kFailureDueToFault = 2;
}

enum ValveStateEnum : enum8 {
kOpen = 0;
kClosed = 1;
kClosed = 0;
kOpen = 1;
kTransitioning = 2;
}

bitmap Feature : bitmap32 {
Expand All @@ -4063,25 +4068,29 @@ provisional cluster ValveConfigurationAndControl = 129 {
kGeneralFault = 0x1;
kBlocked = 0x2;
kLeaking = 0x4;
kNotConnected = 0x8;
kShortCircuit = 0x10;
kCurrentExceeded = 0x20;
}

info event ValveStateChanged = 0 {
ValveStateEnum valveState = 0;
optional percent valveLevel = 1;
}

info event ValveFault = 1 {
ValveFaultBitmap valveFault = 0;
}

attribute access(write: manage) nullable elapsed_s openDuration = 0;
readonly attribute optional nullable epoch_us autoCloseTime = 1;
readonly attribute optional nullable elapsed_s remainingDuration = 2;
readonly attribute nullable ValveStateEnum currentState = 3;
readonly attribute nullable ValveStateEnum targetState = 4;
attribute access(write: manage) optional ValveStateEnum startUpState = 5;
readonly attribute nullable elapsed_s openDuration = 0;
readonly attribute nullable elapsed_s defaultOpenDuration = 1;
readonly attribute optional nullable epoch_us autoCloseTime = 2;
readonly attribute nullable elapsed_s remainingDuration = 3;
readonly attribute nullable ValveStateEnum currentState = 4;
readonly attribute nullable ValveStateEnum targetState = 5;
readonly attribute optional nullable percent currentLevel = 6;
readonly attribute optional nullable percent targetLevel = 7;
attribute access(write: manage) optional nullable percent openLevel = 8;
attribute optional percent defaultOpenLevel = 8;
readonly attribute optional ValveFaultBitmap valveFault = 9;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
Expand All @@ -4091,20 +4100,14 @@ provisional cluster ValveConfigurationAndControl = 129 {
readonly attribute int16u clusterRevision = 65533;

request struct OpenRequest {
optional elapsed_s openDuration = 0;
}

request struct SetLevelRequest {
percent level = 0;
optional elapsed_s openDuration = 1;
optional nullable elapsed_s openDuration = 0;
optional percent targetLevel = 1;
}

/** This command is used to set the valve to its fully open position. */
/** This command is used to set the valve to its open position. */
command Open(OpenRequest): DefaultSuccess = 0;
/** This command is used to set the valve to its fully closed position. */
/** This command is used to set the valve to its closed position. */
command Close(): DefaultSuccess = 1;
/** This command is used to set the valve to a specific level. */
command SetLevel(SetLevelRequest): DefaultSuccess = 2;
}

/** This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. */
Expand Down
Loading

0 comments on commit ae68cd1

Please sign in to comment.