#![allow(unused_imports)]
use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
use crate::dm::meta::{EventPriority, Reporting};
use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
use crate::error::Result;
use crate::im::{AttributeId, ClusterId, CommandId, EventId};
use crate::tlv::{
ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
};
pub const ID: ClusterId = 0x0201;
pub const REVISION: u16 = 11;
pub const PICS: &str = "TSTAT";
pub mod feature {
pub const HEATING: u32 = 1 << 0;
pub const COOLING: u32 = 1 << 1;
pub const OCCUPANCY: u32 = 1 << 2;
pub const SETBACK: u32 = 1 << 4;
pub const AUTO_MODE: u32 = 1 << 5;
pub const LOCAL_TEMPERATURE_NOT_EXPOSED: u32 = 1 << 6;
pub const MATTER_SCHEDULE_CONFIGURATION: u32 = 1 << 7;
pub const PRESETS: u32 = 1 << 8;
pub const EVENTS: u32 = 1 << 9;
pub const THERMOSTAT_SUGGESTIONS: u32 = 1 << 10;
}
pub const FEATURES: &[Feature] = &[
Feature {
bit: 0,
code: "HEAT",
name: "Heating",
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(5),
},
Clause {
verdict: Conformance::Optional,
when: Condition::Always,
},
],
},
},
Feature {
bit: 1,
code: "COOL",
name: "Cooling",
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(5),
},
Clause {
verdict: Conformance::Optional,
when: Condition::Always,
},
],
},
},
Feature {
bit: 2,
code: "OCC",
name: "Occupancy",
conform: Conform::OPTIONAL,
},
Feature {
bit: 4,
code: "SB",
name: "Setback",
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Feature {
bit: 5,
code: "AUTO",
name: "AutoMode",
conform: Conform::OPTIONAL,
},
Feature {
bit: 6,
code: "LTNE",
name: "LocalTemperatureNotExposed",
conform: Conform::OPTIONAL,
},
Feature {
bit: 7,
code: "MSCH",
name: "MatterScheduleConfiguration",
conform: Conform::OPTIONAL,
},
Feature {
bit: 8,
code: "PRES",
name: "Presets",
conform: Conform::OPTIONAL,
},
Feature {
bit: 9,
code: "TEVT",
name: "Events",
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Optional,
when: Condition::Always,
},
],
},
},
Feature {
bit: 10,
code: "TSUGGEST",
name: "ThermostatSuggestions",
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(8),
}],
},
},
];
pub mod attribute {
use crate::im::AttributeId;
pub const LOCAL_TEMPERATURE: AttributeId = 0x00;
pub const OUTDOOR_TEMPERATURE: AttributeId = 0x01;
pub const OCCUPANCY: AttributeId = 0x02;
pub const ABS_MIN_HEAT_SETPOINT_LIMIT: AttributeId = 0x03;
pub const ABS_MAX_HEAT_SETPOINT_LIMIT: AttributeId = 0x04;
pub const ABS_MIN_COOL_SETPOINT_LIMIT: AttributeId = 0x05;
pub const ABS_MAX_COOL_SETPOINT_LIMIT: AttributeId = 0x06;
pub const PI_COOLING_DEMAND: AttributeId = 0x07;
pub const PI_HEATING_DEMAND: AttributeId = 0x08;
pub const HVAC_SYSTEM_TYPE_CONFIGURATION: AttributeId = 0x09;
pub const LOCAL_TEMPERATURE_CALIBRATION: AttributeId = 0x10;
pub const OCCUPIED_COOLING_SETPOINT: AttributeId = 0x11;
pub const OCCUPIED_HEATING_SETPOINT: AttributeId = 0x12;
pub const UNOCCUPIED_COOLING_SETPOINT: AttributeId = 0x13;
pub const UNOCCUPIED_HEATING_SETPOINT: AttributeId = 0x14;
pub const MIN_HEAT_SETPOINT_LIMIT: AttributeId = 0x15;
pub const MAX_HEAT_SETPOINT_LIMIT: AttributeId = 0x16;
pub const MIN_COOL_SETPOINT_LIMIT: AttributeId = 0x17;
pub const MAX_COOL_SETPOINT_LIMIT: AttributeId = 0x18;
pub const MIN_SETPOINT_DEAD_BAND: AttributeId = 0x19;
pub const REMOTE_SENSING: AttributeId = 0x1A;
pub const CONTROL_SEQUENCE_OF_OPERATION: AttributeId = 0x1B;
pub const SYSTEM_MODE: AttributeId = 0x1C;
pub const THERMOSTAT_RUNNING_MODE: AttributeId = 0x1E;
pub const TEMPERATURE_SETPOINT_HOLD: AttributeId = 0x23;
pub const TEMPERATURE_SETPOINT_HOLD_DURATION: AttributeId = 0x24;
pub const THERMOSTAT_PROGRAMMING_OPERATION_MODE: AttributeId = 0x25;
pub const THERMOSTAT_RUNNING_STATE: AttributeId = 0x29;
pub const SETPOINT_CHANGE_SOURCE: AttributeId = 0x30;
pub const SETPOINT_CHANGE_AMOUNT: AttributeId = 0x31;
pub const SETPOINT_CHANGE_SOURCE_TIMESTAMP: AttributeId = 0x32;
pub const OCCUPIED_SETBACK: AttributeId = 0x34;
pub const OCCUPIED_SETBACK_MIN: AttributeId = 0x35;
pub const OCCUPIED_SETBACK_MAX: AttributeId = 0x36;
pub const UNOCCUPIED_SETBACK: AttributeId = 0x37;
pub const UNOCCUPIED_SETBACK_MIN: AttributeId = 0x38;
pub const UNOCCUPIED_SETBACK_MAX: AttributeId = 0x39;
pub const EMERGENCY_HEAT_DELTA: AttributeId = 0x3A;
pub const AC_TYPE: AttributeId = 0x40;
pub const AC_CAPACITY: AttributeId = 0x41;
pub const AC_REFRIGERANT_TYPE: AttributeId = 0x42;
pub const AC_COMPRESSOR_TYPE: AttributeId = 0x43;
pub const AC_ERROR_CODE: AttributeId = 0x44;
pub const AC_LOUVER_POSITION: AttributeId = 0x45;
pub const AC_COIL_TEMPERATURE: AttributeId = 0x46;
pub const AC_CAPACITY_FORMAT: AttributeId = 0x47;
pub const PRESET_TYPES: AttributeId = 0x48;
pub const SCHEDULE_TYPES: AttributeId = 0x49;
pub const NUMBER_OF_PRESETS: AttributeId = 0x4A;
pub const NUMBER_OF_SCHEDULES: AttributeId = 0x4B;
pub const NUMBER_OF_SCHEDULE_TRANSITIONS: AttributeId = 0x4C;
pub const NUMBER_OF_SCHEDULE_TRANSITION_PER_DAY: AttributeId = 0x4D;
pub const ACTIVE_PRESET_HANDLE: AttributeId = 0x4E;
pub const ACTIVE_SCHEDULE_HANDLE: AttributeId = 0x4F;
pub const PRESETS: AttributeId = 0x50;
pub const SCHEDULES: AttributeId = 0x51;
pub const SETPOINT_HOLD_EXPIRY_TIMESTAMP: AttributeId = 0x52;
pub const MAX_THERMOSTAT_SUGGESTIONS: AttributeId = 0x53;
pub const THERMOSTAT_SUGGESTIONS: AttributeId = 0x54;
pub const CURRENT_THERMOSTAT_SUGGESTION: AttributeId = 0x55;
pub const THERMOSTAT_SUGGESTION_NOT_FOLLOWING_REASON: AttributeId = 0x56;
}
pub mod command {
use crate::im::CommandId;
pub const SETPOINT_RAISE_LOWER: CommandId = 0x00;
pub const ADD_THERMOSTAT_SUGGESTION_RESPONSE: CommandId = 0x02;
pub const SET_ACTIVE_SCHEDULE_REQUEST: CommandId = 0x05;
pub const SET_ACTIVE_PRESET_REQUEST: CommandId = 0x06;
pub const ADD_THERMOSTAT_SUGGESTION: CommandId = 0x07;
pub const REMOVE_THERMOSTAT_SUGGESTION: CommandId = 0x08;
}
pub mod event {
use crate::im::EventId;
pub const SYSTEM_MODE_CHANGE: EventId = 0x00;
pub const LOCAL_TEMPERATURE_CHANGE: EventId = 0x01;
pub const OCCUPANCY_CHANGE: EventId = 0x02;
pub const SETPOINT_CHANGE: EventId = 0x03;
pub const RUNNING_STATE_CHANGE: EventId = 0x04;
pub const RUNNING_MODE_CHANGE: EventId = 0x05;
pub const ACTIVE_SCHEDULE_CHANGE: EventId = 0x06;
pub const ACTIVE_PRESET_CHANGE: EventId = 0x07;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ACCapacityFormatEnum {
BTUh = 0,
}
impl ACCapacityFormatEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::BTUh),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ACCapacityFormatEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ACCapacityFormatEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ACCompressorTypeEnum {
Unknown = 0,
T1 = 1,
T2 = 2,
T3 = 3,
}
impl ACCompressorTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Unknown),
1 => Some(Self::T1),
2 => Some(Self::T2),
3 => Some(Self::T3),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ACCompressorTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ACCompressorTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ACLouverPositionEnum {
Closed = 1,
Open = 2,
Quarter = 3,
Half = 4,
ThreeQuarters = 5,
}
impl ACLouverPositionEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
1 => Some(Self::Closed),
2 => Some(Self::Open),
3 => Some(Self::Quarter),
4 => Some(Self::Half),
5 => Some(Self::ThreeQuarters),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ACLouverPositionEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ACLouverPositionEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ACRefrigerantTypeEnum {
Unknown = 0,
R22 = 1,
R410A = 2,
R407C = 3,
}
impl ACRefrigerantTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Unknown),
1 => Some(Self::R22),
2 => Some(Self::R410A),
3 => Some(Self::R407C),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ACRefrigerantTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ACRefrigerantTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ACTypeEnum {
Unknown = 0,
CoolingFixed = 1,
HeatPumpFixed = 2,
CoolingInverter = 3,
HeatPumpInverter = 4,
}
impl ACTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Unknown),
1 => Some(Self::CoolingFixed),
2 => Some(Self::HeatPumpFixed),
3 => Some(Self::CoolingInverter),
4 => Some(Self::HeatPumpInverter),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ACTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ACTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ControlSequenceOfOperationEnum {
CoolingOnly = 0,
CoolingWithReheat = 1,
HeatingOnly = 2,
HeatingWithReheat = 3,
CoolingAndHeating = 4,
CoolingAndHeatingWithReheat = 5,
}
impl ControlSequenceOfOperationEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::CoolingOnly),
1 => Some(Self::CoolingWithReheat),
2 => Some(Self::HeatingOnly),
3 => Some(Self::HeatingWithReheat),
4 => Some(Self::CoolingAndHeating),
5 => Some(Self::CoolingAndHeatingWithReheat),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ControlSequenceOfOperationEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ControlSequenceOfOperationEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum PresetScenarioEnum {
Occupied = 1,
Unoccupied = 2,
Sleep = 3,
Wake = 4,
Vacation = 5,
GoingToSleep = 6,
UserDefined = 254,
}
impl PresetScenarioEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
1 => Some(Self::Occupied),
2 => Some(Self::Unoccupied),
3 => Some(Self::Sleep),
4 => Some(Self::Wake),
5 => Some(Self::Vacation),
6 => Some(Self::GoingToSleep),
254 => Some(Self::UserDefined),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for PresetScenarioEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for PresetScenarioEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum SetpointChangeSourceEnum {
Manual = 0,
Schedule = 1,
External = 2,
}
impl SetpointChangeSourceEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Manual),
1 => Some(Self::Schedule),
2 => Some(Self::External),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for SetpointChangeSourceEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for SetpointChangeSourceEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum SetpointRaiseLowerModeEnum {
Heat = 0,
Cool = 1,
Both = 2,
}
impl SetpointRaiseLowerModeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Heat),
1 => Some(Self::Cool),
2 => Some(Self::Both),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for SetpointRaiseLowerModeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for SetpointRaiseLowerModeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum StartOfWeekEnum {
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
}
impl StartOfWeekEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Sunday),
1 => Some(Self::Monday),
2 => Some(Self::Tuesday),
3 => Some(Self::Wednesday),
4 => Some(Self::Thursday),
5 => Some(Self::Friday),
6 => Some(Self::Saturday),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for StartOfWeekEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for StartOfWeekEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum SystemModeEnum {
Off = 0,
Auto = 1,
Cool = 3,
Heat = 4,
EmergencyHeat = 5,
Precooling = 6,
FanOnly = 7,
Dry = 8,
Sleep = 9,
}
impl SystemModeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Off),
1 => Some(Self::Auto),
3 => Some(Self::Cool),
4 => Some(Self::Heat),
5 => Some(Self::EmergencyHeat),
6 => Some(Self::Precooling),
7 => Some(Self::FanOnly),
8 => Some(Self::Dry),
9 => Some(Self::Sleep),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for SystemModeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for SystemModeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum TemperatureSetpointHoldEnum {
SetpointHoldOff = 0,
SetpointHoldOn = 1,
}
impl TemperatureSetpointHoldEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::SetpointHoldOff),
1 => Some(Self::SetpointHoldOn),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for TemperatureSetpointHoldEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for TemperatureSetpointHoldEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ThermostatRunningModeEnum {
Off = 0,
Cool = 3,
Heat = 4,
}
impl ThermostatRunningModeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Off),
3 => Some(Self::Cool),
4 => Some(Self::Heat),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ThermostatRunningModeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ThermostatRunningModeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct ACErrorCodeBitmap: u8 {
const COMPRESSOR_FAIL = 1 << 0;
const ROOM_SENSOR_FAIL = 1 << 1;
const OUTDOOR_SENSOR_FAIL = 1 << 2;
const COIL_SENSOR_FAIL = 1 << 3;
const FAN_FAIL = 1 << 4;
}
}
impl ToTlv for ACErrorCodeBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ACErrorCodeBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct OccupancyBitmap: u8 {
const OCCUPIED = 1 << 0;
}
}
impl ToTlv for OccupancyBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for OccupancyBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct PresetTypeFeaturesBitmap: u8 {
const AUTOMATIC = 1 << 0;
const SUPPORTS_NAMES = 1 << 1;
}
}
impl ToTlv for PresetTypeFeaturesBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for PresetTypeFeaturesBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct RelayStateBitmap: u8 {
const HEAT = 1 << 0;
const COOL = 1 << 1;
const FAN = 1 << 2;
const HEAT_STAGE2 = 1 << 3;
const COOL_STAGE2 = 1 << 4;
const FAN_STAGE2 = 1 << 5;
const FAN_STAGE3 = 1 << 6;
}
}
impl ToTlv for RelayStateBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for RelayStateBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct RemoteSensingBitmap: u8 {
const LOCAL_TEMPERATURE = 1 << 0;
const OUTDOOR_TEMPERATURE = 1 << 1;
const OCCUPANCY = 1 << 2;
}
}
impl ToTlv for RemoteSensingBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for RemoteSensingBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct ScheduleDayOfWeekBitmap: u8 {
const SUNDAY = 1 << 0;
const MONDAY = 1 << 1;
const TUESDAY = 1 << 2;
const WEDNESDAY = 1 << 3;
const THURSDAY = 1 << 4;
const FRIDAY = 1 << 5;
const SATURDAY = 1 << 6;
const AWAY = 1 << 7;
}
}
impl ToTlv for ScheduleDayOfWeekBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ScheduleDayOfWeekBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct ScheduleModeBitmap: u8 {
const HEAT_SETPOINT_PRESENT = 1 << 0;
const COOL_SETPOINT_PRESENT = 1 << 1;
}
}
impl ToTlv for ScheduleModeBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ScheduleModeBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct ScheduleTypeFeaturesBitmap: u8 {
const SUPPORTS_PRESETS = 1 << 0;
const SUPPORTS_SETPOINTS = 1 << 1;
const SUPPORTS_NAMES = 1 << 2;
const SUPPORTS_OFF = 1 << 3;
}
}
impl ToTlv for ScheduleTypeFeaturesBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ScheduleTypeFeaturesBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct ThermostatSuggestionNotFollowingReasonBitmap: u8 {
const DEMAND_RESPONSE_EVENT = 1 << 0;
const ONGOING_HOLD = 1 << 1;
const SCHEDULE = 1 << 2;
const OCCUPANCY = 1 << 3;
const VACATION_MODE = 1 << 4;
const TIME_OF_USE_COST_SAVINGS = 1 << 5;
const PRE_COOLING_OR_PRE_HEATING = 1 << 6;
const CONFLICTING_SUGGESTIONS = 1 << 7;
}
}
impl ToTlv for ThermostatSuggestionNotFollowingReasonBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ThermostatSuggestionNotFollowingReasonBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct PresetStruct<'a> {
pub preset_handle: Nullable<&'a [u8]>,
pub preset_scenario: PresetScenarioEnum,
pub name: Option<Nullable<&'a str>>,
pub cooling_setpoint: Option<i16>,
pub heating_setpoint: Option<i16>,
pub built_in: Nullable<bool>,
}
impl<'a> ToTlv for PresetStruct<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.preset_handle.to_tlv(w, Tag::Context(0))?;
self.preset_scenario.to_tlv(w, Tag::Context(1))?;
if let Some(value) = &self.name {
value.to_tlv(w, Tag::Context(2))?;
}
if let Some(value) = &self.cooling_setpoint {
value.to_tlv(w, Tag::Context(3))?;
}
if let Some(value) = &self.heating_setpoint {
value.to_tlv(w, Tag::Context(4))?;
}
self.built_in.to_tlv(w, Tag::Context(5))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for PresetStruct<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut preset_handle = None;
let mut preset_scenario = None;
let mut name = None;
let mut cooling_setpoint = None;
let mut heating_setpoint = None;
let mut built_in = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => preset_handle = Some(<Nullable<&'a [u8]>>::from_tlv(reader, &field)?),
Some(1) => preset_scenario = Some(<PresetScenarioEnum>::from_tlv(reader, &field)?),
Some(2) => name = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
Some(3) => cooling_setpoint = Some(<i16>::from_tlv(reader, &field)?),
Some(4) => heating_setpoint = Some(<i16>::from_tlv(reader, &field)?),
Some(5) => built_in = Some(<Nullable<bool>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
preset_handle: preset_handle.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
preset_scenario: preset_scenario
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
name,
cooling_setpoint,
heating_setpoint,
built_in: built_in.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct PresetTypeStruct {
pub preset_scenario: PresetScenarioEnum,
pub number_of_presets: u8,
pub preset_type_features: PresetTypeFeaturesBitmap,
}
impl ToTlv for PresetTypeStruct {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.preset_scenario.to_tlv(w, Tag::Context(0))?;
self.number_of_presets.to_tlv(w, Tag::Context(1))?;
self.preset_type_features.to_tlv(w, Tag::Context(2))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for PresetTypeStruct {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut preset_scenario = None;
let mut number_of_presets = None;
let mut preset_type_features = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => preset_scenario = Some(<PresetScenarioEnum>::from_tlv(reader, &field)?),
Some(1) => number_of_presets = Some(<u8>::from_tlv(reader, &field)?),
Some(2) => {
preset_type_features =
Some(<PresetTypeFeaturesBitmap>::from_tlv(reader, &field)?)
}
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
preset_scenario: preset_scenario
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
number_of_presets: number_of_presets
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
preset_type_features: preset_type_features
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ScheduleStruct<'a> {
pub schedule_handle: Nullable<&'a [u8]>,
pub system_mode: SystemModeEnum,
pub name: Option<&'a str>,
pub preset_handle: Option<&'a [u8]>,
pub transitions: TlvList<'a, ScheduleTransitionStruct<'a>>,
pub built_in: Nullable<bool>,
}
impl<'a> ToTlv for ScheduleStruct<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.schedule_handle.to_tlv(w, Tag::Context(0))?;
self.system_mode.to_tlv(w, Tag::Context(1))?;
if let Some(value) = &self.name {
value.to_tlv(w, Tag::Context(2))?;
}
if let Some(value) = &self.preset_handle {
value.to_tlv(w, Tag::Context(3))?;
}
self.transitions.to_tlv(w, Tag::Context(4))?;
self.built_in.to_tlv(w, Tag::Context(5))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ScheduleStruct<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut schedule_handle = None;
let mut system_mode = None;
let mut name = None;
let mut preset_handle = None;
let mut transitions = None;
let mut built_in = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => schedule_handle = Some(<Nullable<&'a [u8]>>::from_tlv(reader, &field)?),
Some(1) => system_mode = Some(<SystemModeEnum>::from_tlv(reader, &field)?),
Some(2) => name = Some(<&'a str>::from_tlv(reader, &field)?),
Some(3) => preset_handle = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(4) => {
transitions = Some(<TlvList<'a, ScheduleTransitionStruct<'a>>>::from_tlv(
reader, &field,
)?)
}
Some(5) => built_in = Some(<Nullable<bool>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
schedule_handle: schedule_handle
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
system_mode: system_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
name,
preset_handle,
transitions: transitions.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
built_in: built_in.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ScheduleTransitionStruct<'a> {
pub day_of_week: ScheduleDayOfWeekBitmap,
pub transition_time: u16,
pub preset_handle: Option<&'a [u8]>,
pub system_mode: Option<SystemModeEnum>,
pub cooling_setpoint: Option<i16>,
pub heating_setpoint: Option<i16>,
}
impl<'a> ToTlv for ScheduleTransitionStruct<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.day_of_week.to_tlv(w, Tag::Context(0))?;
self.transition_time.to_tlv(w, Tag::Context(1))?;
if let Some(value) = &self.preset_handle {
value.to_tlv(w, Tag::Context(2))?;
}
if let Some(value) = &self.system_mode {
value.to_tlv(w, Tag::Context(3))?;
}
if let Some(value) = &self.cooling_setpoint {
value.to_tlv(w, Tag::Context(4))?;
}
if let Some(value) = &self.heating_setpoint {
value.to_tlv(w, Tag::Context(5))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for ScheduleTransitionStruct<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut day_of_week = None;
let mut transition_time = None;
let mut preset_handle = None;
let mut system_mode = None;
let mut cooling_setpoint = None;
let mut heating_setpoint = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => day_of_week = Some(<ScheduleDayOfWeekBitmap>::from_tlv(reader, &field)?),
Some(1) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
Some(2) => preset_handle = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(3) => system_mode = Some(<SystemModeEnum>::from_tlv(reader, &field)?),
Some(4) => cooling_setpoint = Some(<i16>::from_tlv(reader, &field)?),
Some(5) => heating_setpoint = Some(<i16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
day_of_week: day_of_week.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
transition_time: transition_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
preset_handle,
system_mode,
cooling_setpoint,
heating_setpoint,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ScheduleTypeStruct {
pub system_mode: SystemModeEnum,
pub number_of_schedules: u8,
pub schedule_type_features: ScheduleTypeFeaturesBitmap,
}
impl ToTlv for ScheduleTypeStruct {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.system_mode.to_tlv(w, Tag::Context(0))?;
self.number_of_schedules.to_tlv(w, Tag::Context(1))?;
self.schedule_type_features.to_tlv(w, Tag::Context(2))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ScheduleTypeStruct {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut system_mode = None;
let mut number_of_schedules = None;
let mut schedule_type_features = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => system_mode = Some(<SystemModeEnum>::from_tlv(reader, &field)?),
Some(1) => number_of_schedules = Some(<u8>::from_tlv(reader, &field)?),
Some(2) => {
schedule_type_features =
Some(<ScheduleTypeFeaturesBitmap>::from_tlv(reader, &field)?)
}
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
system_mode: system_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
number_of_schedules: number_of_schedules
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
schedule_type_features: schedule_type_features
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ThermostatSuggestionStruct<'a> {
pub unique_id: u8,
pub preset_handle: &'a [u8],
pub effective_time: u32,
pub expiration_time: u32,
}
impl<'a> ToTlv for ThermostatSuggestionStruct<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.unique_id.to_tlv(w, Tag::Context(0))?;
self.preset_handle.to_tlv(w, Tag::Context(1))?;
self.effective_time.to_tlv(w, Tag::Context(2))?;
self.expiration_time.to_tlv(w, Tag::Context(3))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ThermostatSuggestionStruct<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut unique_id = None;
let mut preset_handle = None;
let mut effective_time = None;
let mut expiration_time = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => unique_id = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => preset_handle = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(2) => effective_time = Some(<u32>::from_tlv(reader, &field)?),
Some(3) => expiration_time = Some(<u32>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
unique_id: unique_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
preset_handle: preset_handle.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
effective_time: effective_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
expiration_time: expiration_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct WeeklyScheduleTransitionStruct {
pub transition_time: u16,
pub heat_setpoint: Nullable<i16>,
pub cool_setpoint: Nullable<i16>,
}
impl ToTlv for WeeklyScheduleTransitionStruct {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.transition_time.to_tlv(w, Tag::Context(0))?;
self.heat_setpoint.to_tlv(w, Tag::Context(1))?;
self.cool_setpoint.to_tlv(w, Tag::Context(2))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for WeeklyScheduleTransitionStruct {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut transition_time = None;
let mut heat_setpoint = None;
let mut cool_setpoint = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
Some(1) => heat_setpoint = Some(<Nullable<i16>>::from_tlv(reader, &field)?),
Some(2) => cool_setpoint = Some(<Nullable<i16>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
transition_time: transition_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
heat_setpoint: heat_setpoint.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
cool_setpoint: cool_setpoint.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetpointRaiseLowerFields {
pub mode: SetpointRaiseLowerModeEnum,
pub amount: i8,
}
impl ToTlv for SetpointRaiseLowerFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.mode.to_tlv(w, Tag::Context(0))?;
self.amount.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetpointRaiseLowerFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut mode = None;
let mut amount = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => mode = Some(<SetpointRaiseLowerModeEnum>::from_tlv(reader, &field)?),
Some(1) => amount = Some(<i8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
mode: mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
amount: amount.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct AddThermostatSuggestionResponseFields {
pub unique_id: u8,
}
impl ToTlv for AddThermostatSuggestionResponseFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.unique_id.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for AddThermostatSuggestionResponseFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut unique_id = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => unique_id = Some(<u8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
unique_id: unique_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetActiveScheduleRequestFields<'a> {
pub schedule_handle: &'a [u8],
}
impl<'a> ToTlv for SetActiveScheduleRequestFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.schedule_handle.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetActiveScheduleRequestFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut schedule_handle = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => schedule_handle = Some(<&'a [u8]>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
schedule_handle: schedule_handle
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetActivePresetRequestFields<'a> {
pub preset_handle: Nullable<&'a [u8]>,
}
impl<'a> ToTlv for SetActivePresetRequestFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.preset_handle.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetActivePresetRequestFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut preset_handle = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => preset_handle = Some(<Nullable<&'a [u8]>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
preset_handle: preset_handle.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct AddThermostatSuggestionFields<'a> {
pub preset_handle: &'a [u8],
pub effective_time: Nullable<u32>,
pub expiration_in_minutes: u16,
}
impl<'a> ToTlv for AddThermostatSuggestionFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.preset_handle.to_tlv(w, Tag::Context(0))?;
self.effective_time.to_tlv(w, Tag::Context(1))?;
self.expiration_in_minutes.to_tlv(w, Tag::Context(2))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for AddThermostatSuggestionFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut preset_handle = None;
let mut effective_time = None;
let mut expiration_in_minutes = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => preset_handle = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(1) => effective_time = Some(<Nullable<u32>>::from_tlv(reader, &field)?),
Some(2) => expiration_in_minutes = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
preset_handle: preset_handle.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
effective_time: effective_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
expiration_in_minutes: expiration_in_minutes
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct RemoveThermostatSuggestionFields {
pub unique_id: u8,
}
impl ToTlv for RemoveThermostatSuggestionFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.unique_id.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for RemoveThermostatSuggestionFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut unique_id = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => unique_id = Some(<u8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
unique_id: unique_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
pub const ATTRIBUTES: &[Attribute] = &[
Attribute {
id: 0x0000,
name: "LocalTemperature",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0001,
name: "OutdoorTemperature",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0002,
name: "Occupancy",
kind: "OccupancyBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(2),
}],
},
},
Attribute {
id: 0x0003,
name: "AbsMinHeatSetpointLimit",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0004,
name: "AbsMaxHeatSetpointLimit",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0005,
name: "AbsMinCoolSetpointLimit",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x0006,
name: "AbsMaxCoolSetpointLimit",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x0007,
name: "PICoolingDemand",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0008,
name: "PIHeatingDemand",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0009,
name: "HVACSystemTypeConfiguration",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0010,
name: "LocalTemperatureCalibration",
kind: "SignedTemperature",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Not(&Condition::Feature(6)),
}],
},
},
Attribute {
id: 0x0011,
name: "OccupiedCoolingSetpoint",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Operate),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x0012,
name: "OccupiedHeatingSetpoint",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Operate),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0013,
name: "UnoccupiedCoolingSetpoint",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Operate),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(1), Condition::Feature(2)]),
}],
},
},
Attribute {
id: 0x0014,
name: "UnoccupiedHeatingSetpoint",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Operate),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(0), Condition::Feature(2)]),
}],
},
},
Attribute {
id: 0x0015,
name: "MinHeatSetpointLimit",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0016,
name: "MaxHeatSetpointLimit",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0017,
name: "MinCoolSetpointLimit",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x0018,
name: "MaxCoolSetpointLimit",
kind: "temperature",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x0019,
name: "MinSetpointDeadBand",
kind: "SignedTemperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(5),
}],
},
},
Attribute {
id: 0x001A,
name: "RemoteSensing",
kind: "RemoteSensingBitmap",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x001B,
name: "ControlSequenceOfOperation",
kind: "ControlSequenceOfOperationEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x001C,
name: "SystemMode",
kind: "SystemModeEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x001E,
name: "ThermostatRunningMode",
kind: "ThermostatRunningModeEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(9), Condition::Feature(5)]),
},
Clause {
verdict: Conformance::Optional,
when: Condition::Feature(5),
},
],
},
},
Attribute {
id: 0x0023,
name: "TemperatureSetpointHold",
kind: "TemperatureSetpointHoldEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0024,
name: "TemperatureSetpointHoldDuration",
kind: "uint16",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0025,
name: "ThermostatProgrammingOperationMode",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0029,
name: "ThermostatRunningState",
kind: "RelayStateBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0030,
name: "SetpointChangeSource",
kind: "SetpointChangeSourceEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0031,
name: "SetpointChangeAmount",
kind: "int16s",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0032,
name: "SetpointChangeSourceTimestamp",
kind: "epoch-s",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0034,
name: "OccupiedSetback",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0035,
name: "OccupiedSetbackMin",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0036,
name: "OccupiedSetbackMax",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0037,
name: "UnoccupiedSetback",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0038,
name: "UnoccupiedSetbackMin",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0039,
name: "UnoccupiedSetbackMax",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x003A,
name: "EmergencyHeatDelta",
kind: "UnsignedTemperature",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0040,
name: "ACType",
kind: "ACTypeEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0041,
name: "ACCapacity",
kind: "uint16",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0042,
name: "ACRefrigerantType",
kind: "ACRefrigerantTypeEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0043,
name: "ACCompressorType",
kind: "ACCompressorTypeEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0044,
name: "ACErrorCode",
kind: "ACErrorCodeBitmap",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0045,
name: "ACLouverPosition",
kind: "ACLouverPositionEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0046,
name: "ACCoilTemperature",
kind: "temperature",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0047,
name: "ACCapacityFormat",
kind: "ACCapacityFormatEnum",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0048,
name: "PresetTypes",
kind: "list[PresetTypeStruct]",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x0049,
name: "ScheduleTypes",
kind: "list[ScheduleTypeStruct]",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Attribute {
id: 0x004A,
name: "NumberOfPresets",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x004B,
name: "NumberOfSchedules",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Attribute {
id: 0x004C,
name: "NumberOfScheduleTransitions",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Attribute {
id: 0x004D,
name: "NumberOfScheduleTransitionPerDay",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Attribute {
id: 0x004E,
name: "ActivePresetHandle",
kind: "octstr",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x004F,
name: "ActiveScheduleHandle",
kind: "octstr",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Attribute {
id: 0x0050,
name: "Presets",
kind: "list[PresetStruct]",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::ATOMIC),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x0051,
name: "Schedules",
kind: "list[ScheduleStruct]",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::ATOMIC),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Attribute {
id: 0x0052,
name: "SetpointHoldExpiryTimestamp",
kind: "epoch-s",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0053,
name: "MaxThermostatSuggestions",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Attribute {
id: 0x0054,
name: "ThermostatSuggestions",
kind: "list[ThermostatSuggestionStruct]",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NON_VOLATILE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Attribute {
id: 0x0055,
name: "CurrentThermostatSuggestion",
kind: "ThermostatSuggestionStruct",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Attribute {
id: 0x0056,
name: "ThermostatSuggestionNotFollowingReason",
kind: "ThermostatSuggestionNotFollowingReasonBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
];
pub const COMMANDS: &[Command] = &[
Command {
id: 0x00,
name: "SetpointRaiseLower",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x02,
name: "AddThermostatSuggestionResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Command {
id: 0x05,
name: "SetActiveScheduleRequest",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(7),
}],
},
},
Command {
id: 0x06,
name: "SetActivePresetRequest",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x07,
name: "AddThermostatSuggestion",
to_server: true,
response: Some(0x02),
access: Access::invoke(Privilege::Manage),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Command {
id: 0x08,
name: "RemoveThermostatSuggestion",
to_server: true,
response: None,
access: Access::invoke(Privilege::Manage),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
];
pub const EVENTS: &[Event] = &[
Event {
id: 0x00,
name: "SystemModeChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(9),
},
],
},
},
Event {
id: 0x01,
name: "LocalTemperatureChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[
Condition::Feature(9),
Condition::Not(&Condition::Feature(6)),
]),
},
],
},
},
Event {
id: 0x02,
name: "OccupancyChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(9), Condition::Feature(2)]),
},
],
},
},
Event {
id: 0x03,
name: "SetpointChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(9),
},
],
},
},
Event {
id: 0x04,
name: "RunningStateChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(9),
},
],
},
},
Event {
id: 0x05,
name: "RunningModeChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(9), Condition::Feature(5)]),
},
],
},
},
Event {
id: 0x06,
name: "ActiveScheduleChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(9), Condition::Feature(7)]),
},
],
},
},
Event {
id: 0x07,
name: "ActivePresetChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(9), Condition::Feature(8)]),
},
],
},
},
];
pub const CLUSTER: Cluster = Cluster {
id: ID,
name: "Thermostat",
revision: REVISION,
pics: "TSTAT",
derived_from: None,
features: FEATURES,
attributes: ATTRIBUTES,
commands: COMMANDS,
events: EVENTS,
};