1#![allow(unused_imports)]
15
16use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
17use crate::dm::meta::{EventPriority, Reporting};
18use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
19use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
20use crate::error::Result;
21use crate::im::{AttributeId, ClusterId, CommandId, EventId};
22use crate::tlv::{
23 ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
24};
25
26pub const ID: ClusterId = 0x0700;
28
29pub const REVISION: u16 = 1;
32
33pub const PICS: &str = "SETRF";
35
36pub mod feature {
41 pub const PRICING: u32 = 1 << 0;
45 pub const FRIENDLY_CREDIT: u32 = 1 << 1;
49 pub const AUXILIARY_LOAD: u32 = 1 << 2;
53 pub const PEAK_PERIOD: u32 = 1 << 3;
57 pub const POWER_THRESHOLD: u32 = 1 << 4;
61 pub const RANDOMIZATION: u32 = 1 << 5;
65}
66
67pub const FEATURES: &[Feature] = &[
69 Feature {
70 bit: 0,
71 code: "PRICE",
72 name: "Pricing",
73 conform: Conform::OPTIONAL,
74 },
75 Feature {
76 bit: 1,
77 code: "FCRED",
78 name: "FriendlyCredit",
79 conform: Conform::OPTIONAL,
80 },
81 Feature {
82 bit: 2,
83 code: "AUXLD",
84 name: "AuxiliaryLoad",
85 conform: Conform::OPTIONAL,
86 },
87 Feature {
88 bit: 3,
89 code: "PEAKP",
90 name: "PeakPeriod",
91 conform: Conform::OPTIONAL,
92 },
93 Feature {
94 bit: 4,
95 code: "PWRTHLD",
96 name: "PowerThreshold",
97 conform: Conform::OPTIONAL,
98 },
99 Feature {
100 bit: 5,
101 code: "RNDM",
102 name: "Randomization",
103 conform: Conform::OPTIONAL,
104 },
105];
106
107pub mod attribute {
109 use crate::im::AttributeId;
110
111 pub const TARIFF_INFO: AttributeId = 0x00;
113 pub const TARIFF_UNIT: AttributeId = 0x01;
115 pub const START_DATE: AttributeId = 0x02;
117 pub const DAY_ENTRIES: AttributeId = 0x03;
119 pub const DAY_PATTERNS: AttributeId = 0x04;
121 pub const CALENDAR_PERIODS: AttributeId = 0x05;
123 pub const INDIVIDUAL_DAYS: AttributeId = 0x06;
125 pub const CURRENT_DAY: AttributeId = 0x07;
127 pub const NEXT_DAY: AttributeId = 0x08;
129 pub const CURRENT_DAY_ENTRY: AttributeId = 0x09;
131 pub const CURRENT_DAY_ENTRY_DATE: AttributeId = 0x0A;
133 pub const NEXT_DAY_ENTRY: AttributeId = 0x0B;
135 pub const NEXT_DAY_ENTRY_DATE: AttributeId = 0x0C;
137 pub const TARIFF_COMPONENTS: AttributeId = 0x0D;
139 pub const TARIFF_PERIODS: AttributeId = 0x0E;
141 pub const CURRENT_TARIFF_COMPONENTS: AttributeId = 0x0F;
143 pub const NEXT_TARIFF_COMPONENTS: AttributeId = 0x10;
145 pub const DEFAULT_RANDOMIZATION_OFFSET: AttributeId = 0x11;
147 pub const DEFAULT_RANDOMIZATION_TYPE: AttributeId = 0x12;
149}
150
151pub mod command {
153 use crate::im::CommandId;
154
155 pub const GET_TARIFF_COMPONENT: CommandId = 0x00;
157 pub const GET_TARIFF_COMPONENT_RESPONSE: CommandId = 0x00;
159 pub const GET_DAY_ENTRY: CommandId = 0x01;
161 pub const GET_DAY_ENTRY_RESPONSE: CommandId = 0x01;
163}
164
165#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
167#[repr(u8)]
168pub enum AuxiliaryLoadSettingEnum {
169 Off = 0,
171 On = 1,
173 None = 2,
175}
176
177impl AuxiliaryLoadSettingEnum {
178 #[must_use]
180 pub const fn from_value(value: u8) -> Option<Self> {
181 match value {
182 0 => Some(Self::Off),
183 1 => Some(Self::On),
184 2 => Some(Self::None),
185 _ => None,
186 }
187 }
188
189 #[must_use]
191 pub const fn value(self) -> u8 {
192 self as u8
193 }
194}
195
196impl ToTlv for AuxiliaryLoadSettingEnum {
197 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
198 self.value().to_tlv(w, tag)
199 }
200}
201
202impl<'a> FromTlv<'a> for AuxiliaryLoadSettingEnum {
203 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
204 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
205 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
206 }
207}
208
209#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
211#[repr(u8)]
212pub enum BlockModeEnum {
213 NoBlock = 0,
215 Combined = 1,
217 Individual = 2,
219}
220
221impl BlockModeEnum {
222 #[must_use]
224 pub const fn from_value(value: u8) -> Option<Self> {
225 match value {
226 0 => Some(Self::NoBlock),
227 1 => Some(Self::Combined),
228 2 => Some(Self::Individual),
229 _ => None,
230 }
231 }
232
233 #[must_use]
235 pub const fn value(self) -> u8 {
236 self as u8
237 }
238}
239
240impl ToTlv for BlockModeEnum {
241 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
242 self.value().to_tlv(w, tag)
243 }
244}
245
246impl<'a> FromTlv<'a> for BlockModeEnum {
247 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
248 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
249 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
250 }
251}
252
253#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
255#[repr(u8)]
256pub enum DayEntryRandomizationTypeEnum {
257 None = 0,
259 Fixed = 1,
261 Random = 2,
263 RandomPositive = 3,
265 RandomNegative = 4,
267}
268
269impl DayEntryRandomizationTypeEnum {
270 #[must_use]
272 pub const fn from_value(value: u8) -> Option<Self> {
273 match value {
274 0 => Some(Self::None),
275 1 => Some(Self::Fixed),
276 2 => Some(Self::Random),
277 3 => Some(Self::RandomPositive),
278 4 => Some(Self::RandomNegative),
279 _ => None,
280 }
281 }
282
283 #[must_use]
285 pub const fn value(self) -> u8 {
286 self as u8
287 }
288}
289
290impl ToTlv for DayEntryRandomizationTypeEnum {
291 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
292 self.value().to_tlv(w, tag)
293 }
294}
295
296impl<'a> FromTlv<'a> for DayEntryRandomizationTypeEnum {
297 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
298 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
299 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
300 }
301}
302
303#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
305#[repr(u8)]
306pub enum DayTypeEnum {
307 Standard = 0,
309 Holiday = 1,
311 Dynamic = 2,
313 Event = 3,
315}
316
317impl DayTypeEnum {
318 #[must_use]
320 pub const fn from_value(value: u8) -> Option<Self> {
321 match value {
322 0 => Some(Self::Standard),
323 1 => Some(Self::Holiday),
324 2 => Some(Self::Dynamic),
325 3 => Some(Self::Event),
326 _ => None,
327 }
328 }
329
330 #[must_use]
332 pub const fn value(self) -> u8 {
333 self as u8
334 }
335}
336
337impl ToTlv for DayTypeEnum {
338 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
339 self.value().to_tlv(w, tag)
340 }
341}
342
343impl<'a> FromTlv<'a> for DayTypeEnum {
344 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
345 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
346 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
347 }
348}
349
350#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
352#[repr(u8)]
353pub enum PeakPeriodSeverityEnum {
354 Unused = 0,
356 Low = 1,
358 Medium = 2,
360 High = 3,
362}
363
364impl PeakPeriodSeverityEnum {
365 #[must_use]
367 pub const fn from_value(value: u8) -> Option<Self> {
368 match value {
369 0 => Some(Self::Unused),
370 1 => Some(Self::Low),
371 2 => Some(Self::Medium),
372 3 => Some(Self::High),
373 _ => None,
374 }
375 }
376
377 #[must_use]
379 pub const fn value(self) -> u8 {
380 self as u8
381 }
382}
383
384impl ToTlv for PeakPeriodSeverityEnum {
385 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
386 self.value().to_tlv(w, tag)
387 }
388}
389
390impl<'a> FromTlv<'a> for PeakPeriodSeverityEnum {
391 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
392 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
393 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
394 }
395}
396
397bitflags::bitflags! {
398 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
400 pub struct DayPatternDayOfWeekBitmap: u8 {
401 const SUNDAY = 1 << 0;
403 const MONDAY = 1 << 1;
405 const TUESDAY = 1 << 2;
407 const WEDNESDAY = 1 << 3;
409 const THURSDAY = 1 << 4;
411 const FRIDAY = 1 << 5;
413 const SATURDAY = 1 << 6;
415 }
416}
417
418impl ToTlv for DayPatternDayOfWeekBitmap {
419 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
420 self.bits().to_tlv(w, tag)
421 }
422}
423
424impl<'a> FromTlv<'a> for DayPatternDayOfWeekBitmap {
425 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
426 let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
427 Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
428 }
429}
430
431#[derive(Debug, Clone, Copy, PartialEq)]
433pub struct AuxiliaryLoadSwitchSettingsStruct {
434 pub number: u8,
436 pub required_state: AuxiliaryLoadSettingEnum,
438}
439
440impl ToTlv for AuxiliaryLoadSwitchSettingsStruct {
441 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
442 w.start_structure(tag)?;
443 self.number.to_tlv(w, Tag::Context(0))?;
444 self.required_state.to_tlv(w, Tag::Context(1))?;
445 w.end_container()
446 }
447}
448
449impl<'a> FromTlv<'a> for AuxiliaryLoadSwitchSettingsStruct {
450 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
451 if element.value.container() != Some(ContainerKind::Structure) {
452 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
453 }
454 let mut number = None;
455 let mut required_state = None;
456 loop {
457 let Some(field) = reader.next_element()? else {
458 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
459 };
460 if field.value == Value::EndOfContainer {
461 break;
462 }
463 match field.tag.context() {
464 Some(0) => number = Some(<u8>::from_tlv(reader, &field)?),
465 Some(1) => {
466 required_state = Some(<AuxiliaryLoadSettingEnum>::from_tlv(reader, &field)?)
467 }
468 _ => reader.skip_value(&field)?,
472 }
473 }
474 Ok(Self {
475 number: number.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
476 required_state: required_state
477 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
478 })
479 }
480}
481
482#[derive(Debug, Clone, Copy, PartialEq)]
484pub struct AuxiliaryLoadSwitchesSettingsStruct<'a> {
485 pub switch_states: TlvList<'a, AuxiliaryLoadSwitchSettingsStruct>,
487}
488
489impl<'a> ToTlv for AuxiliaryLoadSwitchesSettingsStruct<'a> {
490 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
491 w.start_structure(tag)?;
492 self.switch_states.to_tlv(w, Tag::Context(0))?;
493 w.end_container()
494 }
495}
496
497impl<'a> FromTlv<'a> for AuxiliaryLoadSwitchesSettingsStruct<'a> {
498 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
499 if element.value.container() != Some(ContainerKind::Structure) {
500 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
501 }
502 let mut switch_states = None;
503 loop {
504 let Some(field) = reader.next_element()? else {
505 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
506 };
507 if field.value == Value::EndOfContainer {
508 break;
509 }
510 match field.tag.context() {
511 Some(0) => {
512 switch_states = Some(
513 <TlvList<'a, AuxiliaryLoadSwitchSettingsStruct>>::from_tlv(reader, &field)?,
514 )
515 }
516 _ => reader.skip_value(&field)?,
520 }
521 }
522 Ok(Self {
523 switch_states: switch_states.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
524 })
525 }
526}
527
528#[derive(Debug, Clone, Copy, PartialEq)]
530pub struct CalendarPeriodStruct<'a> {
531 pub start_date: Nullable<u32>,
533 pub day_pattern_i_ds: TlvList<'a, u32>,
535}
536
537impl<'a> ToTlv for CalendarPeriodStruct<'a> {
538 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
539 w.start_structure(tag)?;
540 self.start_date.to_tlv(w, Tag::Context(0))?;
541 self.day_pattern_i_ds.to_tlv(w, Tag::Context(1))?;
542 w.end_container()
543 }
544}
545
546impl<'a> FromTlv<'a> for CalendarPeriodStruct<'a> {
547 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
548 if element.value.container() != Some(ContainerKind::Structure) {
549 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
550 }
551 let mut start_date = None;
552 let mut day_pattern_i_ds = None;
553 loop {
554 let Some(field) = reader.next_element()? else {
555 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
556 };
557 if field.value == Value::EndOfContainer {
558 break;
559 }
560 match field.tag.context() {
561 Some(0) => start_date = Some(<Nullable<u32>>::from_tlv(reader, &field)?),
562 Some(1) => day_pattern_i_ds = Some(<TlvList<'a, u32>>::from_tlv(reader, &field)?),
563 _ => reader.skip_value(&field)?,
567 }
568 }
569 Ok(Self {
570 start_date: start_date.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
571 day_pattern_i_ds: day_pattern_i_ds
572 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
573 })
574 }
575}
576
577#[derive(Debug, Clone, Copy, PartialEq)]
579pub struct DayEntryStruct {
580 pub day_entry_id: u32,
582 pub start_time: u16,
584 pub duration: Option<u16>,
586 pub randomization_offset: Option<i16>,
588 pub randomization_type: Option<DayEntryRandomizationTypeEnum>,
590}
591
592impl ToTlv for DayEntryStruct {
593 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
594 w.start_structure(tag)?;
595 self.day_entry_id.to_tlv(w, Tag::Context(0))?;
596 self.start_time.to_tlv(w, Tag::Context(1))?;
597 if let Some(value) = &self.duration {
598 value.to_tlv(w, Tag::Context(2))?;
599 }
600 if let Some(value) = &self.randomization_offset {
601 value.to_tlv(w, Tag::Context(3))?;
602 }
603 if let Some(value) = &self.randomization_type {
604 value.to_tlv(w, Tag::Context(4))?;
605 }
606 w.end_container()
607 }
608}
609
610impl<'a> FromTlv<'a> for DayEntryStruct {
611 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
612 if element.value.container() != Some(ContainerKind::Structure) {
613 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
614 }
615 let mut day_entry_id = None;
616 let mut start_time = None;
617 let mut duration = None;
618 let mut randomization_offset = None;
619 let mut randomization_type = None;
620 loop {
621 let Some(field) = reader.next_element()? else {
622 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
623 };
624 if field.value == Value::EndOfContainer {
625 break;
626 }
627 match field.tag.context() {
628 Some(0) => day_entry_id = Some(<u32>::from_tlv(reader, &field)?),
629 Some(1) => start_time = Some(<u16>::from_tlv(reader, &field)?),
630 Some(2) => duration = Some(<u16>::from_tlv(reader, &field)?),
631 Some(3) => randomization_offset = Some(<i16>::from_tlv(reader, &field)?),
632 Some(4) => {
633 randomization_type =
634 Some(<DayEntryRandomizationTypeEnum>::from_tlv(reader, &field)?)
635 }
636 _ => reader.skip_value(&field)?,
640 }
641 }
642 Ok(Self {
643 day_entry_id: day_entry_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
644 start_time: start_time.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
645 duration,
646 randomization_offset,
647 randomization_type,
648 })
649 }
650}
651
652#[derive(Debug, Clone, Copy, PartialEq)]
654pub struct DayPatternStruct<'a> {
655 pub day_pattern_id: u32,
657 pub days_of_week: DayPatternDayOfWeekBitmap,
659 pub day_entry_i_ds: TlvList<'a, u32>,
661}
662
663impl<'a> ToTlv for DayPatternStruct<'a> {
664 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
665 w.start_structure(tag)?;
666 self.day_pattern_id.to_tlv(w, Tag::Context(0))?;
667 self.days_of_week.to_tlv(w, Tag::Context(1))?;
668 self.day_entry_i_ds.to_tlv(w, Tag::Context(2))?;
669 w.end_container()
670 }
671}
672
673impl<'a> FromTlv<'a> for DayPatternStruct<'a> {
674 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
675 if element.value.container() != Some(ContainerKind::Structure) {
676 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
677 }
678 let mut day_pattern_id = None;
679 let mut days_of_week = None;
680 let mut day_entry_i_ds = None;
681 loop {
682 let Some(field) = reader.next_element()? else {
683 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
684 };
685 if field.value == Value::EndOfContainer {
686 break;
687 }
688 match field.tag.context() {
689 Some(0) => day_pattern_id = Some(<u32>::from_tlv(reader, &field)?),
690 Some(1) => {
691 days_of_week = Some(<DayPatternDayOfWeekBitmap>::from_tlv(reader, &field)?)
692 }
693 Some(2) => day_entry_i_ds = Some(<TlvList<'a, u32>>::from_tlv(reader, &field)?),
694 _ => reader.skip_value(&field)?,
698 }
699 }
700 Ok(Self {
701 day_pattern_id: day_pattern_id
702 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
703 days_of_week: days_of_week.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
704 day_entry_i_ds: day_entry_i_ds
705 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
706 })
707 }
708}
709
710#[derive(Debug, Clone, Copy, PartialEq)]
712pub struct DayStruct<'a> {
713 pub date: u32,
715 pub day_type: DayTypeEnum,
717 pub day_entry_i_ds: TlvList<'a, u32>,
719}
720
721impl<'a> ToTlv for DayStruct<'a> {
722 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
723 w.start_structure(tag)?;
724 self.date.to_tlv(w, Tag::Context(0))?;
725 self.day_type.to_tlv(w, Tag::Context(1))?;
726 self.day_entry_i_ds.to_tlv(w, Tag::Context(2))?;
727 w.end_container()
728 }
729}
730
731impl<'a> FromTlv<'a> for DayStruct<'a> {
732 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
733 if element.value.container() != Some(ContainerKind::Structure) {
734 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
735 }
736 let mut date = None;
737 let mut day_type = None;
738 let mut day_entry_i_ds = None;
739 loop {
740 let Some(field) = reader.next_element()? else {
741 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
742 };
743 if field.value == Value::EndOfContainer {
744 break;
745 }
746 match field.tag.context() {
747 Some(0) => date = Some(<u32>::from_tlv(reader, &field)?),
748 Some(1) => day_type = Some(<DayTypeEnum>::from_tlv(reader, &field)?),
749 Some(2) => day_entry_i_ds = Some(<TlvList<'a, u32>>::from_tlv(reader, &field)?),
750 _ => reader.skip_value(&field)?,
754 }
755 }
756 Ok(Self {
757 date: date.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
758 day_type: day_type.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
759 day_entry_i_ds: day_entry_i_ds
760 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
761 })
762 }
763}
764
765#[derive(Debug, Clone, Copy, PartialEq)]
767pub struct PeakPeriodStruct {
768 pub severity: PeakPeriodSeverityEnum,
770 pub peak_period: u16,
772}
773
774impl ToTlv for PeakPeriodStruct {
775 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
776 w.start_structure(tag)?;
777 self.severity.to_tlv(w, Tag::Context(0))?;
778 self.peak_period.to_tlv(w, Tag::Context(1))?;
779 w.end_container()
780 }
781}
782
783impl<'a> FromTlv<'a> for PeakPeriodStruct {
784 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
785 if element.value.container() != Some(ContainerKind::Structure) {
786 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
787 }
788 let mut severity = None;
789 let mut peak_period = None;
790 loop {
791 let Some(field) = reader.next_element()? else {
792 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
793 };
794 if field.value == Value::EndOfContainer {
795 break;
796 }
797 match field.tag.context() {
798 Some(0) => severity = Some(<PeakPeriodSeverityEnum>::from_tlv(reader, &field)?),
799 Some(1) => peak_period = Some(<u16>::from_tlv(reader, &field)?),
800 _ => reader.skip_value(&field)?,
804 }
805 }
806 Ok(Self {
807 severity: severity.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
808 peak_period: peak_period.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
809 })
810 }
811}
812
813#[derive(Debug, Clone, Copy, PartialEq)]
815pub struct TariffComponentStruct<'a> {
816 pub tariff_component_id: u32,
818 pub price: Option<Nullable<TariffPriceStruct>>,
820 pub friendly_credit: Option<bool>,
822 pub auxiliary_load: Option<AuxiliaryLoadSwitchSettingsStruct>,
824 pub peak_period: Option<PeakPeriodStruct>,
826 pub power_threshold: Option<crate::clusters::generated::globals::PowerThresholdStruct>,
828 pub threshold: Nullable<i64>,
830 pub label: Option<Nullable<&'a str>>,
832 pub predicted: Option<bool>,
834}
835
836impl<'a> ToTlv for TariffComponentStruct<'a> {
837 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
838 w.start_structure(tag)?;
839 self.tariff_component_id.to_tlv(w, Tag::Context(0))?;
840 if let Some(value) = &self.price {
841 value.to_tlv(w, Tag::Context(1))?;
842 }
843 if let Some(value) = &self.friendly_credit {
844 value.to_tlv(w, Tag::Context(2))?;
845 }
846 if let Some(value) = &self.auxiliary_load {
847 value.to_tlv(w, Tag::Context(3))?;
848 }
849 if let Some(value) = &self.peak_period {
850 value.to_tlv(w, Tag::Context(4))?;
851 }
852 if let Some(value) = &self.power_threshold {
853 value.to_tlv(w, Tag::Context(5))?;
854 }
855 self.threshold.to_tlv(w, Tag::Context(6))?;
856 if let Some(value) = &self.label {
857 value.to_tlv(w, Tag::Context(7))?;
858 }
859 if let Some(value) = &self.predicted {
860 value.to_tlv(w, Tag::Context(8))?;
861 }
862 w.end_container()
863 }
864}
865
866impl<'a> FromTlv<'a> for TariffComponentStruct<'a> {
867 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
868 if element.value.container() != Some(ContainerKind::Structure) {
869 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
870 }
871 let mut tariff_component_id = None;
872 let mut price = None;
873 let mut friendly_credit = None;
874 let mut auxiliary_load = None;
875 let mut peak_period = None;
876 let mut power_threshold = None;
877 let mut threshold = None;
878 let mut label = None;
879 let mut predicted = None;
880 loop {
881 let Some(field) = reader.next_element()? else {
882 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
883 };
884 if field.value == Value::EndOfContainer {
885 break;
886 }
887 match field.tag.context() {
888 Some(0) => tariff_component_id = Some(<u32>::from_tlv(reader, &field)?),
889 Some(1) => price = Some(<Nullable<TariffPriceStruct>>::from_tlv(reader, &field)?),
890 Some(2) => friendly_credit = Some(<bool>::from_tlv(reader, &field)?),
891 Some(3) => {
892 auxiliary_load = Some(<AuxiliaryLoadSwitchSettingsStruct>::from_tlv(
893 reader, &field,
894 )?)
895 }
896 Some(4) => peak_period = Some(<PeakPeriodStruct>::from_tlv(reader, &field)?),
897 Some(5) => {
898 power_threshold = Some(
899 <crate::clusters::generated::globals::PowerThresholdStruct>::from_tlv(
900 reader, &field,
901 )?,
902 )
903 }
904 Some(6) => threshold = Some(<Nullable<i64>>::from_tlv(reader, &field)?),
905 Some(7) => label = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
906 Some(8) => predicted = Some(<bool>::from_tlv(reader, &field)?),
907 _ => reader.skip_value(&field)?,
911 }
912 }
913 Ok(Self {
914 tariff_component_id: tariff_component_id
915 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
916 price,
917 friendly_credit,
918 auxiliary_load,
919 peak_period,
920 power_threshold,
921 threshold: threshold.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
922 label,
923 predicted,
924 })
925 }
926}
927
928#[derive(Debug, Clone, Copy, PartialEq)]
930pub struct TariffInformationStruct<'a> {
931 pub tariff_label: Nullable<&'a str>,
933 pub provider_name: Nullable<&'a str>,
935 pub currency: Option<Nullable<crate::clusters::generated::globals::CurrencyStruct>>,
937 pub block_mode: Nullable<BlockModeEnum>,
939}
940
941impl<'a> ToTlv for TariffInformationStruct<'a> {
942 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
943 w.start_structure(tag)?;
944 self.tariff_label.to_tlv(w, Tag::Context(0))?;
945 self.provider_name.to_tlv(w, Tag::Context(1))?;
946 if let Some(value) = &self.currency {
947 value.to_tlv(w, Tag::Context(2))?;
948 }
949 self.block_mode.to_tlv(w, Tag::Context(3))?;
950 w.end_container()
951 }
952}
953
954impl<'a> FromTlv<'a> for TariffInformationStruct<'a> {
955 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
956 if element.value.container() != Some(ContainerKind::Structure) {
957 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
958 }
959 let mut tariff_label = None;
960 let mut provider_name = None;
961 let mut currency = None;
962 let mut block_mode = None;
963 loop {
964 let Some(field) = reader.next_element()? else {
965 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
966 };
967 if field.value == Value::EndOfContainer {
968 break;
969 }
970 match field.tag.context() {
971 Some(0) => tariff_label = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
972 Some(1) => provider_name = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
973 Some(2) => {
974 currency = Some(<Nullable<
975 crate::clusters::generated::globals::CurrencyStruct,
976 >>::from_tlv(reader, &field)?)
977 }
978 Some(3) => block_mode = Some(<Nullable<BlockModeEnum>>::from_tlv(reader, &field)?),
979 _ => reader.skip_value(&field)?,
983 }
984 }
985 Ok(Self {
986 tariff_label: tariff_label.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
987 provider_name: provider_name.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
988 currency,
989 block_mode: block_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
990 })
991 }
992}
993
994#[derive(Debug, Clone, Copy, PartialEq)]
996pub struct TariffPeriodStruct<'a> {
997 pub label: Nullable<&'a str>,
999 pub day_entry_i_ds: TlvList<'a, u32>,
1001 pub tariff_component_i_ds: TlvList<'a, u32>,
1003}
1004
1005impl<'a> ToTlv for TariffPeriodStruct<'a> {
1006 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1007 w.start_structure(tag)?;
1008 self.label.to_tlv(w, Tag::Context(0))?;
1009 self.day_entry_i_ds.to_tlv(w, Tag::Context(1))?;
1010 self.tariff_component_i_ds.to_tlv(w, Tag::Context(2))?;
1011 w.end_container()
1012 }
1013}
1014
1015impl<'a> FromTlv<'a> for TariffPeriodStruct<'a> {
1016 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1017 if element.value.container() != Some(ContainerKind::Structure) {
1018 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1019 }
1020 let mut label = None;
1021 let mut day_entry_i_ds = None;
1022 let mut tariff_component_i_ds = None;
1023 loop {
1024 let Some(field) = reader.next_element()? else {
1025 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1026 };
1027 if field.value == Value::EndOfContainer {
1028 break;
1029 }
1030 match field.tag.context() {
1031 Some(0) => label = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
1032 Some(1) => day_entry_i_ds = Some(<TlvList<'a, u32>>::from_tlv(reader, &field)?),
1033 Some(2) => {
1034 tariff_component_i_ds = Some(<TlvList<'a, u32>>::from_tlv(reader, &field)?)
1035 }
1036 _ => reader.skip_value(&field)?,
1040 }
1041 }
1042 Ok(Self {
1043 label: label.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1044 day_entry_i_ds: day_entry_i_ds
1045 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1046 tariff_component_i_ds: tariff_component_i_ds
1047 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1048 })
1049 }
1050}
1051
1052#[derive(Debug, Clone, Copy, PartialEq)]
1054pub struct TariffPriceStruct {
1055 pub price_type: crate::clusters::generated::globals::TariffPriceTypeEnum,
1057 pub price: Option<i64>,
1059 pub price_level: Option<i16>,
1061}
1062
1063impl ToTlv for TariffPriceStruct {
1064 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1065 w.start_structure(tag)?;
1066 self.price_type.to_tlv(w, Tag::Context(0))?;
1067 if let Some(value) = &self.price {
1068 value.to_tlv(w, Tag::Context(1))?;
1069 }
1070 if let Some(value) = &self.price_level {
1071 value.to_tlv(w, Tag::Context(2))?;
1072 }
1073 w.end_container()
1074 }
1075}
1076
1077impl<'a> FromTlv<'a> for TariffPriceStruct {
1078 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1079 if element.value.container() != Some(ContainerKind::Structure) {
1080 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1081 }
1082 let mut price_type = None;
1083 let mut price = None;
1084 let mut price_level = None;
1085 loop {
1086 let Some(field) = reader.next_element()? else {
1087 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1088 };
1089 if field.value == Value::EndOfContainer {
1090 break;
1091 }
1092 match field.tag.context() {
1093 Some(0) => {
1094 price_type = Some(
1095 <crate::clusters::generated::globals::TariffPriceTypeEnum>::from_tlv(
1096 reader, &field,
1097 )?,
1098 )
1099 }
1100 Some(1) => price = Some(<i64>::from_tlv(reader, &field)?),
1101 Some(2) => price_level = Some(<i16>::from_tlv(reader, &field)?),
1102 _ => reader.skip_value(&field)?,
1106 }
1107 }
1108 Ok(Self {
1109 price_type: price_type.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1110 price,
1111 price_level,
1112 })
1113 }
1114}
1115
1116#[derive(Debug, Clone, Copy, PartialEq)]
1118pub struct GetTariffComponentFields {
1119 pub tariff_component_id: u32,
1121}
1122
1123impl ToTlv for GetTariffComponentFields {
1124 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1125 w.start_structure(tag)?;
1126 self.tariff_component_id.to_tlv(w, Tag::Context(0))?;
1127 w.end_container()
1128 }
1129}
1130
1131impl<'a> FromTlv<'a> for GetTariffComponentFields {
1132 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1133 if element.value.container() != Some(ContainerKind::Structure) {
1134 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1135 }
1136 let mut tariff_component_id = None;
1137 loop {
1138 let Some(field) = reader.next_element()? else {
1139 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1140 };
1141 if field.value == Value::EndOfContainer {
1142 break;
1143 }
1144 match field.tag.context() {
1145 Some(0) => tariff_component_id = Some(<u32>::from_tlv(reader, &field)?),
1146 _ => reader.skip_value(&field)?,
1150 }
1151 }
1152 Ok(Self {
1153 tariff_component_id: tariff_component_id
1154 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1155 })
1156 }
1157}
1158
1159#[derive(Debug, Clone, Copy, PartialEq)]
1161pub struct GetTariffComponentResponseFields<'a> {
1162 pub label: Nullable<&'a str>,
1164 pub day_entry_i_ds: TlvList<'a, u32>,
1166 pub tariff_component: TariffComponentStruct<'a>,
1168}
1169
1170impl<'a> ToTlv for GetTariffComponentResponseFields<'a> {
1171 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1172 w.start_structure(tag)?;
1173 self.label.to_tlv(w, Tag::Context(0))?;
1174 self.day_entry_i_ds.to_tlv(w, Tag::Context(1))?;
1175 self.tariff_component.to_tlv(w, Tag::Context(2))?;
1176 w.end_container()
1177 }
1178}
1179
1180impl<'a> FromTlv<'a> for GetTariffComponentResponseFields<'a> {
1181 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1182 if element.value.container() != Some(ContainerKind::Structure) {
1183 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1184 }
1185 let mut label = None;
1186 let mut day_entry_i_ds = None;
1187 let mut tariff_component = None;
1188 loop {
1189 let Some(field) = reader.next_element()? else {
1190 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1191 };
1192 if field.value == Value::EndOfContainer {
1193 break;
1194 }
1195 match field.tag.context() {
1196 Some(0) => label = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
1197 Some(1) => day_entry_i_ds = Some(<TlvList<'a, u32>>::from_tlv(reader, &field)?),
1198 Some(2) => {
1199 tariff_component = Some(<TariffComponentStruct<'a>>::from_tlv(reader, &field)?)
1200 }
1201 _ => reader.skip_value(&field)?,
1205 }
1206 }
1207 Ok(Self {
1208 label: label.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1209 day_entry_i_ds: day_entry_i_ds
1210 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1211 tariff_component: tariff_component
1212 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1213 })
1214 }
1215}
1216
1217#[derive(Debug, Clone, Copy, PartialEq)]
1219pub struct GetDayEntryFields {
1220 pub day_entry_id: u32,
1222}
1223
1224impl ToTlv for GetDayEntryFields {
1225 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1226 w.start_structure(tag)?;
1227 self.day_entry_id.to_tlv(w, Tag::Context(0))?;
1228 w.end_container()
1229 }
1230}
1231
1232impl<'a> FromTlv<'a> for GetDayEntryFields {
1233 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1234 if element.value.container() != Some(ContainerKind::Structure) {
1235 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1236 }
1237 let mut day_entry_id = None;
1238 loop {
1239 let Some(field) = reader.next_element()? else {
1240 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1241 };
1242 if field.value == Value::EndOfContainer {
1243 break;
1244 }
1245 match field.tag.context() {
1246 Some(0) => day_entry_id = Some(<u32>::from_tlv(reader, &field)?),
1247 _ => reader.skip_value(&field)?,
1251 }
1252 }
1253 Ok(Self {
1254 day_entry_id: day_entry_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1255 })
1256 }
1257}
1258
1259#[derive(Debug, Clone, Copy, PartialEq)]
1261pub struct GetDayEntryResponseFields {
1262 pub day_entry: DayEntryStruct,
1264}
1265
1266impl ToTlv for GetDayEntryResponseFields {
1267 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1268 w.start_structure(tag)?;
1269 self.day_entry.to_tlv(w, Tag::Context(0))?;
1270 w.end_container()
1271 }
1272}
1273
1274impl<'a> FromTlv<'a> for GetDayEntryResponseFields {
1275 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1276 if element.value.container() != Some(ContainerKind::Structure) {
1277 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1278 }
1279 let mut day_entry = None;
1280 loop {
1281 let Some(field) = reader.next_element()? else {
1282 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1283 };
1284 if field.value == Value::EndOfContainer {
1285 break;
1286 }
1287 match field.tag.context() {
1288 Some(0) => day_entry = Some(<DayEntryStruct>::from_tlv(reader, &field)?),
1289 _ => reader.skip_value(&field)?,
1293 }
1294 }
1295 Ok(Self {
1296 day_entry: day_entry.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1297 })
1298 }
1299}
1300
1301pub const ATTRIBUTES: &[Attribute] = &[
1303 Attribute {
1304 id: 0x0000,
1305 name: "TariffInfo",
1306 kind: "TariffInformationStruct",
1307 access: Access::read_only(Privilege::View),
1308 qualities: AttributeQualities::NULLABLE,
1309 reporting: Reporting::OnChange,
1310 conform: Conform::MANDATORY,
1311 },
1312 Attribute {
1313 id: 0x0001,
1314 name: "TariffUnit",
1315 kind: "TariffUnitEnum",
1316 access: Access::read_only(Privilege::View),
1317 qualities: AttributeQualities::NULLABLE,
1318 reporting: Reporting::OnChange,
1319 conform: Conform::MANDATORY,
1320 },
1321 Attribute {
1322 id: 0x0002,
1323 name: "StartDate",
1324 kind: "epoch-s",
1325 access: Access::read_only(Privilege::View),
1326 qualities: AttributeQualities::NULLABLE,
1327 reporting: Reporting::OnChange,
1328 conform: Conform::MANDATORY,
1329 },
1330 Attribute {
1331 id: 0x0003,
1332 name: "DayEntries",
1333 kind: "list[DayEntryStruct]",
1334 access: Access::read_only(Privilege::View),
1335 qualities: AttributeQualities::NULLABLE,
1336 reporting: Reporting::OnChange,
1337 conform: Conform::MANDATORY,
1338 },
1339 Attribute {
1340 id: 0x0004,
1341 name: "DayPatterns",
1342 kind: "list[DayPatternStruct]",
1343 access: Access::read_only(Privilege::View),
1344 qualities: AttributeQualities::NULLABLE,
1345 reporting: Reporting::OnChange,
1346 conform: Conform::MANDATORY,
1347 },
1348 Attribute {
1349 id: 0x0005,
1350 name: "CalendarPeriods",
1351 kind: "list[CalendarPeriodStruct]",
1352 access: Access::read_only(Privilege::View),
1353 qualities: AttributeQualities::NULLABLE,
1354 reporting: Reporting::OnChange,
1355 conform: Conform::MANDATORY,
1356 },
1357 Attribute {
1358 id: 0x0006,
1359 name: "IndividualDays",
1360 kind: "list[DayStruct]",
1361 access: Access::read_only(Privilege::View),
1362 qualities: AttributeQualities::NULLABLE,
1363 reporting: Reporting::OnChange,
1364 conform: Conform::MANDATORY,
1365 },
1366 Attribute {
1367 id: 0x0007,
1368 name: "CurrentDay",
1369 kind: "DayStruct",
1370 access: Access::read_only(Privilege::View),
1371 qualities: AttributeQualities::NULLABLE,
1372 reporting: Reporting::OnChange,
1373 conform: Conform::MANDATORY,
1374 },
1375 Attribute {
1376 id: 0x0008,
1377 name: "NextDay",
1378 kind: "DayStruct",
1379 access: Access::read_only(Privilege::View),
1380 qualities: AttributeQualities::NULLABLE,
1381 reporting: Reporting::OnChange,
1382 conform: Conform::MANDATORY,
1383 },
1384 Attribute {
1385 id: 0x0009,
1386 name: "CurrentDayEntry",
1387 kind: "DayEntryStruct",
1388 access: Access::read_only(Privilege::View),
1389 qualities: AttributeQualities::NULLABLE,
1390 reporting: Reporting::OnChange,
1391 conform: Conform::MANDATORY,
1392 },
1393 Attribute {
1394 id: 0x000A,
1395 name: "CurrentDayEntryDate",
1396 kind: "epoch-s",
1397 access: Access::read_only(Privilege::View),
1398 qualities: AttributeQualities::NULLABLE,
1399 reporting: Reporting::OnChange,
1400 conform: Conform::MANDATORY,
1401 },
1402 Attribute {
1403 id: 0x000B,
1404 name: "NextDayEntry",
1405 kind: "DayEntryStruct",
1406 access: Access::read_only(Privilege::View),
1407 qualities: AttributeQualities::NULLABLE,
1408 reporting: Reporting::OnChange,
1409 conform: Conform::MANDATORY,
1410 },
1411 Attribute {
1412 id: 0x000C,
1413 name: "NextDayEntryDate",
1414 kind: "epoch-s",
1415 access: Access::read_only(Privilege::View),
1416 qualities: AttributeQualities::NULLABLE,
1417 reporting: Reporting::OnChange,
1418 conform: Conform::MANDATORY,
1419 },
1420 Attribute {
1421 id: 0x000D,
1422 name: "TariffComponents",
1423 kind: "list[TariffComponentStruct]",
1424 access: Access::read_only(Privilege::View),
1425 qualities: AttributeQualities::NULLABLE,
1426 reporting: Reporting::OnChange,
1427 conform: Conform::MANDATORY,
1428 },
1429 Attribute {
1430 id: 0x000E,
1431 name: "TariffPeriods",
1432 kind: "list[TariffPeriodStruct]",
1433 access: Access::read_only(Privilege::View),
1434 qualities: AttributeQualities::NULLABLE,
1435 reporting: Reporting::OnChange,
1436 conform: Conform::MANDATORY,
1437 },
1438 Attribute {
1439 id: 0x000F,
1440 name: "CurrentTariffComponents",
1441 kind: "list[TariffComponentStruct]",
1442 access: Access::read_only(Privilege::View),
1443 qualities: AttributeQualities::NULLABLE,
1444 reporting: Reporting::OnChange,
1445 conform: Conform::MANDATORY,
1446 },
1447 Attribute {
1448 id: 0x0010,
1449 name: "NextTariffComponents",
1450 kind: "list[TariffComponentStruct]",
1451 access: Access::read_only(Privilege::View),
1452 qualities: AttributeQualities::NULLABLE,
1453 reporting: Reporting::OnChange,
1454 conform: Conform::MANDATORY,
1455 },
1456 Attribute {
1457 id: 0x0011,
1458 name: "DefaultRandomizationOffset",
1459 kind: "int16",
1460 access: Access::read_only(Privilege::View),
1461 qualities: AttributeQualities::NULLABLE,
1462 reporting: Reporting::OnChange,
1463 conform: Conform {
1464 clauses: &[Clause {
1465 verdict: Conformance::Mandatory,
1466 when: Condition::Feature(5),
1467 }],
1468 },
1469 },
1470 Attribute {
1471 id: 0x0012,
1472 name: "DefaultRandomizationType",
1473 kind: "DayEntryRandomizationTypeEnum",
1474 access: Access::read_only(Privilege::View),
1475 qualities: AttributeQualities::NULLABLE,
1476 reporting: Reporting::OnChange,
1477 conform: Conform {
1478 clauses: &[Clause {
1479 verdict: Conformance::Mandatory,
1480 when: Condition::Feature(5),
1481 }],
1482 },
1483 },
1484];
1485
1486pub const COMMANDS: &[Command] = &[
1488 Command {
1489 id: 0x00,
1490 name: "GetTariffComponent",
1491 to_server: true,
1492 response: Some(0x00),
1493 access: Access::invoke(Privilege::Operate),
1494 conform: Conform::MANDATORY,
1495 },
1496 Command {
1497 id: 0x00,
1498 name: "GetTariffComponentResponse",
1499 to_server: false,
1500 response: None,
1501 access: Access::invoke(Privilege::Operate),
1502 conform: Conform::MANDATORY,
1503 },
1504 Command {
1505 id: 0x01,
1506 name: "GetDayEntry",
1507 to_server: true,
1508 response: Some(0x01),
1509 access: Access::invoke(Privilege::Operate),
1510 conform: Conform::MANDATORY,
1511 },
1512 Command {
1513 id: 0x01,
1514 name: "GetDayEntryResponse",
1515 to_server: false,
1516 response: None,
1517 access: Access::invoke(Privilege::Operate),
1518 conform: Conform::MANDATORY,
1519 },
1520];
1521
1522pub const EVENTS: &[Event] = &[];
1524
1525pub const CLUSTER: Cluster = Cluster {
1527 id: ID,
1528 name: "Commodity Tariff",
1529 revision: REVISION,
1530 pics: "SETRF",
1531 derived_from: None,
1532 features: FEATURES,
1533 attributes: ATTRIBUTES,
1534 commands: COMMANDS,
1535 events: EVENTS,
1536};