/*
 *
 *    Copyright (c) 2021 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.
 */

// THIS FILE IS GENERATED BY ZAP

#include "chip-zcl-zpro-codec.h"

#include <support/BufferWriter.h>
#include <support/SafeInt.h>
#include <support/logging/CHIPLogging.h>

#include <app/util/basic-types.h>

using namespace chip;
using namespace chip::System;
using namespace chip::Encoding::LittleEndian;

static uint16_t doEncodeApsFrame(BufferWriter & buf, ClusterId clusterId, EndpointId sourceEndpoint, EndpointId destinationEndpoint,
                                 EmberApsOption options, GroupId groupId, uint8_t sequence, uint8_t radius, bool isMeasuring)
{

    uint8_t control_byte = 0;
    buf.Put(control_byte) // Put in a control byte
        .Put16(clusterId)
        .Put8(sourceEndpoint)
        .Put8(destinationEndpoint)
        .EndianPut(options, sizeof(EmberApsOption))
        .Put16(groupId)
        .Put8(sequence)
        .Put8(radius);

    size_t result = buf.Needed();
    if (isMeasuring)
    {
        ChipLogDetail(Zcl, "Measured APS frame size %d", result);
    }
    else if (buf.Fit())
    {
        ChipLogDetail(Zcl, "Successfully encoded %d bytes", result);
    }
    else
    {
        ChipLogError(Zcl, "Error encoding APS Frame: Buffer too small");
        result = 0;
    }

    if (!CanCastTo<uint16_t>(result))
    {
        ChipLogError(Zcl, "Can't fit our measured size in uint16_t");
        result = 0;
    }

    return static_cast<uint16_t>(result);
}

uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * apsFrame)
{
    BufferWriter buf(buffer, buf_length);
    return doEncodeApsFrame(buf, apsFrame->clusterId, apsFrame->sourceEndpoint, apsFrame->destinationEndpoint, apsFrame->options,
                            apsFrame->groupId, apsFrame->sequence, apsFrame->radius, !buffer);
}

#define COMMAND_HEADER(name, clusterId)                                                                                            \
    const char * kName = name;                                                                                                     \
                                                                                                                                   \
    PacketBufferWriter buf(System::PacketBufferHandle::New(kMaxBufferSize));                                                       \
    if (buf.IsNull())                                                                                                              \
    {                                                                                                                              \
        ChipLogError(Zcl, "Could not allocate packet buffer while trying to encode %s command", kName);                            \
        return PacketBufferHandle();                                                                                               \
    }                                                                                                                              \
                                                                                                                                   \
    if (doEncodeApsFrame(buf, clusterId, kSourceEndpoint, destinationEndpoint, 0, 0, 0, 0, false))                                 \
    {

#define COMMAND_FOOTER()                                                                                                           \
    }                                                                                                                              \
    if (!buf.Fit())                                                                                                                \
    {                                                                                                                              \
        ChipLogError(Zcl, "Command %s can't fit in the allocated buffer", kName);                                                  \
    }                                                                                                                              \
    return buf.Finalize();

/*----------------------------------------------------------------------------*\
| Cluster Name                                                        |   ID   |
|---------------------------------------------------------------------+--------|
| BarrierControl                                                      | 0x0103 |
| Basic                                                               | 0x0000 |
| Binding                                                             | 0xF000 |
| ColorControl                                                        | 0x0300 |
| ContentLaunch                                                       | 0xF002 |
| DoorLock                                                            | 0x0101 |
| Groups                                                              | 0x0004 |
| IasZone                                                             | 0x0500 |
| Identify                                                            | 0x0003 |
| LevelControl                                                        | 0x0008 |
| MediaPlayback                                                       | 0xF001 |
| NetworkCommissioning                                                | 0xAAAA |
| OnOff                                                               | 0x0006 |
| Scenes                                                              | 0x0005 |
| TemperatureMeasurement                                              | 0x0402 |
\*----------------------------------------------------------------------------*/

#define EMBER_ZCL_REPORTING_DIRECTION_REPORTED 0x00

#define ZCL_READ_ATTRIBUTES_COMMAND_ID (0x00)
#define ZCL_READ_ATTRIBUTES_RESPONSE_COMMAND_ID (0x01)
#define ZCL_WRITE_ATTRIBUTES_COMMAND_ID (0x02)
#define ZCL_WRITE_ATTRIBUTES_UNDIVIDED_COMMAND_ID (0x03)
#define ZCL_WRITE_ATTRIBUTES_RESPONSE_COMMAND_ID (0x04)
#define ZCL_WRITE_ATTRIBUTES_NO_RESPONSE_COMMAND_ID (0x05)
#define ZCL_CONFIGURE_REPORTING_COMMAND_ID (0x06)
#define ZCL_CONFIGURE_REPORTING_RESPONSE_COMMAND_ID (0x07)
#define ZCL_READ_REPORTING_CONFIGURATION_COMMAND_ID (0x08)
#define ZCL_READ_REPORTING_CONFIGURATION_RESPONSE_COMMAND_ID (0x09)
#define ZCL_REPORT_ATTRIBUTES_COMMAND_ID (0x0A)
#define ZCL_DEFAULT_RESPONSE_COMMAND_ID (0x0B)
#define ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID (0x0C)
#define ZCL_DISCOVER_ATTRIBUTES_RESPONSE_COMMAND_ID (0x0D)
#define ZCL_READ_ATTRIBUTES_STRUCTURED_COMMAND_ID (0x0E)
#define ZCL_WRITE_ATTRIBUTES_STRUCTURED_COMMAND_ID (0x0F)
#define ZCL_WRITE_ATTRIBUTES_STRUCTURED_RESPONSE_COMMAND_ID (0x10)
#define ZCL_DISCOVER_COMMANDS_RECEIVED_COMMAND_ID (0x11)
#define ZCL_DISCOVER_COMMANDS_RECEIVED_RESPONSE_COMMAND_ID (0x12)
#define ZCL_DISCOVER_COMMANDS_GENERATED_COMMAND_ID (0x13)
#define ZCL_DISCOVER_COMMANDS_GENERATED_RESPONSE_COMMAND_ID (0x14)
#define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
#define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)

#define BARRIER_CONTROL_CLUSTER_ID 0x0103
#define ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID (0x00)
#define ZCL_BARRIER_CONTROL_STOP_COMMAND_ID (0x01)

#define BASIC_CLUSTER_ID 0x0000
#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)

#define BINDING_CLUSTER_ID 0xF000
#define ZCL_BIND_COMMAND_ID (0x00)
#define ZCL_UNBIND_COMMAND_ID (0x01)

#define COLOR_CONTROL_CLUSTER_ID 0x0300
#define ZCL_MOVE_COLOR_COMMAND_ID (0x08)
#define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B)
#define ZCL_MOVE_HUE_COMMAND_ID (0x01)
#define ZCL_MOVE_SATURATION_COMMAND_ID (0x04)
#define ZCL_MOVE_TO_COLOR_COMMAND_ID (0x07)
#define ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID (0x0A)
#define ZCL_MOVE_TO_HUE_COMMAND_ID (0x00)
#define ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID (0x06)
#define ZCL_MOVE_TO_SATURATION_COMMAND_ID (0x03)
#define ZCL_STEP_COLOR_COMMAND_ID (0x09)
#define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C)
#define ZCL_STEP_HUE_COMMAND_ID (0x02)
#define ZCL_STEP_SATURATION_COMMAND_ID (0x05)
#define ZCL_STOP_MOVE_STEP_COMMAND_ID (0x47)

#define CONTENT_LAUNCH_CLUSTER_ID 0xF002
#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)

#define DOOR_LOCK_CLUSTER_ID 0x0101
#define ZCL_CLEAR_ALL_PINS_COMMAND_ID (0x08)
#define ZCL_CLEAR_ALL_RFIDS_COMMAND_ID (0x19)
#define ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID (0x13)
#define ZCL_CLEAR_PIN_COMMAND_ID (0x07)
#define ZCL_CLEAR_RFID_COMMAND_ID (0x18)
#define ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID (0x0D)
#define ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID (0x10)
#define ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID (0x12)
#define ZCL_GET_LOG_RECORD_COMMAND_ID (0x04)
#define ZCL_GET_PIN_COMMAND_ID (0x06)
#define ZCL_GET_RFID_COMMAND_ID (0x17)
#define ZCL_GET_USER_TYPE_COMMAND_ID (0x15)
#define ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID (0x0C)
#define ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID (0x0F)
#define ZCL_LOCK_DOOR_COMMAND_ID (0x00)
#define ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID (0x11)
#define ZCL_SET_PIN_COMMAND_ID (0x05)
#define ZCL_SET_RFID_COMMAND_ID (0x16)
#define ZCL_SET_USER_TYPE_COMMAND_ID (0x14)
#define ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID (0x0B)
#define ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID (0x0E)
#define ZCL_UNLOCK_DOOR_COMMAND_ID (0x01)
#define ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID (0x03)

#define GROUPS_CLUSTER_ID 0x0004
#define ZCL_ADD_GROUP_COMMAND_ID (0x00)
#define ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID (0x05)
#define ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID (0x02)
#define ZCL_REMOVE_ALL_GROUPS_COMMAND_ID (0x04)
#define ZCL_REMOVE_GROUP_COMMAND_ID (0x03)
#define ZCL_VIEW_GROUP_COMMAND_ID (0x01)

#define IAS_ZONE_CLUSTER_ID 0x0500

#define IDENTIFY_CLUSTER_ID 0x0003
#define ZCL_IDENTIFY_COMMAND_ID (0x00)
#define ZCL_IDENTIFY_QUERY_COMMAND_ID (0x01)

#define LEVEL_CONTROL_CLUSTER_ID 0x0008
#define ZCL_MOVE_COMMAND_ID (0x01)
#define ZCL_MOVE_TO_LEVEL_COMMAND_ID (0x00)
#define ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID (0x04)
#define ZCL_MOVE_WITH_ON_OFF_COMMAND_ID (0x05)
#define ZCL_STEP_COMMAND_ID (0x02)
#define ZCL_STEP_WITH_ON_OFF_COMMAND_ID (0x06)
#define ZCL_STOP_COMMAND_ID (0x03)
#define ZCL_STOP_WITH_ON_OFF_COMMAND_ID (0x07)

#define MEDIA_PLAYBACK_CLUSTER_ID 0xF001
#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)

#define ON_OFF_CLUSTER_ID 0x0006
#define ZCL_OFF_COMMAND_ID (0x00)
#define ZCL_ON_COMMAND_ID (0x01)
#define ZCL_TOGGLE_COMMAND_ID (0x02)

#define SCENES_CLUSTER_ID 0x0005
#define ZCL_ADD_SCENE_COMMAND_ID (0x00)
#define ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID (0x06)
#define ZCL_RECALL_SCENE_COMMAND_ID (0x05)
#define ZCL_REMOVE_ALL_SCENES_COMMAND_ID (0x03)
#define ZCL_REMOVE_SCENE_COMMAND_ID (0x02)
#define ZCL_STORE_SCENE_COMMAND_ID (0x04)
#define ZCL_VIEW_SCENE_COMMAND_ID (0x01)

#define TEMP_MEASUREMENT_CLUSTER_ID 0x0402

// TODO: Find a way to calculate maximum message length for clusters
//       https://github.com/project-chip/connectedhomeip/issues/965
constexpr uint16_t kMaxBufferSize = 1024;

// This is a cluster-specific command so low two bits are 0b01.  The command
// is standard, so does not need a manufacturer code, and we're sending
// client to server, so all the remaining bits are 0.
constexpr uint8_t kFrameControlClusterSpecificCommand = 0x01;

// This is a global command, so the low bits are 0b00.  The command is
// standard, so does not need a manufacturer code, and we're sending client
// to server, so all the remaining bits are 0.
constexpr uint8_t kFrameControlGlobalCommand = 0x00;

// Pick source endpoint as 1 for now
constexpr EndpointId kSourceEndpoint = 1;

/*----------------------------------------------------------------------------*\
| Cluster BarrierControl                                              | 0x0103 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * BarrierControlGoToPercent                                         |   0x00 |
| * BarrierControlStop                                                |   0x01 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * BarrierMovingState                                                | 0x0001 |
| * BarrierSafetyStatus                                               | 0x0002 |
| * BarrierCapabilities                                               | 0x0003 |
| * BarrierPosition                                                   | 0x000A |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command BarrierControlGoToPercent
 */
PacketBufferHandle encodeBarrierControlClusterBarrierControlGoToPercentCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                               uint8_t percentOpen)
{
    COMMAND_HEADER("BarrierControlGoToPercent", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID).Put8(percentOpen);
    COMMAND_FOOTER();
}

/*
 * Command BarrierControlStop
 */
PacketBufferHandle encodeBarrierControlClusterBarrierControlStopCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("BarrierControlStop", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_BARRIER_CONTROL_STOP_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeBarrierControlClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverBarrierControlAttributes", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute BarrierMovingState
 */
PacketBufferHandle encodeBarrierControlClusterReadBarrierMovingStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBarrierControlBarrierMovingState", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
    COMMAND_FOOTER();
}

/*
 * Attribute BarrierSafetyStatus
 */
PacketBufferHandle encodeBarrierControlClusterReadBarrierSafetyStatusAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBarrierControlBarrierSafetyStatus", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
    COMMAND_FOOTER();
}

/*
 * Attribute BarrierCapabilities
 */
PacketBufferHandle encodeBarrierControlClusterReadBarrierCapabilitiesAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBarrierControlBarrierCapabilities", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0003);
    COMMAND_FOOTER();
}

/*
 * Attribute BarrierPosition
 */
PacketBufferHandle encodeBarrierControlClusterReadBarrierPositionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBarrierControlBarrierPosition", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x000A);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeBarrierControlClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBarrierControlClusterRevision", BARRIER_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster Basic                                                       | 0x0000 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * MfgSpecificPing                                                   |   0x00 |
| * ResetToFactoryDefaults                                            |   0x00 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * ZclVersion                                                        | 0x0000 |
| * PowerSource                                                       | 0x0007 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command MfgSpecificPing
 */
PacketBufferHandle encodeBasicClusterMfgSpecificPingCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("MfgSpecificPing", BASIC_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand | (1u << 2)).Put16(0x1002).Put8(seqNum).Put8(ZCL_MFG_SPECIFIC_PING_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command ResetToFactoryDefaults
 */
PacketBufferHandle encodeBasicClusterResetToFactoryDefaultsCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ResetToFactoryDefaults", BASIC_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeBasicClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverBasicAttributes", BASIC_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute ZclVersion
 */
PacketBufferHandle encodeBasicClusterReadZclVersionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBasicZclVersion", BASIC_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

/*
 * Attribute PowerSource
 */
PacketBufferHandle encodeBasicClusterReadPowerSourceAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBasicPowerSource", BASIC_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0007);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeBasicClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBasicClusterRevision", BASIC_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster Binding                                                     | 0xF000 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * Bind                                                              |   0x00 |
| * Unbind                                                            |   0x01 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command Bind
 */
PacketBufferHandle encodeBindingClusterBindCommand(uint8_t seqNum, EndpointId destinationEndpoint, chip::NodeId nodeId,
                                                   chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId)
{
    COMMAND_HEADER("Bind", BINDING_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_BIND_COMMAND_ID)
        .Put64(nodeId)
        .Put16(groupId)
        .Put8(endpointId)
        .Put16(clusterId);
    COMMAND_FOOTER();
}

/*
 * Command Unbind
 */
PacketBufferHandle encodeBindingClusterUnbindCommand(uint8_t seqNum, EndpointId destinationEndpoint, chip::NodeId nodeId,
                                                     chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId)
{
    COMMAND_HEADER("Unbind", BINDING_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_UNBIND_COMMAND_ID)
        .Put64(nodeId)
        .Put16(groupId)
        .Put8(endpointId)
        .Put16(clusterId);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeBindingClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverBindingAttributes", BINDING_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeBindingClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadBindingClusterRevision", BINDING_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster ColorControl                                                | 0x0300 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * MoveColor                                                         |   0x08 |
| * MoveColorTemperature                                              |   0x4B |
| * MoveHue                                                           |   0x01 |
| * MoveSaturation                                                    |   0x04 |
| * MoveToColor                                                       |   0x07 |
| * MoveToColorTemperature                                            |   0x0A |
| * MoveToHue                                                         |   0x00 |
| * MoveToHueAndSaturation                                            |   0x06 |
| * MoveToSaturation                                                  |   0x03 |
| * StepColor                                                         |   0x09 |
| * StepColorTemperature                                              |   0x4C |
| * StepHue                                                           |   0x02 |
| * StepSaturation                                                    |   0x05 |
| * StopMoveStep                                                      |   0x47 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * CurrentHue                                                        | 0x0000 |
| * CurrentSaturation                                                 | 0x0001 |
| * RemainingTime                                                     | 0x0002 |
| * CurrentX                                                          | 0x0003 |
| * CurrentY                                                          | 0x0004 |
| * DriftCompensation                                                 | 0x0005 |
| * CompensationText                                                  | 0x0006 |
| * ColorTemperature                                                  | 0x0007 |
| * ColorMode                                                         | 0x0008 |
| * ColorControlOptions                                               | 0x000F |
| * NumberOfPrimaries                                                 | 0x0010 |
| * Primary1X                                                         | 0x0011 |
| * Primary1Y                                                         | 0x0012 |
| * Primary1Intensity                                                 | 0x0013 |
| * Primary2X                                                         | 0x0015 |
| * Primary2Y                                                         | 0x0016 |
| * Primary2Intensity                                                 | 0x0017 |
| * Primary3X                                                         | 0x0019 |
| * Primary3Y                                                         | 0x001A |
| * Primary3Intensity                                                 | 0x001B |
| * Primary4X                                                         | 0x0020 |
| * Primary4Y                                                         | 0x0021 |
| * Primary4Intensity                                                 | 0x0022 |
| * Primary5X                                                         | 0x0024 |
| * Primary5Y                                                         | 0x0025 |
| * Primary5Intensity                                                 | 0x0026 |
| * Primary6X                                                         | 0x0028 |
| * Primary6Y                                                         | 0x0029 |
| * Primary6Intensity                                                 | 0x002A |
| * WhitePointX                                                       | 0x0030 |
| * WhitePointY                                                       | 0x0031 |
| * ColorPointRX                                                      | 0x0032 |
| * ColorPointRY                                                      | 0x0033 |
| * ColorPointRIntensity                                              | 0x0034 |
| * ColorPointGX                                                      | 0x0036 |
| * ColorPointGY                                                      | 0x0037 |
| * ColorPointGIntensity                                              | 0x0038 |
| * ColorPointBX                                                      | 0x003A |
| * ColorPointBY                                                      | 0x003B |
| * ColorPointBIntensity                                              | 0x003C |
| * EnhancedCurrentHue                                                | 0x4000 |
| * EnhancedColorMode                                                 | 0x4001 |
| * ColorLoopActive                                                   | 0x4002 |
| * ColorLoopDirection                                                | 0x4003 |
| * ColorLoopTime                                                     | 0x4004 |
| * ColorCapabilities                                                 | 0x400A |
| * ColorTempPhysicalMin                                              | 0x400B |
| * ColorTempPhysicalMax                                              | 0x400C |
| * CoupleColorTempToLevelMinMireds                                   | 0x400D |
| * StartUpColorTemperatureMireds                                     | 0x4010 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command MoveColor
 */
PacketBufferHandle encodeColorControlClusterMoveColorCommand(uint8_t seqNum, EndpointId destinationEndpoint, int16_t rateX,
                                                             int16_t rateY, uint8_t optionsMask, uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveColor", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_COLOR_COMMAND_ID)
        .Put16(static_cast<uint16_t>(rateX))
        .Put16(static_cast<uint16_t>(rateY))
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveColorTemperature
 */
PacketBufferHandle encodeColorControlClusterMoveColorTemperatureCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                        uint8_t moveMode, uint16_t rate,
                                                                        uint16_t colorTemperatureMinimum,
                                                                        uint16_t colorTemperatureMaximum, uint8_t optionsMask,
                                                                        uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveColorTemperature", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID)
        .Put8(moveMode)
        .Put16(rate)
        .Put16(colorTemperatureMinimum)
        .Put16(colorTemperatureMaximum)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveHue
 */
PacketBufferHandle encodeColorControlClusterMoveHueCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t moveMode,
                                                           uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveHue", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_HUE_COMMAND_ID)
        .Put8(moveMode)
        .Put8(rate)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveSaturation
 */
PacketBufferHandle encodeColorControlClusterMoveSaturationCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t moveMode,
                                                                  uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveSaturation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_SATURATION_COMMAND_ID)
        .Put8(moveMode)
        .Put8(rate)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToColor
 */
PacketBufferHandle encodeColorControlClusterMoveToColorCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t colorX,
                                                               uint16_t colorY, uint16_t transitionTime, uint8_t optionsMask,
                                                               uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveToColor", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_COLOR_COMMAND_ID)
        .Put16(colorX)
        .Put16(colorY)
        .Put16(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToColorTemperature
 */
PacketBufferHandle encodeColorControlClusterMoveToColorTemperatureCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                          uint16_t colorTemperature, uint16_t transitionTime,
                                                                          uint8_t optionsMask, uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveToColorTemperature", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID)
        .Put16(colorTemperature)
        .Put16(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToHue
 */
PacketBufferHandle encodeColorControlClusterMoveToHueCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t hue,
                                                             uint8_t direction, uint16_t transitionTime, uint8_t optionsMask,
                                                             uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveToHue", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_HUE_COMMAND_ID)
        .Put8(hue)
        .Put8(direction)
        .Put16(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToHueAndSaturation
 */
PacketBufferHandle encodeColorControlClusterMoveToHueAndSaturationCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                          uint8_t hue, uint8_t saturation, uint16_t transitionTime,
                                                                          uint8_t optionsMask, uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveToHueAndSaturation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID)
        .Put8(hue)
        .Put8(saturation)
        .Put16(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToSaturation
 */
PacketBufferHandle encodeColorControlClusterMoveToSaturationCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                    uint8_t saturation, uint16_t transitionTime,
                                                                    uint8_t optionsMask, uint8_t optionsOverride)
{
    COMMAND_HEADER("MoveToSaturation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_SATURATION_COMMAND_ID)
        .Put8(saturation)
        .Put16(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command StepColor
 */
PacketBufferHandle encodeColorControlClusterStepColorCommand(uint8_t seqNum, EndpointId destinationEndpoint, int16_t stepX,
                                                             int16_t stepY, uint16_t transitionTime, uint8_t optionsMask,
                                                             uint8_t optionsOverride)
{
    COMMAND_HEADER("StepColor", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STEP_COLOR_COMMAND_ID)
        .Put16(static_cast<uint16_t>(stepX))
        .Put16(static_cast<uint16_t>(stepY))
        .Put16(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command StepColorTemperature
 */
PacketBufferHandle encodeColorControlClusterStepColorTemperatureCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                        uint8_t stepMode, uint16_t stepSize,
                                                                        uint16_t transitionTime, uint16_t colorTemperatureMinimum,
                                                                        uint16_t colorTemperatureMaximum, uint8_t optionsMask,
                                                                        uint8_t optionsOverride)
{
    COMMAND_HEADER("StepColorTemperature", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID)
        .Put8(stepMode)
        .Put16(stepSize)
        .Put16(transitionTime)
        .Put16(colorTemperatureMinimum)
        .Put16(colorTemperatureMaximum)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command StepHue
 */
PacketBufferHandle encodeColorControlClusterStepHueCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t stepMode,
                                                           uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask,
                                                           uint8_t optionsOverride)
{
    COMMAND_HEADER("StepHue", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STEP_HUE_COMMAND_ID)
        .Put8(stepMode)
        .Put8(stepSize)
        .Put8(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command StepSaturation
 */
PacketBufferHandle encodeColorControlClusterStepSaturationCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t stepMode,
                                                                  uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask,
                                                                  uint8_t optionsOverride)
{
    COMMAND_HEADER("StepSaturation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STEP_SATURATION_COMMAND_ID)
        .Put8(stepMode)
        .Put8(stepSize)
        .Put8(transitionTime)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

/*
 * Command StopMoveStep
 */
PacketBufferHandle encodeColorControlClusterStopMoveStepCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t optionsMask,
                                                                uint8_t optionsOverride)
{
    COMMAND_HEADER("StopMoveStep", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STOP_MOVE_STEP_COMMAND_ID)
        .Put8(optionsMask)
        .Put8(optionsOverride);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverColorControlAttributes", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentHue
 */
PacketBufferHandle encodeColorControlClusterReadCurrentHueAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlCurrentHue", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterConfigureCurrentHueAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                         uint16_t minInterval, uint16_t maxInterval, uint8_t change)
{
    COMMAND_HEADER("ReportColorControlCurrentHue", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0000)
        .Put8(32)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put8(static_cast<uint8_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentSaturation
 */
PacketBufferHandle encodeColorControlClusterReadCurrentSaturationAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlCurrentSaturation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterConfigureCurrentSaturationAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                                uint16_t minInterval, uint16_t maxInterval,
                                                                                uint8_t change)
{
    COMMAND_HEADER("ReportColorControlCurrentSaturation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0001)
        .Put8(32)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put8(static_cast<uint8_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute RemainingTime
 */
PacketBufferHandle encodeColorControlClusterReadRemainingTimeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlRemainingTime", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentX
 */
PacketBufferHandle encodeColorControlClusterReadCurrentXAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlCurrentX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0003);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterConfigureCurrentXAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t minInterval, uint16_t maxInterval, uint16_t change)
{
    COMMAND_HEADER("ReportColorControlCurrentX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0003)
        .Put8(33)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put16(static_cast<uint16_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentY
 */
PacketBufferHandle encodeColorControlClusterReadCurrentYAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlCurrentY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0004);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterConfigureCurrentYAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t minInterval, uint16_t maxInterval, uint16_t change)
{
    COMMAND_HEADER("ReportColorControlCurrentY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0004)
        .Put8(33)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put16(static_cast<uint16_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute DriftCompensation
 */
PacketBufferHandle encodeColorControlClusterReadDriftCompensationAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlDriftCompensation", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0005);
    COMMAND_FOOTER();
}

/*
 * Attribute CompensationText
 */
PacketBufferHandle encodeColorControlClusterReadCompensationTextAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlCompensationText", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0006);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorTemperature
 */
PacketBufferHandle encodeColorControlClusterReadColorTemperatureAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorTemperature", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0007);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterConfigureColorTemperatureAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                               uint16_t minInterval, uint16_t maxInterval,
                                                                               uint16_t change)
{
    COMMAND_HEADER("ReportColorControlColorTemperature", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0007)
        .Put8(33)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put16(static_cast<uint16_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorMode
 */
PacketBufferHandle encodeColorControlClusterReadColorModeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorMode", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0008);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorControlOptions
 */
PacketBufferHandle encodeColorControlClusterReadColorControlOptionsAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorControlOptions", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x000F);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorControlOptionsAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                              uint8_t colorControlOptions)
{
    COMMAND_HEADER("WriteColorControlColorControlOptions", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x000F)
        .Put8(24)
        .Put8(static_cast<uint8_t>(colorControlOptions));
    COMMAND_FOOTER();
}

/*
 * Attribute NumberOfPrimaries
 */
PacketBufferHandle encodeColorControlClusterReadNumberOfPrimariesAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlNumberOfPrimaries", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0010);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary1X
 */
PacketBufferHandle encodeColorControlClusterReadPrimary1XAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary1X", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0011);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary1Y
 */
PacketBufferHandle encodeColorControlClusterReadPrimary1YAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary1Y", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0012);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary1Intensity
 */
PacketBufferHandle encodeColorControlClusterReadPrimary1IntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary1Intensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0013);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary2X
 */
PacketBufferHandle encodeColorControlClusterReadPrimary2XAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary2X", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0015);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary2Y
 */
PacketBufferHandle encodeColorControlClusterReadPrimary2YAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary2Y", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0016);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary2Intensity
 */
PacketBufferHandle encodeColorControlClusterReadPrimary2IntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary2Intensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0017);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary3X
 */
PacketBufferHandle encodeColorControlClusterReadPrimary3XAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary3X", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0019);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary3Y
 */
PacketBufferHandle encodeColorControlClusterReadPrimary3YAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary3Y", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x001A);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary3Intensity
 */
PacketBufferHandle encodeColorControlClusterReadPrimary3IntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary3Intensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x001B);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary4X
 */
PacketBufferHandle encodeColorControlClusterReadPrimary4XAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary4X", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0020);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary4Y
 */
PacketBufferHandle encodeColorControlClusterReadPrimary4YAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary4Y", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0021);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary4Intensity
 */
PacketBufferHandle encodeColorControlClusterReadPrimary4IntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary4Intensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0022);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary5X
 */
PacketBufferHandle encodeColorControlClusterReadPrimary5XAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary5X", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0024);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary5Y
 */
PacketBufferHandle encodeColorControlClusterReadPrimary5YAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary5Y", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0025);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary5Intensity
 */
PacketBufferHandle encodeColorControlClusterReadPrimary5IntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary5Intensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0026);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary6X
 */
PacketBufferHandle encodeColorControlClusterReadPrimary6XAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary6X", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0028);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary6Y
 */
PacketBufferHandle encodeColorControlClusterReadPrimary6YAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary6Y", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0029);
    COMMAND_FOOTER();
}

/*
 * Attribute Primary6Intensity
 */
PacketBufferHandle encodeColorControlClusterReadPrimary6IntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlPrimary6Intensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x002A);
    COMMAND_FOOTER();
}

/*
 * Attribute WhitePointX
 */
PacketBufferHandle encodeColorControlClusterReadWhitePointXAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlWhitePointX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0030);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteWhitePointXAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                      uint16_t whitePointX)
{
    COMMAND_HEADER("WriteColorControlWhitePointX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0030)
        .Put8(33)
        .Put16(static_cast<uint16_t>(whitePointX));
    COMMAND_FOOTER();
}

/*
 * Attribute WhitePointY
 */
PacketBufferHandle encodeColorControlClusterReadWhitePointYAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlWhitePointY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0031);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteWhitePointYAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                      uint16_t whitePointY)
{
    COMMAND_HEADER("WriteColorControlWhitePointY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0031)
        .Put8(33)
        .Put16(static_cast<uint16_t>(whitePointY));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointRX
 */
PacketBufferHandle encodeColorControlClusterReadColorPointRXAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointRX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0032);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointRXAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t colorPointRX)
{
    COMMAND_HEADER("WriteColorControlColorPointRX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0032)
        .Put8(33)
        .Put16(static_cast<uint16_t>(colorPointRX));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointRY
 */
PacketBufferHandle encodeColorControlClusterReadColorPointRYAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointRY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0033);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointRYAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t colorPointRY)
{
    COMMAND_HEADER("WriteColorControlColorPointRY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0033)
        .Put8(33)
        .Put16(static_cast<uint16_t>(colorPointRY));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointRIntensity
 */
PacketBufferHandle encodeColorControlClusterReadColorPointRIntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointRIntensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0034);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointRIntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                               uint8_t colorPointRIntensity)
{
    COMMAND_HEADER("WriteColorControlColorPointRIntensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0034)
        .Put8(32)
        .Put8(static_cast<uint8_t>(colorPointRIntensity));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointGX
 */
PacketBufferHandle encodeColorControlClusterReadColorPointGXAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointGX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0036);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointGXAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t colorPointGX)
{
    COMMAND_HEADER("WriteColorControlColorPointGX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0036)
        .Put8(33)
        .Put16(static_cast<uint16_t>(colorPointGX));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointGY
 */
PacketBufferHandle encodeColorControlClusterReadColorPointGYAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointGY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0037);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointGYAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t colorPointGY)
{
    COMMAND_HEADER("WriteColorControlColorPointGY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0037)
        .Put8(33)
        .Put16(static_cast<uint16_t>(colorPointGY));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointGIntensity
 */
PacketBufferHandle encodeColorControlClusterReadColorPointGIntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointGIntensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0038);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointGIntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                               uint8_t colorPointGIntensity)
{
    COMMAND_HEADER("WriteColorControlColorPointGIntensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0038)
        .Put8(32)
        .Put8(static_cast<uint8_t>(colorPointGIntensity));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointBX
 */
PacketBufferHandle encodeColorControlClusterReadColorPointBXAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointBX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x003A);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointBXAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t colorPointBX)
{
    COMMAND_HEADER("WriteColorControlColorPointBX", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x003A)
        .Put8(33)
        .Put16(static_cast<uint16_t>(colorPointBX));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointBY
 */
PacketBufferHandle encodeColorControlClusterReadColorPointBYAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointBY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x003B);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointBYAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                       uint16_t colorPointBY)
{
    COMMAND_HEADER("WriteColorControlColorPointBY", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x003B)
        .Put8(33)
        .Put16(static_cast<uint16_t>(colorPointBY));
    COMMAND_FOOTER();
}

/*
 * Attribute ColorPointBIntensity
 */
PacketBufferHandle encodeColorControlClusterReadColorPointBIntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorPointBIntensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x003C);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteColorPointBIntensityAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                               uint8_t colorPointBIntensity)
{
    COMMAND_HEADER("WriteColorControlColorPointBIntensity", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x003C)
        .Put8(32)
        .Put8(static_cast<uint8_t>(colorPointBIntensity));
    COMMAND_FOOTER();
}

/*
 * Attribute EnhancedCurrentHue
 */
PacketBufferHandle encodeColorControlClusterReadEnhancedCurrentHueAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlEnhancedCurrentHue", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x4000);
    COMMAND_FOOTER();
}

/*
 * Attribute EnhancedColorMode
 */
PacketBufferHandle encodeColorControlClusterReadEnhancedColorModeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlEnhancedColorMode", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x4001);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorLoopActive
 */
PacketBufferHandle encodeColorControlClusterReadColorLoopActiveAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorLoopActive", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x4002);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorLoopDirection
 */
PacketBufferHandle encodeColorControlClusterReadColorLoopDirectionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorLoopDirection", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x4003);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorLoopTime
 */
PacketBufferHandle encodeColorControlClusterReadColorLoopTimeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorLoopTime", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x4004);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorCapabilities
 */
PacketBufferHandle encodeColorControlClusterReadColorCapabilitiesAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorCapabilities", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x400A);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorTempPhysicalMin
 */
PacketBufferHandle encodeColorControlClusterReadColorTempPhysicalMinAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorTempPhysicalMin", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x400B);
    COMMAND_FOOTER();
}

/*
 * Attribute ColorTempPhysicalMax
 */
PacketBufferHandle encodeColorControlClusterReadColorTempPhysicalMaxAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlColorTempPhysicalMax", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x400C);
    COMMAND_FOOTER();
}

/*
 * Attribute CoupleColorTempToLevelMinMireds
 */
PacketBufferHandle encodeColorControlClusterReadCoupleColorTempToLevelMinMiredsAttribute(uint8_t seqNum,
                                                                                         EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlCoupleColorTempToLevelMinMireds", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x400D);
    COMMAND_FOOTER();
}

/*
 * Attribute StartUpColorTemperatureMireds
 */
PacketBufferHandle encodeColorControlClusterReadStartUpColorTemperatureMiredsAttribute(uint8_t seqNum,
                                                                                       EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlStartUpColorTemperatureMireds", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x4010);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeColorControlClusterWriteStartUpColorTemperatureMiredsAttribute(uint8_t seqNum,
                                                                                        EndpointId destinationEndpoint,
                                                                                        uint16_t startUpColorTemperatureMireds)
{
    COMMAND_HEADER("WriteColorControlStartUpColorTemperatureMireds", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x4010)
        .Put8(33)
        .Put16(static_cast<uint16_t>(startUpColorTemperatureMireds));
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeColorControlClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadColorControlClusterRevision", COLOR_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster ContentLaunch                                               | 0xF002 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * LaunchContent                                                     |   0x00 |
| * LaunchURL                                                         |   0x01 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command LaunchContent
 */
PacketBufferHandle encodeContentLaunchClusterLaunchContentCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("LaunchContent", CONTENT_LAUNCH_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_LAUNCH_CONTENT_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command LaunchURL
 */
PacketBufferHandle encodeContentLaunchClusterLaunchURLCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("LaunchURL", CONTENT_LAUNCH_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_LAUNCH_URL_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeContentLaunchClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverContentLaunchAttributes", CONTENT_LAUNCH_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeContentLaunchClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadContentLaunchClusterRevision", CONTENT_LAUNCH_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster DoorLock                                                    | 0x0101 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * ClearAllPins                                                      |   0x08 |
| * ClearAllRfids                                                     |   0x19 |
| * ClearHolidaySchedule                                              |   0x13 |
| * ClearPin                                                          |   0x07 |
| * ClearRfid                                                         |   0x18 |
| * ClearWeekdaySchedule                                              |   0x0D |
| * ClearYeardaySchedule                                              |   0x10 |
| * GetHolidaySchedule                                                |   0x12 |
| * GetLogRecord                                                      |   0x04 |
| * GetPin                                                            |   0x06 |
| * GetRfid                                                           |   0x17 |
| * GetUserType                                                       |   0x15 |
| * GetWeekdaySchedule                                                |   0x0C |
| * GetYeardaySchedule                                                |   0x0F |
| * LockDoor                                                          |   0x00 |
| * SetHolidaySchedule                                                |   0x11 |
| * SetPin                                                            |   0x05 |
| * SetRfid                                                           |   0x16 |
| * SetUserType                                                       |   0x14 |
| * SetWeekdaySchedule                                                |   0x0B |
| * SetYeardaySchedule                                                |   0x0E |
| * UnlockDoor                                                        |   0x01 |
| * UnlockWithTimeout                                                 |   0x03 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * LockState                                                         | 0x0000 |
| * LockType                                                          | 0x0001 |
| * ActuatorEnabled                                                   | 0x0002 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command ClearAllPins
 */
PacketBufferHandle encodeDoorLockClusterClearAllPinsCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ClearAllPins", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_ALL_PINS_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command ClearAllRfids
 */
PacketBufferHandle encodeDoorLockClusterClearAllRfidsCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ClearAllRfids", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_ALL_RFIDS_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command ClearHolidaySchedule
 */
PacketBufferHandle encodeDoorLockClusterClearHolidayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                    uint8_t scheduleId)
{
    COMMAND_HEADER("ClearHolidaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID).Put8(scheduleId);
    COMMAND_FOOTER();
}

/*
 * Command ClearPin
 */
PacketBufferHandle encodeDoorLockClusterClearPinCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
{
    COMMAND_HEADER("ClearPin", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_PIN_COMMAND_ID).Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command ClearRfid
 */
PacketBufferHandle encodeDoorLockClusterClearRfidCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
{
    COMMAND_HEADER("ClearRfid", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_RFID_COMMAND_ID).Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command ClearWeekdaySchedule
 */
PacketBufferHandle encodeDoorLockClusterClearWeekdayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                    uint8_t scheduleId, uint16_t userId)
{
    COMMAND_HEADER("ClearWeekdaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command ClearYeardaySchedule
 */
PacketBufferHandle encodeDoorLockClusterClearYeardayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                    uint8_t scheduleId, uint16_t userId)
{
    COMMAND_HEADER("ClearYeardaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command GetHolidaySchedule
 */
PacketBufferHandle encodeDoorLockClusterGetHolidayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                  uint8_t scheduleId)
{
    COMMAND_HEADER("GetHolidaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID).Put8(scheduleId);
    COMMAND_FOOTER();
}

/*
 * Command GetLogRecord
 */
PacketBufferHandle encodeDoorLockClusterGetLogRecordCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t logIndex)
{
    COMMAND_HEADER("GetLogRecord", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_LOG_RECORD_COMMAND_ID).Put16(logIndex);
    COMMAND_FOOTER();
}

/*
 * Command GetPin
 */
PacketBufferHandle encodeDoorLockClusterGetPinCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
{
    COMMAND_HEADER("GetPin", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_PIN_COMMAND_ID).Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command GetRfid
 */
PacketBufferHandle encodeDoorLockClusterGetRfidCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
{
    COMMAND_HEADER("GetRfid", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_RFID_COMMAND_ID).Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command GetUserType
 */
PacketBufferHandle encodeDoorLockClusterGetUserTypeCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
{
    COMMAND_HEADER("GetUserType", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_USER_TYPE_COMMAND_ID).Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command GetWeekdaySchedule
 */
PacketBufferHandle encodeDoorLockClusterGetWeekdayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                  uint8_t scheduleId, uint16_t userId)
{
    COMMAND_HEADER("GetWeekdaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command GetYeardaySchedule
 */
PacketBufferHandle encodeDoorLockClusterGetYeardayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                  uint8_t scheduleId, uint16_t userId)
{
    COMMAND_HEADER("GetYeardaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put16(userId);
    COMMAND_FOOTER();
}

/*
 * Command LockDoor
 */
PacketBufferHandle encodeDoorLockClusterLockDoorCommand(uint8_t seqNum, EndpointId destinationEndpoint, char * pin)
{
    COMMAND_HEADER("LockDoor", DOOR_LOCK_CLUSTER_ID);
    size_t pinStrLen = strlen(pin);
    if (!CanCastTo<uint8_t>(pinStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_LOCK_DOOR_COMMAND_ID)
        .Put(static_cast<uint8_t>(pinStrLen))
        .Put(pin);
    COMMAND_FOOTER();
}

/*
 * Command SetHolidaySchedule
 */
PacketBufferHandle encodeDoorLockClusterSetHolidayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                  uint8_t scheduleId, uint32_t localStartTime,
                                                                  uint32_t localEndTime, uint8_t operatingModeDuringHoliday)
{
    COMMAND_HEADER("SetHolidaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put32(localStartTime)
        .Put32(localEndTime)
        .Put8(operatingModeDuringHoliday);
    COMMAND_FOOTER();
}

/*
 * Command SetPin
 */
PacketBufferHandle encodeDoorLockClusterSetPinCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId,
                                                      uint8_t userStatus, uint8_t userType, char * pin)
{
    COMMAND_HEADER("SetPin", DOOR_LOCK_CLUSTER_ID);
    size_t pinStrLen = strlen(pin);
    if (!CanCastTo<uint8_t>(pinStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_SET_PIN_COMMAND_ID)
        .Put16(userId)
        .Put8(userStatus)
        .Put8(userType)
        .Put(static_cast<uint8_t>(pinStrLen))
        .Put(pin);
    COMMAND_FOOTER();
}

/*
 * Command SetRfid
 */
PacketBufferHandle encodeDoorLockClusterSetRfidCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId,
                                                       uint8_t userStatus, uint8_t userType, char * id)
{
    COMMAND_HEADER("SetRfid", DOOR_LOCK_CLUSTER_ID);
    size_t idStrLen = strlen(id);
    if (!CanCastTo<uint8_t>(idStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, idStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_SET_RFID_COMMAND_ID)
        .Put16(userId)
        .Put8(userStatus)
        .Put8(userType)
        .Put(static_cast<uint8_t>(idStrLen))
        .Put(id);
    COMMAND_FOOTER();
}

/*
 * Command SetUserType
 */
PacketBufferHandle encodeDoorLockClusterSetUserTypeCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId,
                                                           uint8_t userType)
{
    COMMAND_HEADER("SetUserType", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_SET_USER_TYPE_COMMAND_ID).Put16(userId).Put8(userType);
    COMMAND_FOOTER();
}

/*
 * Command SetWeekdaySchedule
 */
PacketBufferHandle encodeDoorLockClusterSetWeekdayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                  uint8_t scheduleId, uint16_t userId, uint8_t daysMask,
                                                                  uint8_t startHour, uint8_t startMinute, uint8_t endHour,
                                                                  uint8_t endMinute)
{
    COMMAND_HEADER("SetWeekdaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put16(userId)
        .Put8(daysMask)
        .Put8(startHour)
        .Put8(startMinute)
        .Put8(endHour)
        .Put8(endMinute);
    COMMAND_FOOTER();
}

/*
 * Command SetYeardaySchedule
 */
PacketBufferHandle encodeDoorLockClusterSetYeardayScheduleCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                  uint8_t scheduleId, uint16_t userId, uint32_t localStartTime,
                                                                  uint32_t localEndTime)
{
    COMMAND_HEADER("SetYeardaySchedule", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID)
        .Put8(scheduleId)
        .Put16(userId)
        .Put32(localStartTime)
        .Put32(localEndTime);
    COMMAND_FOOTER();
}

/*
 * Command UnlockDoor
 */
PacketBufferHandle encodeDoorLockClusterUnlockDoorCommand(uint8_t seqNum, EndpointId destinationEndpoint, char * pin)
{
    COMMAND_HEADER("UnlockDoor", DOOR_LOCK_CLUSTER_ID);
    size_t pinStrLen = strlen(pin);
    if (!CanCastTo<uint8_t>(pinStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_UNLOCK_DOOR_COMMAND_ID)
        .Put(static_cast<uint8_t>(pinStrLen))
        .Put(pin);
    COMMAND_FOOTER();
}

/*
 * Command UnlockWithTimeout
 */
PacketBufferHandle encodeDoorLockClusterUnlockWithTimeoutCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                 uint16_t timeoutInSeconds, char * pin)
{
    COMMAND_HEADER("UnlockWithTimeout", DOOR_LOCK_CLUSTER_ID);
    size_t pinStrLen = strlen(pin);
    if (!CanCastTo<uint8_t>(pinStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID)
        .Put16(timeoutInSeconds)
        .Put(static_cast<uint8_t>(pinStrLen))
        .Put(pin);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeDoorLockClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverDoorLockAttributes", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute LockState
 */
PacketBufferHandle encodeDoorLockClusterReadLockStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadDoorLockLockState", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeDoorLockClusterConfigureLockStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                    uint16_t minInterval, uint16_t maxInterval)
{
    COMMAND_HEADER("ReportDoorLockLockState", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0000)
        .Put8(48)
        .Put16(minInterval)
        .Put16(maxInterval);
    COMMAND_FOOTER();
}

/*
 * Attribute LockType
 */
PacketBufferHandle encodeDoorLockClusterReadLockTypeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadDoorLockLockType", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
    COMMAND_FOOTER();
}

/*
 * Attribute ActuatorEnabled
 */
PacketBufferHandle encodeDoorLockClusterReadActuatorEnabledAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadDoorLockActuatorEnabled", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeDoorLockClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadDoorLockClusterRevision", DOOR_LOCK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster Groups                                                      | 0x0004 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * AddGroup                                                          |   0x00 |
| * AddGroupIfIdentifying                                             |   0x05 |
| * GetGroupMembership                                                |   0x02 |
| * RemoveAllGroups                                                   |   0x04 |
| * RemoveGroup                                                       |   0x03 |
| * ViewGroup                                                         |   0x01 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * NameSupport                                                       | 0x0000 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command AddGroup
 */
PacketBufferHandle encodeGroupsClusterAddGroupCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                      char * groupName)
{
    COMMAND_HEADER("AddGroup", GROUPS_CLUSTER_ID);
    size_t groupNameStrLen = strlen(groupName);
    if (!CanCastTo<uint8_t>(groupNameStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, groupNameStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_ADD_GROUP_COMMAND_ID)
        .Put16(groupId)
        .Put(static_cast<uint8_t>(groupNameStrLen))
        .Put(groupName);
    COMMAND_FOOTER();
}

/*
 * Command AddGroupIfIdentifying
 */
PacketBufferHandle encodeGroupsClusterAddGroupIfIdentifyingCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                                   char * groupName)
{
    COMMAND_HEADER("AddGroupIfIdentifying", GROUPS_CLUSTER_ID);
    size_t groupNameStrLen = strlen(groupName);
    if (!CanCastTo<uint8_t>(groupNameStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, groupNameStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID)
        .Put16(groupId)
        .Put(static_cast<uint8_t>(groupNameStrLen))
        .Put(groupName);
    COMMAND_FOOTER();
}

/*
 * Command GetGroupMembership
 */
PacketBufferHandle encodeGroupsClusterGetGroupMembershipCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t groupCount,
                                                                uint16_t groupList)
{
    COMMAND_HEADER("GetGroupMembership", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID)
        .Put8(groupCount)
        .Put16(groupList);
    COMMAND_FOOTER();
}

/*
 * Command RemoveAllGroups
 */
PacketBufferHandle encodeGroupsClusterRemoveAllGroupsCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("RemoveAllGroups", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_ALL_GROUPS_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command RemoveGroup
 */
PacketBufferHandle encodeGroupsClusterRemoveGroupCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
{
    COMMAND_HEADER("RemoveGroup", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_GROUP_COMMAND_ID).Put16(groupId);
    COMMAND_FOOTER();
}

/*
 * Command ViewGroup
 */
PacketBufferHandle encodeGroupsClusterViewGroupCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
{
    COMMAND_HEADER("ViewGroup", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_VIEW_GROUP_COMMAND_ID).Put16(groupId);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeGroupsClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverGroupsAttributes", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute NameSupport
 */
PacketBufferHandle encodeGroupsClusterReadNameSupportAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadGroupsNameSupport", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeGroupsClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadGroupsClusterRevision", GROUPS_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster IasZone                                                     | 0x0500 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * ZoneState                                                         | 0x0000 |
| * ZoneType                                                          | 0x0001 |
| * ZoneStatus                                                        | 0x0002 |
| * IasCieAddress                                                     | 0x0010 |
| * ZoneId                                                            | 0x0011 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

PacketBufferHandle encodeIasZoneClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverIasZoneAttributes", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute ZoneState
 */
PacketBufferHandle encodeIasZoneClusterReadZoneStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIasZoneZoneState", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

/*
 * Attribute ZoneType
 */
PacketBufferHandle encodeIasZoneClusterReadZoneTypeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIasZoneZoneType", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
    COMMAND_FOOTER();
}

/*
 * Attribute ZoneStatus
 */
PacketBufferHandle encodeIasZoneClusterReadZoneStatusAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIasZoneZoneStatus", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
    COMMAND_FOOTER();
}

/*
 * Attribute IasCieAddress
 */
PacketBufferHandle encodeIasZoneClusterReadIasCieAddressAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIasZoneIasCieAddress", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0010);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeIasZoneClusterWriteIasCieAddressAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                   uint64_t iasCieAddress)
{
    COMMAND_HEADER("WriteIasZoneIasCieAddress", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0010)
        .Put8(240)
        .Put64(static_cast<uint64_t>(iasCieAddress));
    COMMAND_FOOTER();
}

/*
 * Attribute ZoneId
 */
PacketBufferHandle encodeIasZoneClusterReadZoneIdAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIasZoneZoneId", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0011);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeIasZoneClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIasZoneClusterRevision", IAS_ZONE_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster Identify                                                    | 0x0003 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * Identify                                                          |   0x00 |
| * IdentifyQuery                                                     |   0x01 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * IdentifyTime                                                      | 0x0000 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command Identify
 */
PacketBufferHandle encodeIdentifyClusterIdentifyCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t identifyTime)
{
    COMMAND_HEADER("Identify", IDENTIFY_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_IDENTIFY_COMMAND_ID).Put16(identifyTime);
    COMMAND_FOOTER();
}

/*
 * Command IdentifyQuery
 */
PacketBufferHandle encodeIdentifyClusterIdentifyQueryCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("IdentifyQuery", IDENTIFY_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_IDENTIFY_QUERY_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeIdentifyClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverIdentifyAttributes", IDENTIFY_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute IdentifyTime
 */
PacketBufferHandle encodeIdentifyClusterReadIdentifyTimeAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIdentifyIdentifyTime", IDENTIFY_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeIdentifyClusterWriteIdentifyTimeAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                   uint16_t identifyTime)
{
    COMMAND_HEADER("WriteIdentifyIdentifyTime", IDENTIFY_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16(0x0000)
        .Put8(33)
        .Put16(static_cast<uint16_t>(identifyTime));
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeIdentifyClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadIdentifyClusterRevision", IDENTIFY_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster LevelControl                                                | 0x0008 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * Move                                                              |   0x01 |
| * MoveToLevel                                                       |   0x00 |
| * MoveToLevelWithOnOff                                              |   0x04 |
| * MoveWithOnOff                                                     |   0x05 |
| * Step                                                              |   0x02 |
| * StepWithOnOff                                                     |   0x06 |
| * Stop                                                              |   0x03 |
| * StopWithOnOff                                                     |   0x07 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * CurrentLevel                                                      | 0x0000 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command Move
 */
PacketBufferHandle encodeLevelControlClusterMoveCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t moveMode,
                                                        uint8_t rate, uint8_t optionMask, uint8_t optionOverride)
{
    COMMAND_HEADER("Move", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_COMMAND_ID)
        .Put8(moveMode)
        .Put8(rate)
        .Put8(optionMask)
        .Put8(optionOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToLevel
 */
PacketBufferHandle encodeLevelControlClusterMoveToLevelCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t level,
                                                               uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride)
{
    COMMAND_HEADER("MoveToLevel", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_LEVEL_COMMAND_ID)
        .Put8(level)
        .Put16(transitionTime)
        .Put8(optionMask)
        .Put8(optionOverride);
    COMMAND_FOOTER();
}

/*
 * Command MoveToLevelWithOnOff
 */
PacketBufferHandle encodeLevelControlClusterMoveToLevelWithOnOffCommand(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                        uint8_t level, uint16_t transitionTime)
{
    COMMAND_HEADER("MoveToLevelWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID)
        .Put8(level)
        .Put16(transitionTime);
    COMMAND_FOOTER();
}

/*
 * Command MoveWithOnOff
 */
PacketBufferHandle encodeLevelControlClusterMoveWithOnOffCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t moveMode,
                                                                 uint8_t rate)
{
    COMMAND_HEADER("MoveWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_MOVE_WITH_ON_OFF_COMMAND_ID).Put8(moveMode).Put8(rate);
    COMMAND_FOOTER();
}

/*
 * Command Step
 */
PacketBufferHandle encodeLevelControlClusterStepCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t stepMode,
                                                        uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask,
                                                        uint8_t optionOverride)
{
    COMMAND_HEADER("Step", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STEP_COMMAND_ID)
        .Put8(stepMode)
        .Put8(stepSize)
        .Put16(transitionTime)
        .Put8(optionMask)
        .Put8(optionOverride);
    COMMAND_FOOTER();
}

/*
 * Command StepWithOnOff
 */
PacketBufferHandle encodeLevelControlClusterStepWithOnOffCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t stepMode,
                                                                 uint8_t stepSize, uint16_t transitionTime)
{
    COMMAND_HEADER("StepWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_STEP_WITH_ON_OFF_COMMAND_ID)
        .Put8(stepMode)
        .Put8(stepSize)
        .Put16(transitionTime);
    COMMAND_FOOTER();
}

/*
 * Command Stop
 */
PacketBufferHandle encodeLevelControlClusterStopCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t optionMask,
                                                        uint8_t optionOverride)
{
    COMMAND_HEADER("Stop", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STOP_COMMAND_ID).Put8(optionMask).Put8(optionOverride);
    COMMAND_FOOTER();
}

/*
 * Command StopWithOnOff
 */
PacketBufferHandle encodeLevelControlClusterStopWithOnOffCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("StopWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STOP_WITH_ON_OFF_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeLevelControlClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverLevelControlAttributes", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentLevel
 */
PacketBufferHandle encodeLevelControlClusterReadCurrentLevelAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadLevelControlCurrentLevel", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeLevelControlClusterConfigureCurrentLevelAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
                                                                           uint16_t minInterval, uint16_t maxInterval,
                                                                           uint8_t change)
{
    COMMAND_HEADER("ReportLevelControlCurrentLevel", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0000)
        .Put8(32)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put8(static_cast<uint8_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeLevelControlClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadLevelControlClusterRevision", LEVEL_CONTROL_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster MediaPlayback                                               | 0xF001 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * FastForwardRequest                                                |   0x07 |
| * NextRequest                                                       |   0x05 |
| * PauseRequest                                                      |   0x01 |
| * PlayRequest                                                       |   0x00 |
| * PreviousRequest                                                   |   0x04 |
| * RewindRequest                                                     |   0x06 |
| * SkipBackwardRequest                                               |   0x09 |
| * SkipForwardRequest                                                |   0x08 |
| * StartOverRequest                                                  |   0x03 |
| * StopRequest                                                       |   0x02 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * CurrentState                                                      | 0x0000 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command FastForwardRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterFastForwardRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("FastForwardRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_FAST_FORWARD_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command NextRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterNextRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("NextRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_NEXT_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command PauseRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterPauseRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("PauseRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_PAUSE_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command PlayRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterPlayRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("PlayRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_PLAY_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command PreviousRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterPreviousRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("PreviousRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_PREVIOUS_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command RewindRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterRewindRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("RewindRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REWIND_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command SkipBackwardRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterSkipBackwardRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("SkipBackwardRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command SkipForwardRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterSkipForwardRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("SkipForwardRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command StartOverRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterStartOverRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("StartOverRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_START_OVER_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command StopRequest
 */
PacketBufferHandle encodeMediaPlaybackClusterStopRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("StopRequest", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STOP_REQUEST_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeMediaPlaybackClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverMediaPlaybackAttributes", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentState
 */
PacketBufferHandle encodeMediaPlaybackClusterReadCurrentStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadMediaPlaybackCurrentState", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeMediaPlaybackClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadMediaPlaybackClusterRevision", MEDIA_PLAYBACK_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster OnOff                                                       | 0x0006 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * Off                                                               |   0x00 |
| * On                                                                |   0x01 |
| * Toggle                                                            |   0x02 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * OnOff                                                             | 0x0000 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command Off
 */
PacketBufferHandle encodeOnOffClusterOffCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("Off", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_OFF_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command On
 */
PacketBufferHandle encodeOnOffClusterOnCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("On", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_ON_COMMAND_ID);
    COMMAND_FOOTER();
}

/*
 * Command Toggle
 */
PacketBufferHandle encodeOnOffClusterToggleCommand(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("Toggle", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_TOGGLE_COMMAND_ID);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeOnOffClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverOnOffAttributes", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute OnOff
 */
PacketBufferHandle encodeOnOffClusterReadOnOffAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadOnOffOnOff", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeOnOffClusterConfigureOnOffAttribute(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t minInterval,
                                                             uint16_t maxInterval)
{
    COMMAND_HEADER("ReportOnOffOnOff", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0000)
        .Put8(16)
        .Put16(minInterval)
        .Put16(maxInterval);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeOnOffClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadOnOffClusterRevision", ON_OFF_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster Scenes                                                      | 0x0005 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
| * AddScene                                                          |   0x00 |
| * GetSceneMembership                                                |   0x06 |
| * RecallScene                                                       |   0x05 |
| * RemoveAllScenes                                                   |   0x03 |
| * RemoveScene                                                       |   0x02 |
| * StoreScene                                                        |   0x04 |
| * ViewScene                                                         |   0x01 |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * SceneCount                                                        | 0x0000 |
| * CurrentScene                                                      | 0x0001 |
| * CurrentGroup                                                      | 0x0002 |
| * SceneValid                                                        | 0x0003 |
| * NameSupport                                                       | 0x0004 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
 * Command AddScene
 */
PacketBufferHandle encodeScenesClusterAddSceneCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                      uint8_t sceneId, uint16_t transitionTime, char * sceneName,
                                                      chip::ClusterId clusterId, uint8_t length, uint8_t value)
{
    COMMAND_HEADER("AddScene", SCENES_CLUSTER_ID);
    size_t sceneNameStrLen = strlen(sceneName);
    if (!CanCastTo<uint8_t>(sceneNameStrLen))
    {
        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, sceneNameStrLen);
        return PacketBufferHandle();
    }
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_ADD_SCENE_COMMAND_ID)
        .Put16(groupId)
        .Put8(sceneId)
        .Put16(transitionTime)
        .Put(static_cast<uint8_t>(sceneNameStrLen))
        .Put(sceneName)
        .Put16(clusterId)
        .Put8(length)
        .Put8(value);
    COMMAND_FOOTER();
}

/*
 * Command GetSceneMembership
 */
PacketBufferHandle encodeScenesClusterGetSceneMembershipCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
{
    COMMAND_HEADER("GetSceneMembership", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID).Put16(groupId);
    COMMAND_FOOTER();
}

/*
 * Command RecallScene
 */
PacketBufferHandle encodeScenesClusterRecallSceneCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                         uint8_t sceneId, uint16_t transitionTime)
{
    COMMAND_HEADER("RecallScene", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand)
        .Put8(seqNum)
        .Put8(ZCL_RECALL_SCENE_COMMAND_ID)
        .Put16(groupId)
        .Put8(sceneId)
        .Put16(transitionTime);
    COMMAND_FOOTER();
}

/*
 * Command RemoveAllScenes
 */
PacketBufferHandle encodeScenesClusterRemoveAllScenesCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
{
    COMMAND_HEADER("RemoveAllScenes", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_ALL_SCENES_COMMAND_ID).Put16(groupId);
    COMMAND_FOOTER();
}

/*
 * Command RemoveScene
 */
PacketBufferHandle encodeScenesClusterRemoveSceneCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                         uint8_t sceneId)
{
    COMMAND_HEADER("RemoveScene", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_SCENE_COMMAND_ID).Put16(groupId).Put8(sceneId);
    COMMAND_FOOTER();
}

/*
 * Command StoreScene
 */
PacketBufferHandle encodeScenesClusterStoreSceneCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                        uint8_t sceneId)
{
    COMMAND_HEADER("StoreScene", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STORE_SCENE_COMMAND_ID).Put16(groupId).Put8(sceneId);
    COMMAND_FOOTER();
}

/*
 * Command ViewScene
 */
PacketBufferHandle encodeScenesClusterViewSceneCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
                                                       uint8_t sceneId)
{
    COMMAND_HEADER("ViewScene", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_VIEW_SCENE_COMMAND_ID).Put16(groupId).Put8(sceneId);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeScenesClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverScenesAttributes", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute SceneCount
 */
PacketBufferHandle encodeScenesClusterReadSceneCountAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadScenesSceneCount", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentScene
 */
PacketBufferHandle encodeScenesClusterReadCurrentSceneAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadScenesCurrentScene", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
    COMMAND_FOOTER();
}

/*
 * Attribute CurrentGroup
 */
PacketBufferHandle encodeScenesClusterReadCurrentGroupAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadScenesCurrentGroup", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
    COMMAND_FOOTER();
}

/*
 * Attribute SceneValid
 */
PacketBufferHandle encodeScenesClusterReadSceneValidAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadScenesSceneValid", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0003);
    COMMAND_FOOTER();
}

/*
 * Attribute NameSupport
 */
PacketBufferHandle encodeScenesClusterReadNameSupportAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadScenesNameSupport", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0004);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeScenesClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadScenesClusterRevision", SCENES_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}

/*----------------------------------------------------------------------------*\
| Cluster TemperatureMeasurement                                      | 0x0402 |
|------------------------------------------------------------------------------|
| Commands:                                                           |        |
|------------------------------------------------------------------------------|
| Attributes:                                                         |        |
| * MeasuredValue                                                     | 0x0000 |
| * MinMeasuredValue                                                  | 0x0001 |
| * MaxMeasuredValue                                                  | 0x0002 |
| * ClusterRevision                                                   | 0xFFFD |
\*----------------------------------------------------------------------------*/

PacketBufferHandle encodeTemperatureMeasurementClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("DiscoverTemperatureMeasurementAttributes", TEMP_MEASUREMENT_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
    COMMAND_FOOTER();
}

/*
 * Attribute MeasuredValue
 */
PacketBufferHandle encodeTemperatureMeasurementClusterReadMeasuredValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadTemperatureMeasurementMeasuredValue", TEMP_MEASUREMENT_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
    COMMAND_FOOTER();
}

PacketBufferHandle encodeTemperatureMeasurementClusterConfigureMeasuredValueAttribute(uint8_t seqNum,
                                                                                      EndpointId destinationEndpoint,
                                                                                      uint16_t minInterval, uint16_t maxInterval,
                                                                                      int16_t change)
{
    COMMAND_HEADER("ReportTemperatureMeasurementMeasuredValue", TEMP_MEASUREMENT_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID)
        .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED)
        .Put16(0x0000)
        .Put8(41)
        .Put16(minInterval)
        .Put16(maxInterval);
    buf.Put16(static_cast<uint16_t>(change));
    COMMAND_FOOTER();
}

/*
 * Attribute MinMeasuredValue
 */
PacketBufferHandle encodeTemperatureMeasurementClusterReadMinMeasuredValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadTemperatureMeasurementMinMeasuredValue", TEMP_MEASUREMENT_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
    COMMAND_FOOTER();
}

/*
 * Attribute MaxMeasuredValue
 */
PacketBufferHandle encodeTemperatureMeasurementClusterReadMaxMeasuredValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadTemperatureMeasurementMaxMeasuredValue", TEMP_MEASUREMENT_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
    COMMAND_FOOTER();
}

/*
 * Attribute ClusterRevision
 */
PacketBufferHandle encodeTemperatureMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
{
    COMMAND_HEADER("ReadTemperatureMeasurementClusterRevision", TEMP_MEASUREMENT_CLUSTER_ID);
    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
    COMMAND_FOOTER();
}
