matc/clusters/codec/
refrigerator_alarm.rs1#![allow(clippy::too_many_arguments)]
7
8use anyhow;
9use serde_json;
10
11
12pub type Alarm = u8;
16
17pub mod alarm {
19 pub const DOOR_OPEN: u8 = 0x01;
21}
22
23pub fn get_command_list() -> Vec<(u32, &'static str)> {
28 vec![
29 (0x01, "ModifyEnabledAlarms"),
30 ]
31}
32
33pub fn get_command_name(cmd_id: u32) -> Option<&'static str> {
34 match cmd_id {
35 0x01 => Some("ModifyEnabledAlarms"),
36 _ => None,
37 }
38}
39
40pub fn get_command_schema(cmd_id: u32) -> Option<Vec<crate::clusters::codec::CommandField>> {
41 match cmd_id {
42 0x01 => Some(vec![]),
43 _ => None,
44 }
45}
46
47pub fn encode_command_json(cmd_id: u32, _args: &serde_json::Value) -> anyhow::Result<Vec<u8>> {
48 match cmd_id {
49 0x01 => Ok(vec![]),
50 _ => Err(anyhow::anyhow!("unknown command ID: 0x{:02X}", cmd_id)),
51 }
52}
53
54pub async fn modify_enabled_alarms(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
58 conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_REFRIGERATOR_ALARM, crate::clusters::defs::CLUSTER_REFRIGERATOR_ALARM_CMD_ID_MODIFYENABLEDALARMS, &[]).await?;
59 Ok(())
60}
61