matc 0.1.3

Matter protocol library (controller side)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
//! Matter cluster TLV encoders and decoders
//! 
//! This file is automatically generated.

pub mod schema;
pub mod json_util;
pub use schema::{CommandField, FieldKind};

pub mod account_login;
pub mod acl_cluster;
pub mod actions_cluster;
pub mod admin_commissioning_cluster;
pub mod air_quality;
pub mod alarm_base;
pub mod application_basic;
pub mod application_launcher;
pub mod audio_output;
pub mod basic_information_cluster;
pub mod binding_cluster;
pub mod boolean_state;
pub mod boolean_state_configuration;
pub mod bridged_device_basic_information_cluster;
pub mod camera_av_settings_user_level_management;
pub mod camera_av_stream_management;
pub mod channel;
pub mod chime;
pub mod closure_control;
pub mod closure_dimension;
pub mod color_control;
pub mod commissioner_control_cluster;
pub mod commodity_metering;
pub mod commodity_price;
pub mod commodity_tariff;
pub mod concentration_measurement;
pub mod content_app_observer;
pub mod content_control;
pub mod content_launcher;
pub mod descriptor_cluster;
pub mod device_energy_management;
pub mod diagnostic_logs_cluster;
pub mod diagnostics_ethernet;
pub mod diagnostics_general;
pub mod diagnostics_software;
pub mod diagnostics_thread;
pub mod diagnostics_wifi;
pub mod dishwasher_alarm;
pub mod door_lock;
pub mod ecosystem_information_cluster;
pub mod electrical_energy_measurement;
pub mod electrical_grid_conditions;
pub mod electrical_power_measurement;
pub mod energy_evse;
pub mod energy_preference;
pub mod fan_control;
pub mod fixed_label_cluster;
pub mod flow_measurement;
pub mod general_commissioning_cluster;
pub mod group_key_management_cluster;
pub mod groups;
pub mod icd_management;
pub mod identify;
pub mod illuminance_measurement;
pub mod joint_fabric_administrator_cluster;
pub mod joint_fabric_datastore_cluster;
pub mod keypad_input;
pub mod label_cluster;
pub mod laundry_dryer_controls;
pub mod laundry_washer_controls;
pub mod level_control;
pub mod localization_configuration;
pub mod localization_time_format;
pub mod localization_unit;
pub mod low_power;
pub mod media_input;
pub mod media_playback;
pub mod messages;
pub mod meter_identification;
pub mod microwave_oven_control;
pub mod mode_base;
pub mod mode_device_energy_management;
pub mod mode_dishwasher;
pub mod mode_evse;
pub mod mode_laundry_washer;
pub mod mode_microwave_oven;
pub mod mode_oven;
pub mod mode_refrigerator;
pub mod mode_rvc_clean;
pub mod mode_rvc_run;
pub mod mode_select;
pub mod mode_water_heater;
pub mod network_commissioning_cluster;
pub mod occupancy_sensing;
pub mod on_off;
pub mod operational_credential_cluster;
pub mod operational_state;
pub mod operational_state_oven;
pub mod operational_state_rvc;
pub mod ota_provider;
pub mod ota_requestor;
pub mod power_source_cluster;
pub mod power_source_configuration_cluster;
pub mod power_topology;
pub mod pressure_measurement;
pub mod pump_configuration_control;
pub mod push_av_stream_transport;
pub mod refrigerator_alarm;
pub mod resource_monitoring;
pub mod scenes;
pub mod service_area;
pub mod smoke_co_alarm;
pub mod soil_measurement;
pub mod switch;
pub mod target_navigator;
pub mod temperature_control;
pub mod temperature_measurement;
pub mod thermostat;
pub mod thermostat_user_interface_configuration;
pub mod thread_border_router_management;
pub mod thread_network_directory;
pub mod time_sync;
pub mod tls_certificate_management;
pub mod tls_client_management;
pub mod user_label_cluster;
pub mod valve_configuration_control;
pub mod wake_on_lan;
pub mod water_content_measurement;
pub mod water_heater_management;
pub mod web_rtc_provider;
pub mod web_rtc_requestor;
pub mod wifi_network_management;
pub mod window_covering;
pub mod zone_management;


/// Main dispatcher function for decoding attributes to JSON
///
/// This function routes to the appropriate cluster-specific decoder based on cluster ID.
///
/// # Parameters
/// * `cluster_id` - The cluster identifier
/// * `attribute_id` - The attribute identifier
/// * `tlv_value` - The TLV value to decode
///
/// # Returns
/// JSON string representation of the decoded value or error message
pub fn decode_attribute_json(cluster_id: u32, attribute_id: u32, tlv_value: &crate::tlv::TlvItemValue) -> String {
    match cluster_id {
        0x0000 => alarm_base::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0003 => identify::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0004 => groups::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0006 => on_off::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0008 => level_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x001D => descriptor_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x001E => binding_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x001F => acl_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0025 => actions_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0028 => basic_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x002A => ota_requestor::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x002B => localization_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x002C => localization_time_format::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x002D => localization_unit::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x002E => power_source_configuration_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x002F => power_source_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0030 => general_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0031 => network_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0033 => diagnostics_general::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0034 => diagnostics_software::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0035 => diagnostics_thread::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0036 => diagnostics_wifi::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0037 => diagnostics_ethernet::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0038 => time_sync::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0039 => bridged_device_basic_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x003B => switch::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x003C => admin_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x003E => operational_credential_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x003F => group_key_management_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0040 => fixed_label_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0041 => user_label_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0045 => boolean_state::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0046 => icd_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0049 => mode_oven::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x004A => laundry_dryer_controls::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0050 => mode_select::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0051 => mode_laundry_washer::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0052 => mode_refrigerator::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0053 => laundry_washer_controls::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0054 => mode_rvc_run::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0055 => mode_rvc_clean::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0056 => temperature_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0059 => mode_dishwasher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x005B => air_quality::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x005C => smoke_co_alarm::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x005E => mode_microwave_oven::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x005F => microwave_oven_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0060 => operational_state::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0062 => scenes::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0080 => boolean_state_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0081 => valve_configuration_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0090 => electrical_power_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0091 => electrical_energy_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0094 => water_heater_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0095 => commodity_price::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0097 => messages::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0098 => device_energy_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0099 => energy_evse::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x009B => energy_preference::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x009C => power_topology::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x009D => mode_evse::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x009E => mode_water_heater::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x009F => mode_device_energy_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x00A0 => electrical_grid_conditions::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0101 => door_lock::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0102 => window_covering::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0104 => closure_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0105 => closure_dimension::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0150 => service_area::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0200 => pump_configuration_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0201 => thermostat::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0202 => fan_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0204 => thermostat_user_interface_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0300 => color_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0400 => illuminance_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0402 => temperature_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0403 => pressure_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0404 => flow_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0406 => occupancy_sensing::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0430 => soil_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0451 => wifi_network_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0452 => thread_border_router_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0453 => thread_network_directory::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0503 => wake_on_lan::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0504 => channel::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0505 => target_navigator::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0506 => media_playback::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0507 => media_input::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x050A => content_launcher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x050B => audio_output::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x050C => application_launcher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x050D => application_basic::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x050F => content_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0550 => zone_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0551 => camera_av_stream_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0552 => camera_av_settings_user_level_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0553 => web_rtc_provider::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0554 => web_rtc_requestor::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0555 => push_av_stream_transport::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0556 => chime::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0700 => commodity_tariff::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0750 => ecosystem_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0751 => commissioner_control_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0752 => joint_fabric_datastore_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0753 => joint_fabric_administrator_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0801 => tls_certificate_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0802 => tls_client_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0B06 => meter_identification::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        0x0B07 => commodity_metering::decode_attribute_json(cluster_id, attribute_id, tlv_value),
        _ => format!("{{\"error\": \"Unsupported cluster ID: {}\"}}", cluster_id),
    }
}


/// Main dispatcher function for getting attribute lists
///
/// This function routes to the appropriate cluster-specific attribute list based on cluster ID.
///
/// # Parameters
/// * `cluster_id` - The cluster identifier
///
/// # Returns
/// Vector of tuples containing (attribute_id, attribute_name) or empty vector if unsupported
pub fn get_attribute_list(cluster_id: u32) -> Vec<(u32, &'static str)> {
    match cluster_id {
        0x0000 => alarm_base::get_attribute_list(),
        0x0003 => identify::get_attribute_list(),
        0x0004 => groups::get_attribute_list(),
        0x0006 => on_off::get_attribute_list(),
        0x0008 => level_control::get_attribute_list(),
        0x001D => descriptor_cluster::get_attribute_list(),
        0x001E => binding_cluster::get_attribute_list(),
        0x001F => acl_cluster::get_attribute_list(),
        0x0025 => actions_cluster::get_attribute_list(),
        0x0028 => basic_information_cluster::get_attribute_list(),
        0x002A => ota_requestor::get_attribute_list(),
        0x002B => localization_configuration::get_attribute_list(),
        0x002C => localization_time_format::get_attribute_list(),
        0x002D => localization_unit::get_attribute_list(),
        0x002E => power_source_configuration_cluster::get_attribute_list(),
        0x002F => power_source_cluster::get_attribute_list(),
        0x0030 => general_commissioning_cluster::get_attribute_list(),
        0x0031 => network_commissioning_cluster::get_attribute_list(),
        0x0033 => diagnostics_general::get_attribute_list(),
        0x0034 => diagnostics_software::get_attribute_list(),
        0x0035 => diagnostics_thread::get_attribute_list(),
        0x0036 => diagnostics_wifi::get_attribute_list(),
        0x0037 => diagnostics_ethernet::get_attribute_list(),
        0x0038 => time_sync::get_attribute_list(),
        0x0039 => bridged_device_basic_information_cluster::get_attribute_list(),
        0x003B => switch::get_attribute_list(),
        0x003C => admin_commissioning_cluster::get_attribute_list(),
        0x003E => operational_credential_cluster::get_attribute_list(),
        0x003F => group_key_management_cluster::get_attribute_list(),
        0x0040 => fixed_label_cluster::get_attribute_list(),
        0x0041 => user_label_cluster::get_attribute_list(),
        0x0045 => boolean_state::get_attribute_list(),
        0x0046 => icd_management::get_attribute_list(),
        0x0049 => mode_oven::get_attribute_list(),
        0x004A => laundry_dryer_controls::get_attribute_list(),
        0x0050 => mode_select::get_attribute_list(),
        0x0051 => mode_laundry_washer::get_attribute_list(),
        0x0052 => mode_refrigerator::get_attribute_list(),
        0x0053 => laundry_washer_controls::get_attribute_list(),
        0x0054 => mode_rvc_run::get_attribute_list(),
        0x0055 => mode_rvc_clean::get_attribute_list(),
        0x0056 => temperature_control::get_attribute_list(),
        0x0059 => mode_dishwasher::get_attribute_list(),
        0x005B => air_quality::get_attribute_list(),
        0x005C => smoke_co_alarm::get_attribute_list(),
        0x005E => mode_microwave_oven::get_attribute_list(),
        0x005F => microwave_oven_control::get_attribute_list(),
        0x0060 => operational_state::get_attribute_list(),
        0x0062 => scenes::get_attribute_list(),
        0x0080 => boolean_state_configuration::get_attribute_list(),
        0x0081 => valve_configuration_control::get_attribute_list(),
        0x0090 => electrical_power_measurement::get_attribute_list(),
        0x0091 => electrical_energy_measurement::get_attribute_list(),
        0x0094 => water_heater_management::get_attribute_list(),
        0x0095 => commodity_price::get_attribute_list(),
        0x0097 => messages::get_attribute_list(),
        0x0098 => device_energy_management::get_attribute_list(),
        0x0099 => energy_evse::get_attribute_list(),
        0x009B => energy_preference::get_attribute_list(),
        0x009C => power_topology::get_attribute_list(),
        0x009D => mode_evse::get_attribute_list(),
        0x009E => mode_water_heater::get_attribute_list(),
        0x009F => mode_device_energy_management::get_attribute_list(),
        0x00A0 => electrical_grid_conditions::get_attribute_list(),
        0x0101 => door_lock::get_attribute_list(),
        0x0102 => window_covering::get_attribute_list(),
        0x0104 => closure_control::get_attribute_list(),
        0x0105 => closure_dimension::get_attribute_list(),
        0x0150 => service_area::get_attribute_list(),
        0x0200 => pump_configuration_control::get_attribute_list(),
        0x0201 => thermostat::get_attribute_list(),
        0x0202 => fan_control::get_attribute_list(),
        0x0204 => thermostat_user_interface_configuration::get_attribute_list(),
        0x0300 => color_control::get_attribute_list(),
        0x0400 => illuminance_measurement::get_attribute_list(),
        0x0402 => temperature_measurement::get_attribute_list(),
        0x0403 => pressure_measurement::get_attribute_list(),
        0x0404 => flow_measurement::get_attribute_list(),
        0x0406 => occupancy_sensing::get_attribute_list(),
        0x0430 => soil_measurement::get_attribute_list(),
        0x0451 => wifi_network_management::get_attribute_list(),
        0x0452 => thread_border_router_management::get_attribute_list(),
        0x0453 => thread_network_directory::get_attribute_list(),
        0x0503 => wake_on_lan::get_attribute_list(),
        0x0504 => channel::get_attribute_list(),
        0x0505 => target_navigator::get_attribute_list(),
        0x0506 => media_playback::get_attribute_list(),
        0x0507 => media_input::get_attribute_list(),
        0x050A => content_launcher::get_attribute_list(),
        0x050B => audio_output::get_attribute_list(),
        0x050C => application_launcher::get_attribute_list(),
        0x050D => application_basic::get_attribute_list(),
        0x050F => content_control::get_attribute_list(),
        0x0550 => zone_management::get_attribute_list(),
        0x0551 => camera_av_stream_management::get_attribute_list(),
        0x0552 => camera_av_settings_user_level_management::get_attribute_list(),
        0x0553 => web_rtc_provider::get_attribute_list(),
        0x0554 => web_rtc_requestor::get_attribute_list(),
        0x0555 => push_av_stream_transport::get_attribute_list(),
        0x0556 => chime::get_attribute_list(),
        0x0700 => commodity_tariff::get_attribute_list(),
        0x0750 => ecosystem_information_cluster::get_attribute_list(),
        0x0751 => commissioner_control_cluster::get_attribute_list(),
        0x0752 => joint_fabric_datastore_cluster::get_attribute_list(),
        0x0753 => joint_fabric_administrator_cluster::get_attribute_list(),
        0x0801 => tls_certificate_management::get_attribute_list(),
        0x0802 => tls_client_management::get_attribute_list(),
        0x0B06 => meter_identification::get_attribute_list(),
        0x0B07 => commodity_metering::get_attribute_list(),
        _ => vec![],
    }
}


pub fn get_command_list(cluster_id: u32) -> Vec<(u32, &'static str)> {
    match cluster_id {
        0x0000 => alarm_base::get_command_list(),
        0x0003 => identify::get_command_list(),
        0x0004 => groups::get_command_list(),
        0x0006 => on_off::get_command_list(),
        0x0008 => level_control::get_command_list(),
        0x001F => acl_cluster::get_command_list(),
        0x0025 => actions_cluster::get_command_list(),
        0x0029 => ota_provider::get_command_list(),
        0x002A => ota_requestor::get_command_list(),
        0x0030 => general_commissioning_cluster::get_command_list(),
        0x0031 => network_commissioning_cluster::get_command_list(),
        0x0032 => diagnostic_logs_cluster::get_command_list(),
        0x0033 => diagnostics_general::get_command_list(),
        0x0034 => diagnostics_software::get_command_list(),
        0x0035 => diagnostics_thread::get_command_list(),
        0x0036 => diagnostics_wifi::get_command_list(),
        0x0037 => diagnostics_ethernet::get_command_list(),
        0x0038 => time_sync::get_command_list(),
        0x0039 => bridged_device_basic_information_cluster::get_command_list(),
        0x003C => admin_commissioning_cluster::get_command_list(),
        0x003E => operational_credential_cluster::get_command_list(),
        0x003F => group_key_management_cluster::get_command_list(),
        0x0046 => icd_management::get_command_list(),
        0x0048 => operational_state_oven::get_command_list(),
        0x0050 => mode_select::get_command_list(),
        0x0056 => temperature_control::get_command_list(),
        0x0057 => refrigerator_alarm::get_command_list(),
        0x005C => smoke_co_alarm::get_command_list(),
        0x005E => mode_microwave_oven::get_command_list(),
        0x005F => microwave_oven_control::get_command_list(),
        0x0060 => operational_state::get_command_list(),
        0x0061 => operational_state_rvc::get_command_list(),
        0x0062 => scenes::get_command_list(),
        0x0080 => boolean_state_configuration::get_command_list(),
        0x0081 => valve_configuration_control::get_command_list(),
        0x0094 => water_heater_management::get_command_list(),
        0x0095 => commodity_price::get_command_list(),
        0x0097 => messages::get_command_list(),
        0x0098 => device_energy_management::get_command_list(),
        0x0099 => energy_evse::get_command_list(),
        0x0101 => door_lock::get_command_list(),
        0x0102 => window_covering::get_command_list(),
        0x0104 => closure_control::get_command_list(),
        0x0105 => closure_dimension::get_command_list(),
        0x0150 => service_area::get_command_list(),
        0x0201 => thermostat::get_command_list(),
        0x0202 => fan_control::get_command_list(),
        0x0300 => color_control::get_command_list(),
        0x0451 => wifi_network_management::get_command_list(),
        0x0452 => thread_border_router_management::get_command_list(),
        0x0453 => thread_network_directory::get_command_list(),
        0x0504 => channel::get_command_list(),
        0x0505 => target_navigator::get_command_list(),
        0x0506 => media_playback::get_command_list(),
        0x0507 => media_input::get_command_list(),
        0x0508 => low_power::get_command_list(),
        0x0509 => keypad_input::get_command_list(),
        0x050A => content_launcher::get_command_list(),
        0x050B => audio_output::get_command_list(),
        0x050C => application_launcher::get_command_list(),
        0x050E => account_login::get_command_list(),
        0x050F => content_control::get_command_list(),
        0x0510 => content_app_observer::get_command_list(),
        0x0550 => zone_management::get_command_list(),
        0x0551 => camera_av_stream_management::get_command_list(),
        0x0552 => camera_av_settings_user_level_management::get_command_list(),
        0x0553 => web_rtc_provider::get_command_list(),
        0x0554 => web_rtc_requestor::get_command_list(),
        0x0555 => push_av_stream_transport::get_command_list(),
        0x0556 => chime::get_command_list(),
        0x0700 => commodity_tariff::get_command_list(),
        0x0751 => commissioner_control_cluster::get_command_list(),
        0x0752 => joint_fabric_datastore_cluster::get_command_list(),
        0x0753 => joint_fabric_administrator_cluster::get_command_list(),
        0x0801 => tls_certificate_management::get_command_list(),
        0x0802 => tls_client_management::get_command_list(),
        _ => vec![],
    }
}

pub fn get_command_name(cluster_id: u32, cmd_id: u32) -> Option<&'static str> {
    match cluster_id {
        0x0000 => alarm_base::get_command_name(cmd_id),
        0x0003 => identify::get_command_name(cmd_id),
        0x0004 => groups::get_command_name(cmd_id),
        0x0006 => on_off::get_command_name(cmd_id),
        0x0008 => level_control::get_command_name(cmd_id),
        0x001F => acl_cluster::get_command_name(cmd_id),
        0x0025 => actions_cluster::get_command_name(cmd_id),
        0x0029 => ota_provider::get_command_name(cmd_id),
        0x002A => ota_requestor::get_command_name(cmd_id),
        0x0030 => general_commissioning_cluster::get_command_name(cmd_id),
        0x0031 => network_commissioning_cluster::get_command_name(cmd_id),
        0x0032 => diagnostic_logs_cluster::get_command_name(cmd_id),
        0x0033 => diagnostics_general::get_command_name(cmd_id),
        0x0034 => diagnostics_software::get_command_name(cmd_id),
        0x0035 => diagnostics_thread::get_command_name(cmd_id),
        0x0036 => diagnostics_wifi::get_command_name(cmd_id),
        0x0037 => diagnostics_ethernet::get_command_name(cmd_id),
        0x0038 => time_sync::get_command_name(cmd_id),
        0x0039 => bridged_device_basic_information_cluster::get_command_name(cmd_id),
        0x003C => admin_commissioning_cluster::get_command_name(cmd_id),
        0x003E => operational_credential_cluster::get_command_name(cmd_id),
        0x003F => group_key_management_cluster::get_command_name(cmd_id),
        0x0046 => icd_management::get_command_name(cmd_id),
        0x0048 => operational_state_oven::get_command_name(cmd_id),
        0x0050 => mode_select::get_command_name(cmd_id),
        0x0056 => temperature_control::get_command_name(cmd_id),
        0x0057 => refrigerator_alarm::get_command_name(cmd_id),
        0x005C => smoke_co_alarm::get_command_name(cmd_id),
        0x005E => mode_microwave_oven::get_command_name(cmd_id),
        0x005F => microwave_oven_control::get_command_name(cmd_id),
        0x0060 => operational_state::get_command_name(cmd_id),
        0x0061 => operational_state_rvc::get_command_name(cmd_id),
        0x0062 => scenes::get_command_name(cmd_id),
        0x0080 => boolean_state_configuration::get_command_name(cmd_id),
        0x0081 => valve_configuration_control::get_command_name(cmd_id),
        0x0094 => water_heater_management::get_command_name(cmd_id),
        0x0095 => commodity_price::get_command_name(cmd_id),
        0x0097 => messages::get_command_name(cmd_id),
        0x0098 => device_energy_management::get_command_name(cmd_id),
        0x0099 => energy_evse::get_command_name(cmd_id),
        0x0101 => door_lock::get_command_name(cmd_id),
        0x0102 => window_covering::get_command_name(cmd_id),
        0x0104 => closure_control::get_command_name(cmd_id),
        0x0105 => closure_dimension::get_command_name(cmd_id),
        0x0150 => service_area::get_command_name(cmd_id),
        0x0201 => thermostat::get_command_name(cmd_id),
        0x0202 => fan_control::get_command_name(cmd_id),
        0x0300 => color_control::get_command_name(cmd_id),
        0x0451 => wifi_network_management::get_command_name(cmd_id),
        0x0452 => thread_border_router_management::get_command_name(cmd_id),
        0x0453 => thread_network_directory::get_command_name(cmd_id),
        0x0504 => channel::get_command_name(cmd_id),
        0x0505 => target_navigator::get_command_name(cmd_id),
        0x0506 => media_playback::get_command_name(cmd_id),
        0x0507 => media_input::get_command_name(cmd_id),
        0x0508 => low_power::get_command_name(cmd_id),
        0x0509 => keypad_input::get_command_name(cmd_id),
        0x050A => content_launcher::get_command_name(cmd_id),
        0x050B => audio_output::get_command_name(cmd_id),
        0x050C => application_launcher::get_command_name(cmd_id),
        0x050E => account_login::get_command_name(cmd_id),
        0x050F => content_control::get_command_name(cmd_id),
        0x0510 => content_app_observer::get_command_name(cmd_id),
        0x0550 => zone_management::get_command_name(cmd_id),
        0x0551 => camera_av_stream_management::get_command_name(cmd_id),
        0x0552 => camera_av_settings_user_level_management::get_command_name(cmd_id),
        0x0553 => web_rtc_provider::get_command_name(cmd_id),
        0x0554 => web_rtc_requestor::get_command_name(cmd_id),
        0x0555 => push_av_stream_transport::get_command_name(cmd_id),
        0x0556 => chime::get_command_name(cmd_id),
        0x0700 => commodity_tariff::get_command_name(cmd_id),
        0x0751 => commissioner_control_cluster::get_command_name(cmd_id),
        0x0752 => joint_fabric_datastore_cluster::get_command_name(cmd_id),
        0x0753 => joint_fabric_administrator_cluster::get_command_name(cmd_id),
        0x0801 => tls_certificate_management::get_command_name(cmd_id),
        0x0802 => tls_client_management::get_command_name(cmd_id),
        _ => None,
    }
}

pub fn get_command_schema(cluster_id: u32, cmd_id: u32) -> Option<Vec<CommandField>> {
    match cluster_id {
        0x0000 => alarm_base::get_command_schema(cmd_id),
        0x0003 => identify::get_command_schema(cmd_id),
        0x0004 => groups::get_command_schema(cmd_id),
        0x0006 => on_off::get_command_schema(cmd_id),
        0x0008 => level_control::get_command_schema(cmd_id),
        0x001F => acl_cluster::get_command_schema(cmd_id),
        0x0025 => actions_cluster::get_command_schema(cmd_id),
        0x0029 => ota_provider::get_command_schema(cmd_id),
        0x002A => ota_requestor::get_command_schema(cmd_id),
        0x0030 => general_commissioning_cluster::get_command_schema(cmd_id),
        0x0031 => network_commissioning_cluster::get_command_schema(cmd_id),
        0x0032 => diagnostic_logs_cluster::get_command_schema(cmd_id),
        0x0033 => diagnostics_general::get_command_schema(cmd_id),
        0x0034 => diagnostics_software::get_command_schema(cmd_id),
        0x0035 => diagnostics_thread::get_command_schema(cmd_id),
        0x0036 => diagnostics_wifi::get_command_schema(cmd_id),
        0x0037 => diagnostics_ethernet::get_command_schema(cmd_id),
        0x0038 => time_sync::get_command_schema(cmd_id),
        0x0039 => bridged_device_basic_information_cluster::get_command_schema(cmd_id),
        0x003C => admin_commissioning_cluster::get_command_schema(cmd_id),
        0x003E => operational_credential_cluster::get_command_schema(cmd_id),
        0x003F => group_key_management_cluster::get_command_schema(cmd_id),
        0x0046 => icd_management::get_command_schema(cmd_id),
        0x0048 => operational_state_oven::get_command_schema(cmd_id),
        0x0050 => mode_select::get_command_schema(cmd_id),
        0x0056 => temperature_control::get_command_schema(cmd_id),
        0x0057 => refrigerator_alarm::get_command_schema(cmd_id),
        0x005C => smoke_co_alarm::get_command_schema(cmd_id),
        0x005E => mode_microwave_oven::get_command_schema(cmd_id),
        0x005F => microwave_oven_control::get_command_schema(cmd_id),
        0x0060 => operational_state::get_command_schema(cmd_id),
        0x0061 => operational_state_rvc::get_command_schema(cmd_id),
        0x0062 => scenes::get_command_schema(cmd_id),
        0x0080 => boolean_state_configuration::get_command_schema(cmd_id),
        0x0081 => valve_configuration_control::get_command_schema(cmd_id),
        0x0094 => water_heater_management::get_command_schema(cmd_id),
        0x0095 => commodity_price::get_command_schema(cmd_id),
        0x0097 => messages::get_command_schema(cmd_id),
        0x0098 => device_energy_management::get_command_schema(cmd_id),
        0x0099 => energy_evse::get_command_schema(cmd_id),
        0x0101 => door_lock::get_command_schema(cmd_id),
        0x0102 => window_covering::get_command_schema(cmd_id),
        0x0104 => closure_control::get_command_schema(cmd_id),
        0x0105 => closure_dimension::get_command_schema(cmd_id),
        0x0150 => service_area::get_command_schema(cmd_id),
        0x0201 => thermostat::get_command_schema(cmd_id),
        0x0202 => fan_control::get_command_schema(cmd_id),
        0x0300 => color_control::get_command_schema(cmd_id),
        0x0451 => wifi_network_management::get_command_schema(cmd_id),
        0x0452 => thread_border_router_management::get_command_schema(cmd_id),
        0x0453 => thread_network_directory::get_command_schema(cmd_id),
        0x0504 => channel::get_command_schema(cmd_id),
        0x0505 => target_navigator::get_command_schema(cmd_id),
        0x0506 => media_playback::get_command_schema(cmd_id),
        0x0507 => media_input::get_command_schema(cmd_id),
        0x0508 => low_power::get_command_schema(cmd_id),
        0x0509 => keypad_input::get_command_schema(cmd_id),
        0x050A => content_launcher::get_command_schema(cmd_id),
        0x050B => audio_output::get_command_schema(cmd_id),
        0x050C => application_launcher::get_command_schema(cmd_id),
        0x050E => account_login::get_command_schema(cmd_id),
        0x050F => content_control::get_command_schema(cmd_id),
        0x0510 => content_app_observer::get_command_schema(cmd_id),
        0x0550 => zone_management::get_command_schema(cmd_id),
        0x0551 => camera_av_stream_management::get_command_schema(cmd_id),
        0x0552 => camera_av_settings_user_level_management::get_command_schema(cmd_id),
        0x0553 => web_rtc_provider::get_command_schema(cmd_id),
        0x0554 => web_rtc_requestor::get_command_schema(cmd_id),
        0x0555 => push_av_stream_transport::get_command_schema(cmd_id),
        0x0556 => chime::get_command_schema(cmd_id),
        0x0700 => commodity_tariff::get_command_schema(cmd_id),
        0x0751 => commissioner_control_cluster::get_command_schema(cmd_id),
        0x0752 => joint_fabric_datastore_cluster::get_command_schema(cmd_id),
        0x0753 => joint_fabric_administrator_cluster::get_command_schema(cmd_id),
        0x0801 => tls_certificate_management::get_command_schema(cmd_id),
        0x0802 => tls_client_management::get_command_schema(cmd_id),
        _ => None,
    }
}

pub fn encode_command_json(cluster_id: u32, cmd_id: u32, args: &serde_json::Value) -> anyhow::Result<Vec<u8>> {
    match cluster_id {
        0x0000 => alarm_base::encode_command_json(cmd_id, args),
        0x0003 => identify::encode_command_json(cmd_id, args),
        0x0004 => groups::encode_command_json(cmd_id, args),
        0x0006 => on_off::encode_command_json(cmd_id, args),
        0x0008 => level_control::encode_command_json(cmd_id, args),
        0x001F => acl_cluster::encode_command_json(cmd_id, args),
        0x0025 => actions_cluster::encode_command_json(cmd_id, args),
        0x0029 => ota_provider::encode_command_json(cmd_id, args),
        0x002A => ota_requestor::encode_command_json(cmd_id, args),
        0x0030 => general_commissioning_cluster::encode_command_json(cmd_id, args),
        0x0031 => network_commissioning_cluster::encode_command_json(cmd_id, args),
        0x0032 => diagnostic_logs_cluster::encode_command_json(cmd_id, args),
        0x0033 => diagnostics_general::encode_command_json(cmd_id, args),
        0x0034 => diagnostics_software::encode_command_json(cmd_id, args),
        0x0035 => diagnostics_thread::encode_command_json(cmd_id, args),
        0x0036 => diagnostics_wifi::encode_command_json(cmd_id, args),
        0x0037 => diagnostics_ethernet::encode_command_json(cmd_id, args),
        0x0038 => time_sync::encode_command_json(cmd_id, args),
        0x0039 => bridged_device_basic_information_cluster::encode_command_json(cmd_id, args),
        0x003C => admin_commissioning_cluster::encode_command_json(cmd_id, args),
        0x003E => operational_credential_cluster::encode_command_json(cmd_id, args),
        0x003F => group_key_management_cluster::encode_command_json(cmd_id, args),
        0x0046 => icd_management::encode_command_json(cmd_id, args),
        0x0048 => operational_state_oven::encode_command_json(cmd_id, args),
        0x0050 => mode_select::encode_command_json(cmd_id, args),
        0x0056 => temperature_control::encode_command_json(cmd_id, args),
        0x0057 => refrigerator_alarm::encode_command_json(cmd_id, args),
        0x005C => smoke_co_alarm::encode_command_json(cmd_id, args),
        0x005E => mode_microwave_oven::encode_command_json(cmd_id, args),
        0x005F => microwave_oven_control::encode_command_json(cmd_id, args),
        0x0060 => operational_state::encode_command_json(cmd_id, args),
        0x0061 => operational_state_rvc::encode_command_json(cmd_id, args),
        0x0062 => scenes::encode_command_json(cmd_id, args),
        0x0080 => boolean_state_configuration::encode_command_json(cmd_id, args),
        0x0081 => valve_configuration_control::encode_command_json(cmd_id, args),
        0x0094 => water_heater_management::encode_command_json(cmd_id, args),
        0x0095 => commodity_price::encode_command_json(cmd_id, args),
        0x0097 => messages::encode_command_json(cmd_id, args),
        0x0098 => device_energy_management::encode_command_json(cmd_id, args),
        0x0099 => energy_evse::encode_command_json(cmd_id, args),
        0x0101 => door_lock::encode_command_json(cmd_id, args),
        0x0102 => window_covering::encode_command_json(cmd_id, args),
        0x0104 => closure_control::encode_command_json(cmd_id, args),
        0x0105 => closure_dimension::encode_command_json(cmd_id, args),
        0x0150 => service_area::encode_command_json(cmd_id, args),
        0x0201 => thermostat::encode_command_json(cmd_id, args),
        0x0202 => fan_control::encode_command_json(cmd_id, args),
        0x0300 => color_control::encode_command_json(cmd_id, args),
        0x0451 => wifi_network_management::encode_command_json(cmd_id, args),
        0x0452 => thread_border_router_management::encode_command_json(cmd_id, args),
        0x0453 => thread_network_directory::encode_command_json(cmd_id, args),
        0x0504 => channel::encode_command_json(cmd_id, args),
        0x0505 => target_navigator::encode_command_json(cmd_id, args),
        0x0506 => media_playback::encode_command_json(cmd_id, args),
        0x0507 => media_input::encode_command_json(cmd_id, args),
        0x0508 => low_power::encode_command_json(cmd_id, args),
        0x0509 => keypad_input::encode_command_json(cmd_id, args),
        0x050A => content_launcher::encode_command_json(cmd_id, args),
        0x050B => audio_output::encode_command_json(cmd_id, args),
        0x050C => application_launcher::encode_command_json(cmd_id, args),
        0x050E => account_login::encode_command_json(cmd_id, args),
        0x050F => content_control::encode_command_json(cmd_id, args),
        0x0510 => content_app_observer::encode_command_json(cmd_id, args),
        0x0550 => zone_management::encode_command_json(cmd_id, args),
        0x0551 => camera_av_stream_management::encode_command_json(cmd_id, args),
        0x0552 => camera_av_settings_user_level_management::encode_command_json(cmd_id, args),
        0x0553 => web_rtc_provider::encode_command_json(cmd_id, args),
        0x0554 => web_rtc_requestor::encode_command_json(cmd_id, args),
        0x0555 => push_av_stream_transport::encode_command_json(cmd_id, args),
        0x0556 => chime::encode_command_json(cmd_id, args),
        0x0700 => commodity_tariff::encode_command_json(cmd_id, args),
        0x0751 => commissioner_control_cluster::encode_command_json(cmd_id, args),
        0x0752 => joint_fabric_datastore_cluster::encode_command_json(cmd_id, args),
        0x0753 => joint_fabric_administrator_cluster::encode_command_json(cmd_id, args),
        0x0801 => tls_certificate_management::encode_command_json(cmd_id, args),
        0x0802 => tls_client_management::encode_command_json(cmd_id, args),
        _ => Err(anyhow::anyhow!("unsupported cluster: 0x{:04X}", cluster_id)),
    }
}