#![allow(clippy::too_many_arguments)]
use crate::tlv;
use anyhow;
use serde_json;
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum ClosureUnit {
Millimeter = 0,
Degree = 1,
}
impl ClosureUnit {
pub fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(ClosureUnit::Millimeter),
1 => Some(ClosureUnit::Degree),
_ => None,
}
}
pub fn to_u8(self) -> u8 {
self as u8
}
}
impl From<ClosureUnit> for u8 {
fn from(val: ClosureUnit) -> Self {
val as u8
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum ModulationType {
Slatsorientation = 0,
Slatsopenwork = 1,
Stripesalignment = 2,
Opacity = 3,
Ventilation = 4,
}
impl ModulationType {
pub fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(ModulationType::Slatsorientation),
1 => Some(ModulationType::Slatsopenwork),
2 => Some(ModulationType::Stripesalignment),
3 => Some(ModulationType::Opacity),
4 => Some(ModulationType::Ventilation),
_ => None,
}
}
pub fn to_u8(self) -> u8 {
self as u8
}
}
impl From<ModulationType> for u8 {
fn from(val: ModulationType) -> Self {
val as u8
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum Overflow {
Nooverflow = 0,
Inside = 1,
Outside = 2,
Topinside = 3,
Topoutside = 4,
Bottominside = 5,
Bottomoutside = 6,
Leftinside = 7,
Leftoutside = 8,
Rightinside = 9,
Rightoutside = 10,
}
impl Overflow {
pub fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(Overflow::Nooverflow),
1 => Some(Overflow::Inside),
2 => Some(Overflow::Outside),
3 => Some(Overflow::Topinside),
4 => Some(Overflow::Topoutside),
5 => Some(Overflow::Bottominside),
6 => Some(Overflow::Bottomoutside),
7 => Some(Overflow::Leftinside),
8 => Some(Overflow::Leftoutside),
9 => Some(Overflow::Rightinside),
10 => Some(Overflow::Rightoutside),
_ => None,
}
}
pub fn to_u8(self) -> u8 {
self as u8
}
}
impl From<Overflow> for u8 {
fn from(val: Overflow) -> Self {
val as u8
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum RotationAxis {
Left = 0,
Centeredvertical = 1,
Leftandright = 2,
Right = 3,
Top = 4,
Centeredhorizontal = 5,
Topandbottom = 6,
Bottom = 7,
Leftbarrier = 8,
Leftandrightbarriers = 9,
Rightbarrier = 10,
}
impl RotationAxis {
pub fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(RotationAxis::Left),
1 => Some(RotationAxis::Centeredvertical),
2 => Some(RotationAxis::Leftandright),
3 => Some(RotationAxis::Right),
4 => Some(RotationAxis::Top),
5 => Some(RotationAxis::Centeredhorizontal),
6 => Some(RotationAxis::Topandbottom),
7 => Some(RotationAxis::Bottom),
8 => Some(RotationAxis::Leftbarrier),
9 => Some(RotationAxis::Leftandrightbarriers),
10 => Some(RotationAxis::Rightbarrier),
_ => None,
}
}
pub fn to_u8(self) -> u8 {
self as u8
}
}
impl From<RotationAxis> for u8 {
fn from(val: RotationAxis) -> Self {
val as u8
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum StepDirection {
Decrease = 0,
Increase = 1,
}
impl StepDirection {
pub fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(StepDirection::Decrease),
1 => Some(StepDirection::Increase),
_ => None,
}
}
pub fn to_u8(self) -> u8 {
self as u8
}
}
impl From<StepDirection> for u8 {
fn from(val: StepDirection) -> Self {
val as u8
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum TranslationDirection {
Downward = 0,
Upward = 1,
Verticalmask = 2,
Verticalsymmetry = 3,
Leftward = 4,
Rightward = 5,
Horizontalmask = 6,
Horizontalsymmetry = 7,
Forward = 8,
Backward = 9,
Depthmask = 10,
Depthsymmetry = 11,
}
impl TranslationDirection {
pub fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(TranslationDirection::Downward),
1 => Some(TranslationDirection::Upward),
2 => Some(TranslationDirection::Verticalmask),
3 => Some(TranslationDirection::Verticalsymmetry),
4 => Some(TranslationDirection::Leftward),
5 => Some(TranslationDirection::Rightward),
6 => Some(TranslationDirection::Horizontalmask),
7 => Some(TranslationDirection::Horizontalsymmetry),
8 => Some(TranslationDirection::Forward),
9 => Some(TranslationDirection::Backward),
10 => Some(TranslationDirection::Depthmask),
11 => Some(TranslationDirection::Depthsymmetry),
_ => None,
}
}
pub fn to_u8(self) -> u8 {
self as u8
}
}
impl From<TranslationDirection> for u8 {
fn from(val: TranslationDirection) -> Self {
val as u8
}
}
pub type LatchControlModes = u8;
pub mod latchcontrolmodes {
pub const REMOTE_LATCHING: u8 = 0x01;
pub const REMOTE_UNLATCHING: u8 = 0x02;
}
#[derive(Debug, serde::Serialize)]
pub struct DimensionState {
pub position: Option<u16>,
pub latch: Option<bool>,
pub speed: Option<u8>,
}
#[derive(Debug, serde::Serialize)]
pub struct RangePercent {
pub min: Option<u16>,
pub max: Option<u16>,
}
#[derive(Debug, serde::Serialize)]
pub struct UnitRange {
pub min: Option<i16>,
pub max: Option<i16>,
}
pub fn encode_set_target(position: Option<u16>, latch: Option<bool>, speed: Option<u8>) -> anyhow::Result<Vec<u8>> {
let mut tlv_fields: Vec<tlv::TlvItemEnc> = Vec::new();
if let Some(x) = position { tlv_fields.push((0, tlv::TlvItemValueEnc::UInt16(x)).into()); }
if let Some(x) = latch { tlv_fields.push((1, tlv::TlvItemValueEnc::Bool(x)).into()); }
if let Some(x) = speed { tlv_fields.push((2, tlv::TlvItemValueEnc::UInt8(x)).into()); }
let tlv = tlv::TlvItemEnc {
tag: 0,
value: tlv::TlvItemValueEnc::StructInvisible(tlv_fields),
};
Ok(tlv.encode()?)
}
pub fn encode_step(direction: StepDirection, number_of_steps: u16, speed: Option<u8>) -> anyhow::Result<Vec<u8>> {
let mut tlv_fields: Vec<tlv::TlvItemEnc> = Vec::new();
tlv_fields.push((0, tlv::TlvItemValueEnc::UInt8(direction.to_u8())).into());
tlv_fields.push((1, tlv::TlvItemValueEnc::UInt16(number_of_steps)).into());
if let Some(x) = speed { tlv_fields.push((2, tlv::TlvItemValueEnc::UInt8(x)).into()); }
let tlv = tlv::TlvItemEnc {
tag: 0,
value: tlv::TlvItemValueEnc::StructInvisible(tlv_fields),
};
Ok(tlv.encode()?)
}
pub fn decode_current_state(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<DimensionState>> {
if let tlv::TlvItemValue::List(_fields) = inp {
let item = tlv::TlvItem { tag: 0, value: inp.clone() };
Ok(Some(DimensionState {
position: item.get_int(&[0]).map(|v| v as u16),
latch: item.get_bool(&[1]),
speed: item.get_int(&[2]).map(|v| v as u8),
}))
} else {
Ok(None)
}
}
pub fn decode_target_state(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<DimensionState>> {
if let tlv::TlvItemValue::List(_fields) = inp {
let item = tlv::TlvItem { tag: 0, value: inp.clone() };
Ok(Some(DimensionState {
position: item.get_int(&[0]).map(|v| v as u16),
latch: item.get_bool(&[1]),
speed: item.get_int(&[2]).map(|v| v as u8),
}))
} else {
Ok(None)
}
}
pub fn decode_resolution(inp: &tlv::TlvItemValue) -> anyhow::Result<u16> {
if let tlv::TlvItemValue::Int(v) = inp {
Ok(*v as u16)
} else {
Err(anyhow::anyhow!("Expected UInt16"))
}
}
pub fn decode_step_value(inp: &tlv::TlvItemValue) -> anyhow::Result<u16> {
if let tlv::TlvItemValue::Int(v) = inp {
Ok(*v as u16)
} else {
Err(anyhow::anyhow!("Expected UInt16"))
}
}
pub fn decode_unit(inp: &tlv::TlvItemValue) -> anyhow::Result<ClosureUnit> {
if let tlv::TlvItemValue::Int(v) = inp {
ClosureUnit::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
} else {
Err(anyhow::anyhow!("Expected Integer"))
}
}
pub fn decode_unit_range(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<UnitRange>> {
if let tlv::TlvItemValue::List(_fields) = inp {
let item = tlv::TlvItem { tag: 0, value: inp.clone() };
Ok(Some(UnitRange {
min: item.get_int(&[0]).map(|v| v as i16),
max: item.get_int(&[1]).map(|v| v as i16),
}))
} else {
Ok(None)
}
}
pub fn decode_limit_range(inp: &tlv::TlvItemValue) -> anyhow::Result<RangePercent> {
if let tlv::TlvItemValue::List(_fields) = inp {
let item = tlv::TlvItem { tag: 0, value: inp.clone() };
Ok(RangePercent {
min: item.get_int(&[0]).map(|v| v as u16),
max: item.get_int(&[1]).map(|v| v as u16),
})
} else {
Err(anyhow::anyhow!("Expected struct fields"))
}
}
pub fn decode_translation_direction(inp: &tlv::TlvItemValue) -> anyhow::Result<TranslationDirection> {
if let tlv::TlvItemValue::Int(v) = inp {
TranslationDirection::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
} else {
Err(anyhow::anyhow!("Expected Integer"))
}
}
pub fn decode_rotation_axis(inp: &tlv::TlvItemValue) -> anyhow::Result<RotationAxis> {
if let tlv::TlvItemValue::Int(v) = inp {
RotationAxis::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
} else {
Err(anyhow::anyhow!("Expected Integer"))
}
}
pub fn decode_overflow(inp: &tlv::TlvItemValue) -> anyhow::Result<Overflow> {
if let tlv::TlvItemValue::Int(v) = inp {
Overflow::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
} else {
Err(anyhow::anyhow!("Expected Integer"))
}
}
pub fn decode_modulation_type(inp: &tlv::TlvItemValue) -> anyhow::Result<ModulationType> {
if let tlv::TlvItemValue::Int(v) = inp {
ModulationType::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
} else {
Err(anyhow::anyhow!("Expected Integer"))
}
}
pub fn decode_latch_control_modes(inp: &tlv::TlvItemValue) -> anyhow::Result<LatchControlModes> {
if let tlv::TlvItemValue::Int(v) = inp {
Ok(*v as u8)
} else {
Err(anyhow::anyhow!("Expected Integer"))
}
}
pub fn decode_attribute_json(cluster_id: u32, attribute_id: u32, tlv_value: &crate::tlv::TlvItemValue) -> String {
if cluster_id != 0x0105 {
return format!("{{\"error\": \"Invalid cluster ID. Expected 0x0105, got {}\"}}", cluster_id);
}
match attribute_id {
0x0000 => {
match decode_current_state(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0001 => {
match decode_target_state(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0002 => {
match decode_resolution(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0003 => {
match decode_step_value(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0004 => {
match decode_unit(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0005 => {
match decode_unit_range(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0006 => {
match decode_limit_range(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0007 => {
match decode_translation_direction(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0008 => {
match decode_rotation_axis(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x0009 => {
match decode_overflow(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x000A => {
match decode_modulation_type(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
0x000B => {
match decode_latch_control_modes(tlv_value) {
Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
Err(e) => format!("{{\"error\": \"{}\"}}", e),
}
}
_ => format!("{{\"error\": \"Unknown attribute ID: {}\"}}", attribute_id),
}
}
pub fn get_attribute_list() -> Vec<(u32, &'static str)> {
vec![
(0x0000, "CurrentState"),
(0x0001, "TargetState"),
(0x0002, "Resolution"),
(0x0003, "StepValue"),
(0x0004, "Unit"),
(0x0005, "UnitRange"),
(0x0006, "LimitRange"),
(0x0007, "TranslationDirection"),
(0x0008, "RotationAxis"),
(0x0009, "Overflow"),
(0x000A, "ModulationType"),
(0x000B, "LatchControlModes"),
]
}
pub fn get_command_list() -> Vec<(u32, &'static str)> {
vec![
(0x00, "SetTarget"),
(0x01, "Step"),
]
}
pub fn get_command_name(cmd_id: u32) -> Option<&'static str> {
match cmd_id {
0x00 => Some("SetTarget"),
0x01 => Some("Step"),
_ => None,
}
}
pub fn get_command_schema(cmd_id: u32) -> Option<Vec<crate::clusters::codec::CommandField>> {
match cmd_id {
0x00 => Some(vec![
crate::clusters::codec::CommandField { tag: 0, name: "position", kind: crate::clusters::codec::FieldKind::U32, optional: true, nullable: false },
crate::clusters::codec::CommandField { tag: 1, name: "latch", kind: crate::clusters::codec::FieldKind::Bool, optional: true, nullable: false },
crate::clusters::codec::CommandField { tag: 2, name: "speed", kind: crate::clusters::codec::FieldKind::U8, optional: true, nullable: false },
]),
0x01 => Some(vec![
crate::clusters::codec::CommandField { tag: 0, name: "direction", kind: crate::clusters::codec::FieldKind::Enum { name: "StepDirection", variants: &[(0, "Decrease"), (1, "Increase")] }, optional: false, nullable: false },
crate::clusters::codec::CommandField { tag: 1, name: "number_of_steps", kind: crate::clusters::codec::FieldKind::U16, optional: false, nullable: false },
crate::clusters::codec::CommandField { tag: 2, name: "speed", kind: crate::clusters::codec::FieldKind::U8, optional: true, nullable: false },
]),
_ => None,
}
}
pub fn encode_command_json(cmd_id: u32, args: &serde_json::Value) -> anyhow::Result<Vec<u8>> {
match cmd_id {
0x00 => {
let position = crate::clusters::codec::json_util::get_opt_u16(args, "position")?;
let latch = crate::clusters::codec::json_util::get_opt_bool(args, "latch")?;
let speed = crate::clusters::codec::json_util::get_opt_u8(args, "speed")?;
encode_set_target(position, latch, speed)
}
0x01 => {
let direction = {
let n = crate::clusters::codec::json_util::get_u64(args, "direction")?;
StepDirection::from_u8(n as u8).ok_or_else(|| anyhow::anyhow!("invalid StepDirection: {}", n))?
};
let number_of_steps = crate::clusters::codec::json_util::get_u16(args, "number_of_steps")?;
let speed = crate::clusters::codec::json_util::get_opt_u8(args, "speed")?;
encode_step(direction, number_of_steps, speed)
}
_ => Err(anyhow::anyhow!("unknown command ID: 0x{:02X}", cmd_id)),
}
}
pub async fn set_target(conn: &crate::controller::Connection, endpoint: u16, position: Option<u16>, latch: Option<bool>, speed: Option<u8>) -> anyhow::Result<()> {
conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_CMD_ID_SETTARGET, &encode_set_target(position, latch, speed)?).await?;
Ok(())
}
pub async fn step(conn: &crate::controller::Connection, endpoint: u16, direction: StepDirection, number_of_steps: u16, speed: Option<u8>) -> anyhow::Result<()> {
conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_CMD_ID_STEP, &encode_step(direction, number_of_steps, speed)?).await?;
Ok(())
}
pub async fn read_current_state(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<DimensionState>> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_CURRENTSTATE).await?;
decode_current_state(&tlv)
}
pub async fn read_target_state(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<DimensionState>> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_TARGETSTATE).await?;
decode_target_state(&tlv)
}
pub async fn read_resolution(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<u16> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_RESOLUTION).await?;
decode_resolution(&tlv)
}
pub async fn read_step_value(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<u16> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_STEPVALUE).await?;
decode_step_value(&tlv)
}
pub async fn read_unit(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<ClosureUnit> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_UNIT).await?;
decode_unit(&tlv)
}
pub async fn read_unit_range(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<UnitRange>> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_UNITRANGE).await?;
decode_unit_range(&tlv)
}
pub async fn read_limit_range(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<RangePercent> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_LIMITRANGE).await?;
decode_limit_range(&tlv)
}
pub async fn read_translation_direction(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<TranslationDirection> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_TRANSLATIONDIRECTION).await?;
decode_translation_direction(&tlv)
}
pub async fn read_rotation_axis(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<RotationAxis> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_ROTATIONAXIS).await?;
decode_rotation_axis(&tlv)
}
pub async fn read_overflow(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Overflow> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_OVERFLOW).await?;
decode_overflow(&tlv)
}
pub async fn read_modulation_type(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<ModulationType> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_MODULATIONTYPE).await?;
decode_modulation_type(&tlv)
}
pub async fn read_latch_control_modes(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<LatchControlModes> {
let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_CLOSURE_DIMENSION, crate::clusters::defs::CLUSTER_CLOSURE_DIMENSION_ATTR_ID_LATCHCONTROLMODES).await?;
decode_latch_control_modes(&tlv)
}