matc/clusters/codec/
pump_configuration_control.rs

1//! Matter TLV encoders and decoders for Pump Configuration and Control Cluster
2//! Cluster ID: 0x0200
3//!
4//! This file is automatically generated from PumpConfigurationControl.xml
5
6#![allow(clippy::too_many_arguments)]
7
8use crate::tlv;
9use anyhow;
10use serde_json;
11
12
13// Enum definitions
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
16#[repr(u8)]
17pub enum ControlMode {
18    /// The pump is running at a constant speed.
19    Constantspeed = 0,
20    /// The pump will regulate its speed to maintain a constant differential pressure over its flanges.
21    Constantpressure = 1,
22    /// The pump will regulate its speed to maintain a constant differential pressure over its flanges.
23    Proportionalpressure = 2,
24    /// The pump will regulate its speed to maintain a constant flow through the pump.
25    Constantflow = 3,
26    /// The pump will regulate its speed to maintain a constant temperature.
27    Constanttemperature = 5,
28    /// The operation of the pump is automatically optimized to provide the most suitable performance with respect to comfort and energy savings.
29    Automatic = 7,
30}
31
32impl ControlMode {
33    /// Convert from u8 value
34    pub fn from_u8(value: u8) -> Option<Self> {
35        match value {
36            0 => Some(ControlMode::Constantspeed),
37            1 => Some(ControlMode::Constantpressure),
38            2 => Some(ControlMode::Proportionalpressure),
39            3 => Some(ControlMode::Constantflow),
40            5 => Some(ControlMode::Constanttemperature),
41            7 => Some(ControlMode::Automatic),
42            _ => None,
43        }
44    }
45
46    /// Convert to u8 value
47    pub fn to_u8(self) -> u8 {
48        self as u8
49    }
50}
51
52impl From<ControlMode> for u8 {
53    fn from(val: ControlMode) -> Self {
54        val as u8
55    }
56}
57
58#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
59#[repr(u8)]
60pub enum OperationMode {
61    /// The pump is controlled by a setpoint, as defined by a connected remote sensor or by the ControlMode attribute.
62    Normal = 0,
63    /// This value sets the pump to run at the minimum possible speed it can without being stopped.
64    Minimum = 1,
65    /// This value sets the pump to run at its maximum possible speed.
66    Maximum = 2,
67    /// This value sets the pump to run with the local settings of the pump, regardless of what these are.
68    Local = 3,
69}
70
71impl OperationMode {
72    /// Convert from u8 value
73    pub fn from_u8(value: u8) -> Option<Self> {
74        match value {
75            0 => Some(OperationMode::Normal),
76            1 => Some(OperationMode::Minimum),
77            2 => Some(OperationMode::Maximum),
78            3 => Some(OperationMode::Local),
79            _ => None,
80        }
81    }
82
83    /// Convert to u8 value
84    pub fn to_u8(self) -> u8 {
85        self as u8
86    }
87}
88
89impl From<OperationMode> for u8 {
90    fn from(val: OperationMode) -> Self {
91        val as u8
92    }
93}
94
95// Bitmap definitions
96
97/// PumpStatus bitmap type
98pub type PumpStatus = u16;
99
100/// Constants for PumpStatus
101pub mod pumpstatus {
102    /// A fault related to the system or pump device is detected.
103    pub const DEVICE_FAULT: u16 = 0x01;
104    /// A fault related to the supply to the pump is detected.
105    pub const SUPPLY_FAULT: u16 = 0x02;
106    /// Setpoint is too low to achieve.
107    pub const SPEED_LOW: u16 = 0x04;
108    /// Setpoint is too high to achieve.
109    pub const SPEED_HIGH: u16 = 0x08;
110    /// Device control is overridden by hardware, such as an external STOP button or via a local HMI.
111    pub const LOCAL_OVERRIDE: u16 = 0x10;
112    /// Pump is currently running
113    pub const RUNNING: u16 = 0x20;
114    /// A remote pressure sensor is used as the sensor for the regulation of the pump.
115    pub const REMOTE_PRESSURE: u16 = 0x40;
116    /// A remote flow sensor is used as the sensor for the regulation of the pump.
117    pub const REMOTE_FLOW: u16 = 0x80;
118    /// A remote temperature sensor is used as the sensor for the regulation of the pump.
119    pub const REMOTE_TEMPERATURE: u16 = 0x100;
120}
121
122// Attribute decoders
123
124/// Decode MaxPressure attribute (0x0000)
125pub fn decode_max_pressure(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
126    if let tlv::TlvItemValue::Int(v) = inp {
127        Ok(Some(*v as i16))
128    } else {
129        Ok(None)
130    }
131}
132
133/// Decode MaxSpeed attribute (0x0001)
134pub fn decode_max_speed(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
135    if let tlv::TlvItemValue::Int(v) = inp {
136        Ok(Some(*v as u16))
137    } else {
138        Ok(None)
139    }
140}
141
142/// Decode MaxFlow attribute (0x0002)
143pub fn decode_max_flow(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
144    if let tlv::TlvItemValue::Int(v) = inp {
145        Ok(Some(*v as u16))
146    } else {
147        Ok(None)
148    }
149}
150
151/// Decode MinConstPressure attribute (0x0003)
152pub fn decode_min_const_pressure(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
153    if let tlv::TlvItemValue::Int(v) = inp {
154        Ok(Some(*v as i16))
155    } else {
156        Ok(None)
157    }
158}
159
160/// Decode MaxConstPressure attribute (0x0004)
161pub fn decode_max_const_pressure(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
162    if let tlv::TlvItemValue::Int(v) = inp {
163        Ok(Some(*v as i16))
164    } else {
165        Ok(None)
166    }
167}
168
169/// Decode MinCompPressure attribute (0x0005)
170pub fn decode_min_comp_pressure(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
171    if let tlv::TlvItemValue::Int(v) = inp {
172        Ok(Some(*v as i16))
173    } else {
174        Ok(None)
175    }
176}
177
178/// Decode MaxCompPressure attribute (0x0006)
179pub fn decode_max_comp_pressure(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
180    if let tlv::TlvItemValue::Int(v) = inp {
181        Ok(Some(*v as i16))
182    } else {
183        Ok(None)
184    }
185}
186
187/// Decode MinConstSpeed attribute (0x0007)
188pub fn decode_min_const_speed(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
189    if let tlv::TlvItemValue::Int(v) = inp {
190        Ok(Some(*v as u16))
191    } else {
192        Ok(None)
193    }
194}
195
196/// Decode MaxConstSpeed attribute (0x0008)
197pub fn decode_max_const_speed(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
198    if let tlv::TlvItemValue::Int(v) = inp {
199        Ok(Some(*v as u16))
200    } else {
201        Ok(None)
202    }
203}
204
205/// Decode MinConstFlow attribute (0x0009)
206pub fn decode_min_const_flow(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
207    if let tlv::TlvItemValue::Int(v) = inp {
208        Ok(Some(*v as u16))
209    } else {
210        Ok(None)
211    }
212}
213
214/// Decode MaxConstFlow attribute (0x000A)
215pub fn decode_max_const_flow(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
216    if let tlv::TlvItemValue::Int(v) = inp {
217        Ok(Some(*v as u16))
218    } else {
219        Ok(None)
220    }
221}
222
223/// Decode MinConstTemp attribute (0x000B)
224pub fn decode_min_const_temp(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
225    if let tlv::TlvItemValue::Int(v) = inp {
226        Ok(Some(*v as i16))
227    } else {
228        Ok(None)
229    }
230}
231
232/// Decode MaxConstTemp attribute (0x000C)
233pub fn decode_max_const_temp(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
234    if let tlv::TlvItemValue::Int(v) = inp {
235        Ok(Some(*v as i16))
236    } else {
237        Ok(None)
238    }
239}
240
241/// Decode PumpStatus attribute (0x0010)
242pub fn decode_pump_status(inp: &tlv::TlvItemValue) -> anyhow::Result<PumpStatus> {
243    if let tlv::TlvItemValue::Int(v) = inp {
244        Ok(*v as u16)
245    } else {
246        Err(anyhow::anyhow!("Expected Integer"))
247    }
248}
249
250/// Decode EffectiveOperationMode attribute (0x0011)
251pub fn decode_effective_operation_mode(inp: &tlv::TlvItemValue) -> anyhow::Result<OperationMode> {
252    if let tlv::TlvItemValue::Int(v) = inp {
253        OperationMode::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
254    } else {
255        Err(anyhow::anyhow!("Expected Integer"))
256    }
257}
258
259/// Decode EffectiveControlMode attribute (0x0012)
260pub fn decode_effective_control_mode(inp: &tlv::TlvItemValue) -> anyhow::Result<ControlMode> {
261    if let tlv::TlvItemValue::Int(v) = inp {
262        ControlMode::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
263    } else {
264        Err(anyhow::anyhow!("Expected Integer"))
265    }
266}
267
268/// Decode Capacity attribute (0x0013)
269pub fn decode_capacity(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<i16>> {
270    if let tlv::TlvItemValue::Int(v) = inp {
271        Ok(Some(*v as i16))
272    } else {
273        Ok(None)
274    }
275}
276
277/// Decode Speed attribute (0x0014)
278pub fn decode_speed(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u16>> {
279    if let tlv::TlvItemValue::Int(v) = inp {
280        Ok(Some(*v as u16))
281    } else {
282        Ok(None)
283    }
284}
285
286/// Decode LifetimeRunningHours attribute (0x0015)
287pub fn decode_lifetime_running_hours(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u8>> {
288    if let tlv::TlvItemValue::Int(v) = inp {
289        Ok(Some(*v as u8))
290    } else {
291        Ok(None)
292    }
293}
294
295/// Decode Power attribute (0x0016)
296pub fn decode_power(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u8>> {
297    if let tlv::TlvItemValue::Int(v) = inp {
298        Ok(Some(*v as u8))
299    } else {
300        Ok(None)
301    }
302}
303
304/// Decode LifetimeEnergyConsumed attribute (0x0017)
305pub fn decode_lifetime_energy_consumed(inp: &tlv::TlvItemValue) -> anyhow::Result<Option<u32>> {
306    if let tlv::TlvItemValue::Int(v) = inp {
307        Ok(Some(*v as u32))
308    } else {
309        Ok(None)
310    }
311}
312
313/// Decode OperationMode attribute (0x0020)
314pub fn decode_operation_mode(inp: &tlv::TlvItemValue) -> anyhow::Result<OperationMode> {
315    if let tlv::TlvItemValue::Int(v) = inp {
316        OperationMode::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
317    } else {
318        Err(anyhow::anyhow!("Expected Integer"))
319    }
320}
321
322/// Decode ControlMode attribute (0x0021)
323pub fn decode_control_mode(inp: &tlv::TlvItemValue) -> anyhow::Result<ControlMode> {
324    if let tlv::TlvItemValue::Int(v) = inp {
325        ControlMode::from_u8(*v as u8).ok_or_else(|| anyhow::anyhow!("Invalid enum value"))
326    } else {
327        Err(anyhow::anyhow!("Expected Integer"))
328    }
329}
330
331/// Decode AlarmMask attribute (0x0022)
332pub fn decode_alarm_mask(inp: &tlv::TlvItemValue) -> anyhow::Result<u8> {
333    if let tlv::TlvItemValue::Int(v) = inp {
334        Ok(*v as u8)
335    } else {
336        Err(anyhow::anyhow!("Expected UInt8"))
337    }
338}
339
340
341// JSON dispatcher function
342
343/// Decode attribute value and return as JSON string
344///
345/// # Parameters
346/// * `cluster_id` - The cluster identifier
347/// * `attribute_id` - The attribute identifier
348/// * `tlv_value` - The TLV value to decode
349///
350/// # Returns
351/// JSON string representation of the decoded value or error
352pub fn decode_attribute_json(cluster_id: u32, attribute_id: u32, tlv_value: &crate::tlv::TlvItemValue) -> String {
353    // Verify this is the correct cluster
354    if cluster_id != 0x0200 {
355        return format!("{{\"error\": \"Invalid cluster ID. Expected 0x0200, got {}\"}}", cluster_id);
356    }
357
358    match attribute_id {
359        0x0000 => {
360            match decode_max_pressure(tlv_value) {
361                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
362                Err(e) => format!("{{\"error\": \"{}\"}}", e),
363            }
364        }
365        0x0001 => {
366            match decode_max_speed(tlv_value) {
367                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
368                Err(e) => format!("{{\"error\": \"{}\"}}", e),
369            }
370        }
371        0x0002 => {
372            match decode_max_flow(tlv_value) {
373                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
374                Err(e) => format!("{{\"error\": \"{}\"}}", e),
375            }
376        }
377        0x0003 => {
378            match decode_min_const_pressure(tlv_value) {
379                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
380                Err(e) => format!("{{\"error\": \"{}\"}}", e),
381            }
382        }
383        0x0004 => {
384            match decode_max_const_pressure(tlv_value) {
385                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
386                Err(e) => format!("{{\"error\": \"{}\"}}", e),
387            }
388        }
389        0x0005 => {
390            match decode_min_comp_pressure(tlv_value) {
391                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
392                Err(e) => format!("{{\"error\": \"{}\"}}", e),
393            }
394        }
395        0x0006 => {
396            match decode_max_comp_pressure(tlv_value) {
397                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
398                Err(e) => format!("{{\"error\": \"{}\"}}", e),
399            }
400        }
401        0x0007 => {
402            match decode_min_const_speed(tlv_value) {
403                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
404                Err(e) => format!("{{\"error\": \"{}\"}}", e),
405            }
406        }
407        0x0008 => {
408            match decode_max_const_speed(tlv_value) {
409                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
410                Err(e) => format!("{{\"error\": \"{}\"}}", e),
411            }
412        }
413        0x0009 => {
414            match decode_min_const_flow(tlv_value) {
415                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
416                Err(e) => format!("{{\"error\": \"{}\"}}", e),
417            }
418        }
419        0x000A => {
420            match decode_max_const_flow(tlv_value) {
421                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
422                Err(e) => format!("{{\"error\": \"{}\"}}", e),
423            }
424        }
425        0x000B => {
426            match decode_min_const_temp(tlv_value) {
427                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
428                Err(e) => format!("{{\"error\": \"{}\"}}", e),
429            }
430        }
431        0x000C => {
432            match decode_max_const_temp(tlv_value) {
433                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
434                Err(e) => format!("{{\"error\": \"{}\"}}", e),
435            }
436        }
437        0x0010 => {
438            match decode_pump_status(tlv_value) {
439                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
440                Err(e) => format!("{{\"error\": \"{}\"}}", e),
441            }
442        }
443        0x0011 => {
444            match decode_effective_operation_mode(tlv_value) {
445                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
446                Err(e) => format!("{{\"error\": \"{}\"}}", e),
447            }
448        }
449        0x0012 => {
450            match decode_effective_control_mode(tlv_value) {
451                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
452                Err(e) => format!("{{\"error\": \"{}\"}}", e),
453            }
454        }
455        0x0013 => {
456            match decode_capacity(tlv_value) {
457                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
458                Err(e) => format!("{{\"error\": \"{}\"}}", e),
459            }
460        }
461        0x0014 => {
462            match decode_speed(tlv_value) {
463                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
464                Err(e) => format!("{{\"error\": \"{}\"}}", e),
465            }
466        }
467        0x0015 => {
468            match decode_lifetime_running_hours(tlv_value) {
469                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
470                Err(e) => format!("{{\"error\": \"{}\"}}", e),
471            }
472        }
473        0x0016 => {
474            match decode_power(tlv_value) {
475                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
476                Err(e) => format!("{{\"error\": \"{}\"}}", e),
477            }
478        }
479        0x0017 => {
480            match decode_lifetime_energy_consumed(tlv_value) {
481                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
482                Err(e) => format!("{{\"error\": \"{}\"}}", e),
483            }
484        }
485        0x0020 => {
486            match decode_operation_mode(tlv_value) {
487                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
488                Err(e) => format!("{{\"error\": \"{}\"}}", e),
489            }
490        }
491        0x0021 => {
492            match decode_control_mode(tlv_value) {
493                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
494                Err(e) => format!("{{\"error\": \"{}\"}}", e),
495            }
496        }
497        0x0022 => {
498            match decode_alarm_mask(tlv_value) {
499                Ok(value) => serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()),
500                Err(e) => format!("{{\"error\": \"{}\"}}", e),
501            }
502        }
503        _ => format!("{{\"error\": \"Unknown attribute ID: {}\"}}", attribute_id),
504    }
505}
506
507/// Get list of all attributes supported by this cluster
508///
509/// # Returns
510/// Vector of tuples containing (attribute_id, attribute_name)
511pub fn get_attribute_list() -> Vec<(u32, &'static str)> {
512    vec![
513        (0x0000, "MaxPressure"),
514        (0x0001, "MaxSpeed"),
515        (0x0002, "MaxFlow"),
516        (0x0003, "MinConstPressure"),
517        (0x0004, "MaxConstPressure"),
518        (0x0005, "MinCompPressure"),
519        (0x0006, "MaxCompPressure"),
520        (0x0007, "MinConstSpeed"),
521        (0x0008, "MaxConstSpeed"),
522        (0x0009, "MinConstFlow"),
523        (0x000A, "MaxConstFlow"),
524        (0x000B, "MinConstTemp"),
525        (0x000C, "MaxConstTemp"),
526        (0x0010, "PumpStatus"),
527        (0x0011, "EffectiveOperationMode"),
528        (0x0012, "EffectiveControlMode"),
529        (0x0013, "Capacity"),
530        (0x0014, "Speed"),
531        (0x0015, "LifetimeRunningHours"),
532        (0x0016, "Power"),
533        (0x0017, "LifetimeEnergyConsumed"),
534        (0x0020, "OperationMode"),
535        (0x0021, "ControlMode"),
536        (0x0022, "AlarmMask"),
537    ]
538}
539
540// Typed facade (invokes + reads)
541
542/// Read `MaxPressure` attribute from cluster `Pump Configuration and Control`.
543pub async fn read_max_pressure(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
544    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXPRESSURE).await?;
545    decode_max_pressure(&tlv)
546}
547
548/// Read `MaxSpeed` attribute from cluster `Pump Configuration and Control`.
549pub async fn read_max_speed(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
550    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXSPEED).await?;
551    decode_max_speed(&tlv)
552}
553
554/// Read `MaxFlow` attribute from cluster `Pump Configuration and Control`.
555pub async fn read_max_flow(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
556    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXFLOW).await?;
557    decode_max_flow(&tlv)
558}
559
560/// Read `MinConstPressure` attribute from cluster `Pump Configuration and Control`.
561pub async fn read_min_const_pressure(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
562    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MINCONSTPRESSURE).await?;
563    decode_min_const_pressure(&tlv)
564}
565
566/// Read `MaxConstPressure` attribute from cluster `Pump Configuration and Control`.
567pub async fn read_max_const_pressure(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
568    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXCONSTPRESSURE).await?;
569    decode_max_const_pressure(&tlv)
570}
571
572/// Read `MinCompPressure` attribute from cluster `Pump Configuration and Control`.
573pub async fn read_min_comp_pressure(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
574    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MINCOMPPRESSURE).await?;
575    decode_min_comp_pressure(&tlv)
576}
577
578/// Read `MaxCompPressure` attribute from cluster `Pump Configuration and Control`.
579pub async fn read_max_comp_pressure(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
580    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXCOMPPRESSURE).await?;
581    decode_max_comp_pressure(&tlv)
582}
583
584/// Read `MinConstSpeed` attribute from cluster `Pump Configuration and Control`.
585pub async fn read_min_const_speed(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
586    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MINCONSTSPEED).await?;
587    decode_min_const_speed(&tlv)
588}
589
590/// Read `MaxConstSpeed` attribute from cluster `Pump Configuration and Control`.
591pub async fn read_max_const_speed(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
592    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXCONSTSPEED).await?;
593    decode_max_const_speed(&tlv)
594}
595
596/// Read `MinConstFlow` attribute from cluster `Pump Configuration and Control`.
597pub async fn read_min_const_flow(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
598    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MINCONSTFLOW).await?;
599    decode_min_const_flow(&tlv)
600}
601
602/// Read `MaxConstFlow` attribute from cluster `Pump Configuration and Control`.
603pub async fn read_max_const_flow(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
604    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXCONSTFLOW).await?;
605    decode_max_const_flow(&tlv)
606}
607
608/// Read `MinConstTemp` attribute from cluster `Pump Configuration and Control`.
609pub async fn read_min_const_temp(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
610    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MINCONSTTEMP).await?;
611    decode_min_const_temp(&tlv)
612}
613
614/// Read `MaxConstTemp` attribute from cluster `Pump Configuration and Control`.
615pub async fn read_max_const_temp(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
616    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_MAXCONSTTEMP).await?;
617    decode_max_const_temp(&tlv)
618}
619
620/// Read `PumpStatus` attribute from cluster `Pump Configuration and Control`.
621pub async fn read_pump_status(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<PumpStatus> {
622    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_PUMPSTATUS).await?;
623    decode_pump_status(&tlv)
624}
625
626/// Read `EffectiveOperationMode` attribute from cluster `Pump Configuration and Control`.
627pub async fn read_effective_operation_mode(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<OperationMode> {
628    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_EFFECTIVEOPERATIONMODE).await?;
629    decode_effective_operation_mode(&tlv)
630}
631
632/// Read `EffectiveControlMode` attribute from cluster `Pump Configuration and Control`.
633pub async fn read_effective_control_mode(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<ControlMode> {
634    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_EFFECTIVECONTROLMODE).await?;
635    decode_effective_control_mode(&tlv)
636}
637
638/// Read `Capacity` attribute from cluster `Pump Configuration and Control`.
639pub async fn read_capacity(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<i16>> {
640    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_CAPACITY).await?;
641    decode_capacity(&tlv)
642}
643
644/// Read `Speed` attribute from cluster `Pump Configuration and Control`.
645pub async fn read_speed(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u16>> {
646    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_SPEED).await?;
647    decode_speed(&tlv)
648}
649
650/// Read `LifetimeRunningHours` attribute from cluster `Pump Configuration and Control`.
651pub async fn read_lifetime_running_hours(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u8>> {
652    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_LIFETIMERUNNINGHOURS).await?;
653    decode_lifetime_running_hours(&tlv)
654}
655
656/// Read `Power` attribute from cluster `Pump Configuration and Control`.
657pub async fn read_power(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u8>> {
658    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_POWER).await?;
659    decode_power(&tlv)
660}
661
662/// Read `LifetimeEnergyConsumed` attribute from cluster `Pump Configuration and Control`.
663pub async fn read_lifetime_energy_consumed(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<Option<u32>> {
664    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_LIFETIMEENERGYCONSUMED).await?;
665    decode_lifetime_energy_consumed(&tlv)
666}
667
668/// Read `OperationMode` attribute from cluster `Pump Configuration and Control`.
669pub async fn read_operation_mode(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<OperationMode> {
670    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_OPERATIONMODE).await?;
671    decode_operation_mode(&tlv)
672}
673
674/// Read `ControlMode` attribute from cluster `Pump Configuration and Control`.
675pub async fn read_control_mode(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<ControlMode> {
676    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_CONTROLMODE).await?;
677    decode_control_mode(&tlv)
678}
679
680/// Read `AlarmMask` attribute from cluster `Pump Configuration and Control`.
681pub async fn read_alarm_mask(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<u8> {
682    let tlv = conn.read_request2(endpoint, crate::clusters::defs::CLUSTER_ID_PUMP_CONFIGURATION_AND_CONTROL, crate::clusters::defs::CLUSTER_PUMP_CONFIGURATION_AND_CONTROL_ATTR_ID_ALARMMASK).await?;
683    decode_alarm_mask(&tlv)
684}
685