1pub mod schema;
6pub mod json_util;
7pub use schema::{CommandField, FieldKind};
8
9pub mod account_login;
10pub mod acl_cluster;
11pub mod actions_cluster;
12pub mod admin_commissioning_cluster;
13pub mod air_quality;
14pub mod alarm_base;
15pub mod application_basic;
16pub mod application_launcher;
17pub mod audio_output;
18pub mod basic_information_cluster;
19pub mod binding_cluster;
20pub mod boolean_state;
21pub mod boolean_state_configuration;
22pub mod bridged_device_basic_information_cluster;
23pub mod camera_av_settings_user_level_management;
24pub mod camera_av_stream_management;
25pub mod channel;
26pub mod chime;
27pub mod closure_control;
28pub mod closure_dimension;
29pub mod color_control;
30pub mod commissioner_control_cluster;
31pub mod commodity_metering;
32pub mod commodity_price;
33pub mod commodity_tariff;
34pub mod concentration_measurement;
35pub mod content_app_observer;
36pub mod content_control;
37pub mod content_launcher;
38pub mod descriptor_cluster;
39pub mod device_energy_management;
40pub mod diagnostic_logs_cluster;
41pub mod diagnostics_ethernet;
42pub mod diagnostics_general;
43pub mod diagnostics_software;
44pub mod diagnostics_thread;
45pub mod diagnostics_wifi;
46pub mod dishwasher_alarm;
47pub mod door_lock;
48pub mod ecosystem_information_cluster;
49pub mod electrical_energy_measurement;
50pub mod electrical_grid_conditions;
51pub mod electrical_power_measurement;
52pub mod energy_evse;
53pub mod energy_preference;
54pub mod fan_control;
55pub mod fixed_label_cluster;
56pub mod flow_measurement;
57pub mod general_commissioning_cluster;
58pub mod group_key_management_cluster;
59pub mod groups;
60pub mod icd_management;
61pub mod identify;
62pub mod illuminance_measurement;
63pub mod joint_fabric_administrator_cluster;
64pub mod joint_fabric_datastore_cluster;
65pub mod keypad_input;
66pub mod label_cluster;
67pub mod laundry_dryer_controls;
68pub mod laundry_washer_controls;
69pub mod level_control;
70pub mod localization_configuration;
71pub mod localization_time_format;
72pub mod localization_unit;
73pub mod low_power;
74pub mod media_input;
75pub mod media_playback;
76pub mod messages;
77pub mod meter_identification;
78pub mod microwave_oven_control;
79pub mod mode_base;
80pub mod mode_device_energy_management;
81pub mod mode_dishwasher;
82pub mod mode_evse;
83pub mod mode_laundry_washer;
84pub mod mode_microwave_oven;
85pub mod mode_oven;
86pub mod mode_refrigerator;
87pub mod mode_rvc_clean;
88pub mod mode_rvc_run;
89pub mod mode_select;
90pub mod mode_water_heater;
91pub mod network_commissioning_cluster;
92pub mod occupancy_sensing;
93pub mod on_off;
94pub mod operational_credential_cluster;
95pub mod operational_state;
96pub mod operational_state_oven;
97pub mod operational_state_rvc;
98pub mod ota_provider;
99pub mod ota_requestor;
100pub mod power_source_cluster;
101pub mod power_source_configuration_cluster;
102pub mod power_topology;
103pub mod pressure_measurement;
104pub mod pump_configuration_control;
105pub mod push_av_stream_transport;
106pub mod refrigerator_alarm;
107pub mod resource_monitoring;
108pub mod scenes;
109pub mod service_area;
110pub mod smoke_co_alarm;
111pub mod soil_measurement;
112pub mod switch;
113pub mod target_navigator;
114pub mod temperature_control;
115pub mod temperature_measurement;
116pub mod thermostat;
117pub mod thermostat_user_interface_configuration;
118pub mod thread_border_router_management;
119pub mod thread_network_directory;
120pub mod time_sync;
121pub mod tls_certificate_management;
122pub mod tls_client_management;
123pub mod user_label_cluster;
124pub mod valve_configuration_control;
125pub mod wake_on_lan;
126pub mod water_content_measurement;
127pub mod water_heater_management;
128pub mod web_rtc_provider;
129pub mod web_rtc_requestor;
130pub mod wifi_network_management;
131pub mod window_covering;
132pub mod zone_management;
133
134
135pub fn decode_attribute_json(cluster_id: u32, attribute_id: u32, tlv_value: &crate::tlv::TlvItemValue) -> String {
147 match cluster_id {
148 0x0000 => alarm_base::decode_attribute_json(cluster_id, attribute_id, tlv_value),
149 0x0003 => identify::decode_attribute_json(cluster_id, attribute_id, tlv_value),
150 0x0004 => groups::decode_attribute_json(cluster_id, attribute_id, tlv_value),
151 0x0006 => on_off::decode_attribute_json(cluster_id, attribute_id, tlv_value),
152 0x0008 => level_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
153 0x001D => descriptor_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
154 0x001E => binding_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
155 0x001F => acl_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
156 0x0025 => actions_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
157 0x0028 => basic_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
158 0x002A => ota_requestor::decode_attribute_json(cluster_id, attribute_id, tlv_value),
159 0x002B => localization_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
160 0x002C => localization_time_format::decode_attribute_json(cluster_id, attribute_id, tlv_value),
161 0x002D => localization_unit::decode_attribute_json(cluster_id, attribute_id, tlv_value),
162 0x002E => power_source_configuration_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
163 0x002F => power_source_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
164 0x0030 => general_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
165 0x0031 => network_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
166 0x0033 => diagnostics_general::decode_attribute_json(cluster_id, attribute_id, tlv_value),
167 0x0034 => diagnostics_software::decode_attribute_json(cluster_id, attribute_id, tlv_value),
168 0x0035 => diagnostics_thread::decode_attribute_json(cluster_id, attribute_id, tlv_value),
169 0x0036 => diagnostics_wifi::decode_attribute_json(cluster_id, attribute_id, tlv_value),
170 0x0037 => diagnostics_ethernet::decode_attribute_json(cluster_id, attribute_id, tlv_value),
171 0x0038 => time_sync::decode_attribute_json(cluster_id, attribute_id, tlv_value),
172 0x0039 => bridged_device_basic_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
173 0x003B => switch::decode_attribute_json(cluster_id, attribute_id, tlv_value),
174 0x003C => admin_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
175 0x003E => operational_credential_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
176 0x003F => group_key_management_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
177 0x0040 => fixed_label_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
178 0x0041 => user_label_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
179 0x0045 => boolean_state::decode_attribute_json(cluster_id, attribute_id, tlv_value),
180 0x0046 => icd_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
181 0x0049 => mode_oven::decode_attribute_json(cluster_id, attribute_id, tlv_value),
182 0x004A => laundry_dryer_controls::decode_attribute_json(cluster_id, attribute_id, tlv_value),
183 0x0050 => mode_select::decode_attribute_json(cluster_id, attribute_id, tlv_value),
184 0x0051 => mode_laundry_washer::decode_attribute_json(cluster_id, attribute_id, tlv_value),
185 0x0052 => mode_refrigerator::decode_attribute_json(cluster_id, attribute_id, tlv_value),
186 0x0053 => laundry_washer_controls::decode_attribute_json(cluster_id, attribute_id, tlv_value),
187 0x0054 => mode_rvc_run::decode_attribute_json(cluster_id, attribute_id, tlv_value),
188 0x0055 => mode_rvc_clean::decode_attribute_json(cluster_id, attribute_id, tlv_value),
189 0x0056 => temperature_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
190 0x0059 => mode_dishwasher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
191 0x005B => air_quality::decode_attribute_json(cluster_id, attribute_id, tlv_value),
192 0x005C => smoke_co_alarm::decode_attribute_json(cluster_id, attribute_id, tlv_value),
193 0x005E => mode_microwave_oven::decode_attribute_json(cluster_id, attribute_id, tlv_value),
194 0x005F => microwave_oven_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
195 0x0060 => operational_state::decode_attribute_json(cluster_id, attribute_id, tlv_value),
196 0x0062 => scenes::decode_attribute_json(cluster_id, attribute_id, tlv_value),
197 0x0080 => boolean_state_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
198 0x0081 => valve_configuration_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
199 0x0090 => electrical_power_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
200 0x0091 => electrical_energy_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
201 0x0094 => water_heater_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
202 0x0095 => commodity_price::decode_attribute_json(cluster_id, attribute_id, tlv_value),
203 0x0097 => messages::decode_attribute_json(cluster_id, attribute_id, tlv_value),
204 0x0098 => device_energy_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
205 0x0099 => energy_evse::decode_attribute_json(cluster_id, attribute_id, tlv_value),
206 0x009B => energy_preference::decode_attribute_json(cluster_id, attribute_id, tlv_value),
207 0x009C => power_topology::decode_attribute_json(cluster_id, attribute_id, tlv_value),
208 0x009D => mode_evse::decode_attribute_json(cluster_id, attribute_id, tlv_value),
209 0x009E => mode_water_heater::decode_attribute_json(cluster_id, attribute_id, tlv_value),
210 0x009F => mode_device_energy_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
211 0x00A0 => electrical_grid_conditions::decode_attribute_json(cluster_id, attribute_id, tlv_value),
212 0x0101 => door_lock::decode_attribute_json(cluster_id, attribute_id, tlv_value),
213 0x0102 => window_covering::decode_attribute_json(cluster_id, attribute_id, tlv_value),
214 0x0104 => closure_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
215 0x0105 => closure_dimension::decode_attribute_json(cluster_id, attribute_id, tlv_value),
216 0x0150 => service_area::decode_attribute_json(cluster_id, attribute_id, tlv_value),
217 0x0200 => pump_configuration_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
218 0x0201 => thermostat::decode_attribute_json(cluster_id, attribute_id, tlv_value),
219 0x0202 => fan_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
220 0x0204 => thermostat_user_interface_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
221 0x0300 => color_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
222 0x0400 => illuminance_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
223 0x0402 => temperature_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
224 0x0403 => pressure_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
225 0x0404 => flow_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
226 0x0406 => occupancy_sensing::decode_attribute_json(cluster_id, attribute_id, tlv_value),
227 0x0430 => soil_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
228 0x0451 => wifi_network_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
229 0x0452 => thread_border_router_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
230 0x0453 => thread_network_directory::decode_attribute_json(cluster_id, attribute_id, tlv_value),
231 0x0503 => wake_on_lan::decode_attribute_json(cluster_id, attribute_id, tlv_value),
232 0x0504 => channel::decode_attribute_json(cluster_id, attribute_id, tlv_value),
233 0x0505 => target_navigator::decode_attribute_json(cluster_id, attribute_id, tlv_value),
234 0x0506 => media_playback::decode_attribute_json(cluster_id, attribute_id, tlv_value),
235 0x0507 => media_input::decode_attribute_json(cluster_id, attribute_id, tlv_value),
236 0x050A => content_launcher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
237 0x050B => audio_output::decode_attribute_json(cluster_id, attribute_id, tlv_value),
238 0x050C => application_launcher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
239 0x050D => application_basic::decode_attribute_json(cluster_id, attribute_id, tlv_value),
240 0x050F => content_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
241 0x0550 => zone_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
242 0x0551 => camera_av_stream_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
243 0x0552 => camera_av_settings_user_level_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
244 0x0553 => web_rtc_provider::decode_attribute_json(cluster_id, attribute_id, tlv_value),
245 0x0554 => web_rtc_requestor::decode_attribute_json(cluster_id, attribute_id, tlv_value),
246 0x0555 => push_av_stream_transport::decode_attribute_json(cluster_id, attribute_id, tlv_value),
247 0x0556 => chime::decode_attribute_json(cluster_id, attribute_id, tlv_value),
248 0x0700 => commodity_tariff::decode_attribute_json(cluster_id, attribute_id, tlv_value),
249 0x0750 => ecosystem_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
250 0x0751 => commissioner_control_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
251 0x0752 => joint_fabric_datastore_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
252 0x0753 => joint_fabric_administrator_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
253 0x0801 => tls_certificate_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
254 0x0802 => tls_client_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
255 0x0B06 => meter_identification::decode_attribute_json(cluster_id, attribute_id, tlv_value),
256 0x0B07 => commodity_metering::decode_attribute_json(cluster_id, attribute_id, tlv_value),
257 _ => format!("{{\"error\": \"Unsupported cluster ID: {}\"}}", cluster_id),
258 }
259}
260
261
262pub fn get_attribute_list(cluster_id: u32) -> Vec<(u32, &'static str)> {
272 match cluster_id {
273 0x0000 => alarm_base::get_attribute_list(),
274 0x0003 => identify::get_attribute_list(),
275 0x0004 => groups::get_attribute_list(),
276 0x0006 => on_off::get_attribute_list(),
277 0x0008 => level_control::get_attribute_list(),
278 0x001D => descriptor_cluster::get_attribute_list(),
279 0x001E => binding_cluster::get_attribute_list(),
280 0x001F => acl_cluster::get_attribute_list(),
281 0x0025 => actions_cluster::get_attribute_list(),
282 0x0028 => basic_information_cluster::get_attribute_list(),
283 0x002A => ota_requestor::get_attribute_list(),
284 0x002B => localization_configuration::get_attribute_list(),
285 0x002C => localization_time_format::get_attribute_list(),
286 0x002D => localization_unit::get_attribute_list(),
287 0x002E => power_source_configuration_cluster::get_attribute_list(),
288 0x002F => power_source_cluster::get_attribute_list(),
289 0x0030 => general_commissioning_cluster::get_attribute_list(),
290 0x0031 => network_commissioning_cluster::get_attribute_list(),
291 0x0033 => diagnostics_general::get_attribute_list(),
292 0x0034 => diagnostics_software::get_attribute_list(),
293 0x0035 => diagnostics_thread::get_attribute_list(),
294 0x0036 => diagnostics_wifi::get_attribute_list(),
295 0x0037 => diagnostics_ethernet::get_attribute_list(),
296 0x0038 => time_sync::get_attribute_list(),
297 0x0039 => bridged_device_basic_information_cluster::get_attribute_list(),
298 0x003B => switch::get_attribute_list(),
299 0x003C => admin_commissioning_cluster::get_attribute_list(),
300 0x003E => operational_credential_cluster::get_attribute_list(),
301 0x003F => group_key_management_cluster::get_attribute_list(),
302 0x0040 => fixed_label_cluster::get_attribute_list(),
303 0x0041 => user_label_cluster::get_attribute_list(),
304 0x0045 => boolean_state::get_attribute_list(),
305 0x0046 => icd_management::get_attribute_list(),
306 0x0049 => mode_oven::get_attribute_list(),
307 0x004A => laundry_dryer_controls::get_attribute_list(),
308 0x0050 => mode_select::get_attribute_list(),
309 0x0051 => mode_laundry_washer::get_attribute_list(),
310 0x0052 => mode_refrigerator::get_attribute_list(),
311 0x0053 => laundry_washer_controls::get_attribute_list(),
312 0x0054 => mode_rvc_run::get_attribute_list(),
313 0x0055 => mode_rvc_clean::get_attribute_list(),
314 0x0056 => temperature_control::get_attribute_list(),
315 0x0059 => mode_dishwasher::get_attribute_list(),
316 0x005B => air_quality::get_attribute_list(),
317 0x005C => smoke_co_alarm::get_attribute_list(),
318 0x005E => mode_microwave_oven::get_attribute_list(),
319 0x005F => microwave_oven_control::get_attribute_list(),
320 0x0060 => operational_state::get_attribute_list(),
321 0x0062 => scenes::get_attribute_list(),
322 0x0080 => boolean_state_configuration::get_attribute_list(),
323 0x0081 => valve_configuration_control::get_attribute_list(),
324 0x0090 => electrical_power_measurement::get_attribute_list(),
325 0x0091 => electrical_energy_measurement::get_attribute_list(),
326 0x0094 => water_heater_management::get_attribute_list(),
327 0x0095 => commodity_price::get_attribute_list(),
328 0x0097 => messages::get_attribute_list(),
329 0x0098 => device_energy_management::get_attribute_list(),
330 0x0099 => energy_evse::get_attribute_list(),
331 0x009B => energy_preference::get_attribute_list(),
332 0x009C => power_topology::get_attribute_list(),
333 0x009D => mode_evse::get_attribute_list(),
334 0x009E => mode_water_heater::get_attribute_list(),
335 0x009F => mode_device_energy_management::get_attribute_list(),
336 0x00A0 => electrical_grid_conditions::get_attribute_list(),
337 0x0101 => door_lock::get_attribute_list(),
338 0x0102 => window_covering::get_attribute_list(),
339 0x0104 => closure_control::get_attribute_list(),
340 0x0105 => closure_dimension::get_attribute_list(),
341 0x0150 => service_area::get_attribute_list(),
342 0x0200 => pump_configuration_control::get_attribute_list(),
343 0x0201 => thermostat::get_attribute_list(),
344 0x0202 => fan_control::get_attribute_list(),
345 0x0204 => thermostat_user_interface_configuration::get_attribute_list(),
346 0x0300 => color_control::get_attribute_list(),
347 0x0400 => illuminance_measurement::get_attribute_list(),
348 0x0402 => temperature_measurement::get_attribute_list(),
349 0x0403 => pressure_measurement::get_attribute_list(),
350 0x0404 => flow_measurement::get_attribute_list(),
351 0x0406 => occupancy_sensing::get_attribute_list(),
352 0x0430 => soil_measurement::get_attribute_list(),
353 0x0451 => wifi_network_management::get_attribute_list(),
354 0x0452 => thread_border_router_management::get_attribute_list(),
355 0x0453 => thread_network_directory::get_attribute_list(),
356 0x0503 => wake_on_lan::get_attribute_list(),
357 0x0504 => channel::get_attribute_list(),
358 0x0505 => target_navigator::get_attribute_list(),
359 0x0506 => media_playback::get_attribute_list(),
360 0x0507 => media_input::get_attribute_list(),
361 0x050A => content_launcher::get_attribute_list(),
362 0x050B => audio_output::get_attribute_list(),
363 0x050C => application_launcher::get_attribute_list(),
364 0x050D => application_basic::get_attribute_list(),
365 0x050F => content_control::get_attribute_list(),
366 0x0550 => zone_management::get_attribute_list(),
367 0x0551 => camera_av_stream_management::get_attribute_list(),
368 0x0552 => camera_av_settings_user_level_management::get_attribute_list(),
369 0x0553 => web_rtc_provider::get_attribute_list(),
370 0x0554 => web_rtc_requestor::get_attribute_list(),
371 0x0555 => push_av_stream_transport::get_attribute_list(),
372 0x0556 => chime::get_attribute_list(),
373 0x0700 => commodity_tariff::get_attribute_list(),
374 0x0750 => ecosystem_information_cluster::get_attribute_list(),
375 0x0751 => commissioner_control_cluster::get_attribute_list(),
376 0x0752 => joint_fabric_datastore_cluster::get_attribute_list(),
377 0x0753 => joint_fabric_administrator_cluster::get_attribute_list(),
378 0x0801 => tls_certificate_management::get_attribute_list(),
379 0x0802 => tls_client_management::get_attribute_list(),
380 0x0B06 => meter_identification::get_attribute_list(),
381 0x0B07 => commodity_metering::get_attribute_list(),
382 _ => vec![],
383 }
384}
385
386
387pub fn get_command_list(cluster_id: u32) -> Vec<(u32, &'static str)> {
388 match cluster_id {
389 0x0000 => alarm_base::get_command_list(),
390 0x0003 => identify::get_command_list(),
391 0x0004 => groups::get_command_list(),
392 0x0006 => on_off::get_command_list(),
393 0x0008 => level_control::get_command_list(),
394 0x001F => acl_cluster::get_command_list(),
395 0x0025 => actions_cluster::get_command_list(),
396 0x0029 => ota_provider::get_command_list(),
397 0x002A => ota_requestor::get_command_list(),
398 0x0030 => general_commissioning_cluster::get_command_list(),
399 0x0031 => network_commissioning_cluster::get_command_list(),
400 0x0032 => diagnostic_logs_cluster::get_command_list(),
401 0x0033 => diagnostics_general::get_command_list(),
402 0x0034 => diagnostics_software::get_command_list(),
403 0x0035 => diagnostics_thread::get_command_list(),
404 0x0036 => diagnostics_wifi::get_command_list(),
405 0x0037 => diagnostics_ethernet::get_command_list(),
406 0x0038 => time_sync::get_command_list(),
407 0x0039 => bridged_device_basic_information_cluster::get_command_list(),
408 0x003C => admin_commissioning_cluster::get_command_list(),
409 0x003E => operational_credential_cluster::get_command_list(),
410 0x003F => group_key_management_cluster::get_command_list(),
411 0x0046 => icd_management::get_command_list(),
412 0x0048 => operational_state_oven::get_command_list(),
413 0x0050 => mode_select::get_command_list(),
414 0x0056 => temperature_control::get_command_list(),
415 0x0057 => refrigerator_alarm::get_command_list(),
416 0x005C => smoke_co_alarm::get_command_list(),
417 0x005E => mode_microwave_oven::get_command_list(),
418 0x005F => microwave_oven_control::get_command_list(),
419 0x0060 => operational_state::get_command_list(),
420 0x0061 => operational_state_rvc::get_command_list(),
421 0x0062 => scenes::get_command_list(),
422 0x0080 => boolean_state_configuration::get_command_list(),
423 0x0081 => valve_configuration_control::get_command_list(),
424 0x0094 => water_heater_management::get_command_list(),
425 0x0095 => commodity_price::get_command_list(),
426 0x0097 => messages::get_command_list(),
427 0x0098 => device_energy_management::get_command_list(),
428 0x0099 => energy_evse::get_command_list(),
429 0x0101 => door_lock::get_command_list(),
430 0x0102 => window_covering::get_command_list(),
431 0x0104 => closure_control::get_command_list(),
432 0x0105 => closure_dimension::get_command_list(),
433 0x0150 => service_area::get_command_list(),
434 0x0201 => thermostat::get_command_list(),
435 0x0202 => fan_control::get_command_list(),
436 0x0300 => color_control::get_command_list(),
437 0x0451 => wifi_network_management::get_command_list(),
438 0x0452 => thread_border_router_management::get_command_list(),
439 0x0453 => thread_network_directory::get_command_list(),
440 0x0504 => channel::get_command_list(),
441 0x0505 => target_navigator::get_command_list(),
442 0x0506 => media_playback::get_command_list(),
443 0x0507 => media_input::get_command_list(),
444 0x0508 => low_power::get_command_list(),
445 0x0509 => keypad_input::get_command_list(),
446 0x050A => content_launcher::get_command_list(),
447 0x050B => audio_output::get_command_list(),
448 0x050C => application_launcher::get_command_list(),
449 0x050E => account_login::get_command_list(),
450 0x050F => content_control::get_command_list(),
451 0x0510 => content_app_observer::get_command_list(),
452 0x0550 => zone_management::get_command_list(),
453 0x0551 => camera_av_stream_management::get_command_list(),
454 0x0552 => camera_av_settings_user_level_management::get_command_list(),
455 0x0553 => web_rtc_provider::get_command_list(),
456 0x0554 => web_rtc_requestor::get_command_list(),
457 0x0555 => push_av_stream_transport::get_command_list(),
458 0x0556 => chime::get_command_list(),
459 0x0700 => commodity_tariff::get_command_list(),
460 0x0751 => commissioner_control_cluster::get_command_list(),
461 0x0752 => joint_fabric_datastore_cluster::get_command_list(),
462 0x0753 => joint_fabric_administrator_cluster::get_command_list(),
463 0x0801 => tls_certificate_management::get_command_list(),
464 0x0802 => tls_client_management::get_command_list(),
465 _ => vec![],
466 }
467}
468
469pub fn get_command_name(cluster_id: u32, cmd_id: u32) -> Option<&'static str> {
470 match cluster_id {
471 0x0000 => alarm_base::get_command_name(cmd_id),
472 0x0003 => identify::get_command_name(cmd_id),
473 0x0004 => groups::get_command_name(cmd_id),
474 0x0006 => on_off::get_command_name(cmd_id),
475 0x0008 => level_control::get_command_name(cmd_id),
476 0x001F => acl_cluster::get_command_name(cmd_id),
477 0x0025 => actions_cluster::get_command_name(cmd_id),
478 0x0029 => ota_provider::get_command_name(cmd_id),
479 0x002A => ota_requestor::get_command_name(cmd_id),
480 0x0030 => general_commissioning_cluster::get_command_name(cmd_id),
481 0x0031 => network_commissioning_cluster::get_command_name(cmd_id),
482 0x0032 => diagnostic_logs_cluster::get_command_name(cmd_id),
483 0x0033 => diagnostics_general::get_command_name(cmd_id),
484 0x0034 => diagnostics_software::get_command_name(cmd_id),
485 0x0035 => diagnostics_thread::get_command_name(cmd_id),
486 0x0036 => diagnostics_wifi::get_command_name(cmd_id),
487 0x0037 => diagnostics_ethernet::get_command_name(cmd_id),
488 0x0038 => time_sync::get_command_name(cmd_id),
489 0x0039 => bridged_device_basic_information_cluster::get_command_name(cmd_id),
490 0x003C => admin_commissioning_cluster::get_command_name(cmd_id),
491 0x003E => operational_credential_cluster::get_command_name(cmd_id),
492 0x003F => group_key_management_cluster::get_command_name(cmd_id),
493 0x0046 => icd_management::get_command_name(cmd_id),
494 0x0048 => operational_state_oven::get_command_name(cmd_id),
495 0x0050 => mode_select::get_command_name(cmd_id),
496 0x0056 => temperature_control::get_command_name(cmd_id),
497 0x0057 => refrigerator_alarm::get_command_name(cmd_id),
498 0x005C => smoke_co_alarm::get_command_name(cmd_id),
499 0x005E => mode_microwave_oven::get_command_name(cmd_id),
500 0x005F => microwave_oven_control::get_command_name(cmd_id),
501 0x0060 => operational_state::get_command_name(cmd_id),
502 0x0061 => operational_state_rvc::get_command_name(cmd_id),
503 0x0062 => scenes::get_command_name(cmd_id),
504 0x0080 => boolean_state_configuration::get_command_name(cmd_id),
505 0x0081 => valve_configuration_control::get_command_name(cmd_id),
506 0x0094 => water_heater_management::get_command_name(cmd_id),
507 0x0095 => commodity_price::get_command_name(cmd_id),
508 0x0097 => messages::get_command_name(cmd_id),
509 0x0098 => device_energy_management::get_command_name(cmd_id),
510 0x0099 => energy_evse::get_command_name(cmd_id),
511 0x0101 => door_lock::get_command_name(cmd_id),
512 0x0102 => window_covering::get_command_name(cmd_id),
513 0x0104 => closure_control::get_command_name(cmd_id),
514 0x0105 => closure_dimension::get_command_name(cmd_id),
515 0x0150 => service_area::get_command_name(cmd_id),
516 0x0201 => thermostat::get_command_name(cmd_id),
517 0x0202 => fan_control::get_command_name(cmd_id),
518 0x0300 => color_control::get_command_name(cmd_id),
519 0x0451 => wifi_network_management::get_command_name(cmd_id),
520 0x0452 => thread_border_router_management::get_command_name(cmd_id),
521 0x0453 => thread_network_directory::get_command_name(cmd_id),
522 0x0504 => channel::get_command_name(cmd_id),
523 0x0505 => target_navigator::get_command_name(cmd_id),
524 0x0506 => media_playback::get_command_name(cmd_id),
525 0x0507 => media_input::get_command_name(cmd_id),
526 0x0508 => low_power::get_command_name(cmd_id),
527 0x0509 => keypad_input::get_command_name(cmd_id),
528 0x050A => content_launcher::get_command_name(cmd_id),
529 0x050B => audio_output::get_command_name(cmd_id),
530 0x050C => application_launcher::get_command_name(cmd_id),
531 0x050E => account_login::get_command_name(cmd_id),
532 0x050F => content_control::get_command_name(cmd_id),
533 0x0510 => content_app_observer::get_command_name(cmd_id),
534 0x0550 => zone_management::get_command_name(cmd_id),
535 0x0551 => camera_av_stream_management::get_command_name(cmd_id),
536 0x0552 => camera_av_settings_user_level_management::get_command_name(cmd_id),
537 0x0553 => web_rtc_provider::get_command_name(cmd_id),
538 0x0554 => web_rtc_requestor::get_command_name(cmd_id),
539 0x0555 => push_av_stream_transport::get_command_name(cmd_id),
540 0x0556 => chime::get_command_name(cmd_id),
541 0x0700 => commodity_tariff::get_command_name(cmd_id),
542 0x0751 => commissioner_control_cluster::get_command_name(cmd_id),
543 0x0752 => joint_fabric_datastore_cluster::get_command_name(cmd_id),
544 0x0753 => joint_fabric_administrator_cluster::get_command_name(cmd_id),
545 0x0801 => tls_certificate_management::get_command_name(cmd_id),
546 0x0802 => tls_client_management::get_command_name(cmd_id),
547 _ => None,
548 }
549}
550
551pub fn get_command_schema(cluster_id: u32, cmd_id: u32) -> Option<Vec<CommandField>> {
552 match cluster_id {
553 0x0000 => alarm_base::get_command_schema(cmd_id),
554 0x0003 => identify::get_command_schema(cmd_id),
555 0x0004 => groups::get_command_schema(cmd_id),
556 0x0006 => on_off::get_command_schema(cmd_id),
557 0x0008 => level_control::get_command_schema(cmd_id),
558 0x001F => acl_cluster::get_command_schema(cmd_id),
559 0x0025 => actions_cluster::get_command_schema(cmd_id),
560 0x0029 => ota_provider::get_command_schema(cmd_id),
561 0x002A => ota_requestor::get_command_schema(cmd_id),
562 0x0030 => general_commissioning_cluster::get_command_schema(cmd_id),
563 0x0031 => network_commissioning_cluster::get_command_schema(cmd_id),
564 0x0032 => diagnostic_logs_cluster::get_command_schema(cmd_id),
565 0x0033 => diagnostics_general::get_command_schema(cmd_id),
566 0x0034 => diagnostics_software::get_command_schema(cmd_id),
567 0x0035 => diagnostics_thread::get_command_schema(cmd_id),
568 0x0036 => diagnostics_wifi::get_command_schema(cmd_id),
569 0x0037 => diagnostics_ethernet::get_command_schema(cmd_id),
570 0x0038 => time_sync::get_command_schema(cmd_id),
571 0x0039 => bridged_device_basic_information_cluster::get_command_schema(cmd_id),
572 0x003C => admin_commissioning_cluster::get_command_schema(cmd_id),
573 0x003E => operational_credential_cluster::get_command_schema(cmd_id),
574 0x003F => group_key_management_cluster::get_command_schema(cmd_id),
575 0x0046 => icd_management::get_command_schema(cmd_id),
576 0x0048 => operational_state_oven::get_command_schema(cmd_id),
577 0x0050 => mode_select::get_command_schema(cmd_id),
578 0x0056 => temperature_control::get_command_schema(cmd_id),
579 0x0057 => refrigerator_alarm::get_command_schema(cmd_id),
580 0x005C => smoke_co_alarm::get_command_schema(cmd_id),
581 0x005E => mode_microwave_oven::get_command_schema(cmd_id),
582 0x005F => microwave_oven_control::get_command_schema(cmd_id),
583 0x0060 => operational_state::get_command_schema(cmd_id),
584 0x0061 => operational_state_rvc::get_command_schema(cmd_id),
585 0x0062 => scenes::get_command_schema(cmd_id),
586 0x0080 => boolean_state_configuration::get_command_schema(cmd_id),
587 0x0081 => valve_configuration_control::get_command_schema(cmd_id),
588 0x0094 => water_heater_management::get_command_schema(cmd_id),
589 0x0095 => commodity_price::get_command_schema(cmd_id),
590 0x0097 => messages::get_command_schema(cmd_id),
591 0x0098 => device_energy_management::get_command_schema(cmd_id),
592 0x0099 => energy_evse::get_command_schema(cmd_id),
593 0x0101 => door_lock::get_command_schema(cmd_id),
594 0x0102 => window_covering::get_command_schema(cmd_id),
595 0x0104 => closure_control::get_command_schema(cmd_id),
596 0x0105 => closure_dimension::get_command_schema(cmd_id),
597 0x0150 => service_area::get_command_schema(cmd_id),
598 0x0201 => thermostat::get_command_schema(cmd_id),
599 0x0202 => fan_control::get_command_schema(cmd_id),
600 0x0300 => color_control::get_command_schema(cmd_id),
601 0x0451 => wifi_network_management::get_command_schema(cmd_id),
602 0x0452 => thread_border_router_management::get_command_schema(cmd_id),
603 0x0453 => thread_network_directory::get_command_schema(cmd_id),
604 0x0504 => channel::get_command_schema(cmd_id),
605 0x0505 => target_navigator::get_command_schema(cmd_id),
606 0x0506 => media_playback::get_command_schema(cmd_id),
607 0x0507 => media_input::get_command_schema(cmd_id),
608 0x0508 => low_power::get_command_schema(cmd_id),
609 0x0509 => keypad_input::get_command_schema(cmd_id),
610 0x050A => content_launcher::get_command_schema(cmd_id),
611 0x050B => audio_output::get_command_schema(cmd_id),
612 0x050C => application_launcher::get_command_schema(cmd_id),
613 0x050E => account_login::get_command_schema(cmd_id),
614 0x050F => content_control::get_command_schema(cmd_id),
615 0x0510 => content_app_observer::get_command_schema(cmd_id),
616 0x0550 => zone_management::get_command_schema(cmd_id),
617 0x0551 => camera_av_stream_management::get_command_schema(cmd_id),
618 0x0552 => camera_av_settings_user_level_management::get_command_schema(cmd_id),
619 0x0553 => web_rtc_provider::get_command_schema(cmd_id),
620 0x0554 => web_rtc_requestor::get_command_schema(cmd_id),
621 0x0555 => push_av_stream_transport::get_command_schema(cmd_id),
622 0x0556 => chime::get_command_schema(cmd_id),
623 0x0700 => commodity_tariff::get_command_schema(cmd_id),
624 0x0751 => commissioner_control_cluster::get_command_schema(cmd_id),
625 0x0752 => joint_fabric_datastore_cluster::get_command_schema(cmd_id),
626 0x0753 => joint_fabric_administrator_cluster::get_command_schema(cmd_id),
627 0x0801 => tls_certificate_management::get_command_schema(cmd_id),
628 0x0802 => tls_client_management::get_command_schema(cmd_id),
629 _ => None,
630 }
631}
632
633pub fn encode_command_json(cluster_id: u32, cmd_id: u32, args: &serde_json::Value) -> anyhow::Result<Vec<u8>> {
634 match cluster_id {
635 0x0000 => alarm_base::encode_command_json(cmd_id, args),
636 0x0003 => identify::encode_command_json(cmd_id, args),
637 0x0004 => groups::encode_command_json(cmd_id, args),
638 0x0006 => on_off::encode_command_json(cmd_id, args),
639 0x0008 => level_control::encode_command_json(cmd_id, args),
640 0x001F => acl_cluster::encode_command_json(cmd_id, args),
641 0x0025 => actions_cluster::encode_command_json(cmd_id, args),
642 0x0029 => ota_provider::encode_command_json(cmd_id, args),
643 0x002A => ota_requestor::encode_command_json(cmd_id, args),
644 0x0030 => general_commissioning_cluster::encode_command_json(cmd_id, args),
645 0x0031 => network_commissioning_cluster::encode_command_json(cmd_id, args),
646 0x0032 => diagnostic_logs_cluster::encode_command_json(cmd_id, args),
647 0x0033 => diagnostics_general::encode_command_json(cmd_id, args),
648 0x0034 => diagnostics_software::encode_command_json(cmd_id, args),
649 0x0035 => diagnostics_thread::encode_command_json(cmd_id, args),
650 0x0036 => diagnostics_wifi::encode_command_json(cmd_id, args),
651 0x0037 => diagnostics_ethernet::encode_command_json(cmd_id, args),
652 0x0038 => time_sync::encode_command_json(cmd_id, args),
653 0x0039 => bridged_device_basic_information_cluster::encode_command_json(cmd_id, args),
654 0x003C => admin_commissioning_cluster::encode_command_json(cmd_id, args),
655 0x003E => operational_credential_cluster::encode_command_json(cmd_id, args),
656 0x003F => group_key_management_cluster::encode_command_json(cmd_id, args),
657 0x0046 => icd_management::encode_command_json(cmd_id, args),
658 0x0048 => operational_state_oven::encode_command_json(cmd_id, args),
659 0x0050 => mode_select::encode_command_json(cmd_id, args),
660 0x0056 => temperature_control::encode_command_json(cmd_id, args),
661 0x0057 => refrigerator_alarm::encode_command_json(cmd_id, args),
662 0x005C => smoke_co_alarm::encode_command_json(cmd_id, args),
663 0x005E => mode_microwave_oven::encode_command_json(cmd_id, args),
664 0x005F => microwave_oven_control::encode_command_json(cmd_id, args),
665 0x0060 => operational_state::encode_command_json(cmd_id, args),
666 0x0061 => operational_state_rvc::encode_command_json(cmd_id, args),
667 0x0062 => scenes::encode_command_json(cmd_id, args),
668 0x0080 => boolean_state_configuration::encode_command_json(cmd_id, args),
669 0x0081 => valve_configuration_control::encode_command_json(cmd_id, args),
670 0x0094 => water_heater_management::encode_command_json(cmd_id, args),
671 0x0095 => commodity_price::encode_command_json(cmd_id, args),
672 0x0097 => messages::encode_command_json(cmd_id, args),
673 0x0098 => device_energy_management::encode_command_json(cmd_id, args),
674 0x0099 => energy_evse::encode_command_json(cmd_id, args),
675 0x0101 => door_lock::encode_command_json(cmd_id, args),
676 0x0102 => window_covering::encode_command_json(cmd_id, args),
677 0x0104 => closure_control::encode_command_json(cmd_id, args),
678 0x0105 => closure_dimension::encode_command_json(cmd_id, args),
679 0x0150 => service_area::encode_command_json(cmd_id, args),
680 0x0201 => thermostat::encode_command_json(cmd_id, args),
681 0x0202 => fan_control::encode_command_json(cmd_id, args),
682 0x0300 => color_control::encode_command_json(cmd_id, args),
683 0x0451 => wifi_network_management::encode_command_json(cmd_id, args),
684 0x0452 => thread_border_router_management::encode_command_json(cmd_id, args),
685 0x0453 => thread_network_directory::encode_command_json(cmd_id, args),
686 0x0504 => channel::encode_command_json(cmd_id, args),
687 0x0505 => target_navigator::encode_command_json(cmd_id, args),
688 0x0506 => media_playback::encode_command_json(cmd_id, args),
689 0x0507 => media_input::encode_command_json(cmd_id, args),
690 0x0508 => low_power::encode_command_json(cmd_id, args),
691 0x0509 => keypad_input::encode_command_json(cmd_id, args),
692 0x050A => content_launcher::encode_command_json(cmd_id, args),
693 0x050B => audio_output::encode_command_json(cmd_id, args),
694 0x050C => application_launcher::encode_command_json(cmd_id, args),
695 0x050E => account_login::encode_command_json(cmd_id, args),
696 0x050F => content_control::encode_command_json(cmd_id, args),
697 0x0510 => content_app_observer::encode_command_json(cmd_id, args),
698 0x0550 => zone_management::encode_command_json(cmd_id, args),
699 0x0551 => camera_av_stream_management::encode_command_json(cmd_id, args),
700 0x0552 => camera_av_settings_user_level_management::encode_command_json(cmd_id, args),
701 0x0553 => web_rtc_provider::encode_command_json(cmd_id, args),
702 0x0554 => web_rtc_requestor::encode_command_json(cmd_id, args),
703 0x0555 => push_av_stream_transport::encode_command_json(cmd_id, args),
704 0x0556 => chime::encode_command_json(cmd_id, args),
705 0x0700 => commodity_tariff::encode_command_json(cmd_id, args),
706 0x0751 => commissioner_control_cluster::encode_command_json(cmd_id, args),
707 0x0752 => joint_fabric_datastore_cluster::encode_command_json(cmd_id, args),
708 0x0753 => joint_fabric_administrator_cluster::encode_command_json(cmd_id, args),
709 0x0801 => tls_certificate_management::encode_command_json(cmd_id, args),
710 0x0802 => tls_client_management::encode_command_json(cmd_id, args),
711 _ => Err(anyhow::anyhow!("unsupported cluster: 0x{:04X}", cluster_id)),
712 }
713}