1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
use serde::Deserialize;
use serde::de::Unexpected;
use serde::de;
use serde::Deserializer;
use zigbee2mqtt_types_base_types::LastSeen;
/// elko:316GLEDRF [zigbee2mqtt link](https://www.zigbee2mqtt.io/devices/316GLEDRF.html)
///
/// 
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize)]
pub struct Zigbee316gledrf {
    ///Brightness of this light
    pub brightness: f64,
    ///Link quality (signal strength)
    pub linkquality: f64,
    ///Controls the behavior when the device is powered on after power loss
    pub power_on_behavior: Zigbee316gledrfPoweronbehavior,
    ///Zigbee herdsman description: "On/off state of this light"
    ///The string values get converted into boolean with: ON = true and OFF = false
    #[serde(deserialize_with = "zigbee316gledrf_state_deserializer")]
    pub state: bool,
    /// Optional last_seen type, set as a global zigbee2mqtt setting
    pub last_seen: Option<LastSeen>,
    /// Optional elapsed type
    pub elapsed: Option<u64>,
}
/// Deserialize bool from String with custom value mapping
fn zigbee316gledrf_state_deserializer<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.as_ref() {
        "ON" => Ok(true),
        "OFF" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Value expected was either ON or OFF",
        )),
    }
}

/// elko:4523430 [zigbee2mqtt link](https://www.zigbee2mqtt.io/devices/4523430.html)
///
/// 
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize)]
pub struct Zigbee4523430 {
    ///Zigbee herdsman description: "Enables/disables physical input on the device"
    ///The string values get converted into boolean with: lock = true and unlock = false
    #[serde(deserialize_with = "zigbee4523430_child_lock_deserializer")]
    pub child_lock: bool,
    ///Displayed text on thermostat display (zone). Max 14 characters
    pub display_text: f64,
    ///Current temperature measured from the floor sensor
    pub floor_temp: f64,
    ///Zigbee herdsman description: "When frost guard is ON, it is activated when the thermostat is switched OFF with the ON/OFF button.At the same time, the display will fade and the text "Frostsikring x °C" appears in the display and remains until the thermostat is switched on again."
    ///The string values get converted into boolean with: on = true and off = false
    #[serde(deserialize_with = "zigbee4523430_frost_guard_deserializer")]
    pub frost_guard: bool,
    ///Link quality (signal strength)
    pub linkquality: f64,
    ///Load in W when heating is on (between 0-2000 W). The thermostat uses the value as input to the mean_power calculation.
    pub load: f64,
    ///Current temperature measured on the device
    pub local_temperature: f64,
    ///Offset to be used in the local_temperature
    pub local_temperature_calibration: f64,
    ///Set max floor temperature (between 20-35 °C) when "supervisor_floor" is set
    pub max_floor_temp: f64,
    ///Reports average power usage last 10 minutes
    pub mean_power: f64,
    ///Zigbee herdsman description: "Turn on or off night setting."
    ///The string values get converted into boolean with: on = true and off = false
    #[serde(deserialize_with = "zigbee4523430_night_switching_deserializer")]
    pub night_switching: bool,
    ///Temperature setpoint
    pub occupied_heating_setpoint: f64,
    ///Zigbee herdsman description: "Device in regulator or thermostat mode."
    ///The string values get converted into boolean with: regulator = true and thermostat = false
    #[serde(deserialize_with = "zigbee4523430_regulator_mode_deserializer")]
    pub regulator_mode: bool,
    ///When device is in regulator mode this controls the time between each in/out connection. When device is in thermostat mode this controls the  time between each in/out switch when measured temperature is within +-0.5 °C set temperature. Choose a long time for (slow) concrete floors and a short time for (quick) wooden floors.
    pub regulator_time: f64,
    ///The current running state
    pub running_state: Zigbee4523430Runningstate,
    ///Select temperature sensor to use
    pub sensor: Zigbee4523430Sensor,
    ///Mode of this device
    pub system_mode: Zigbee4523430Systemmode,
    /// Optional last_seen type, set as a global zigbee2mqtt setting
    pub last_seen: Option<LastSeen>,
    /// Optional elapsed type
    pub elapsed: Option<u64>,
}
/// Deserialize bool from String with custom value mapping
fn zigbee4523430_child_lock_deserializer<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.as_ref() {
        "lock" => Ok(true),
        "unlock" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Value expected was either lock or unlock",
        )),
    }
}


/// Deserialize bool from String with custom value mapping
fn zigbee4523430_frost_guard_deserializer<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.as_ref() {
        "on" => Ok(true),
        "off" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Value expected was either on or off",
        )),
    }
}


/// Deserialize bool from String with custom value mapping
fn zigbee4523430_night_switching_deserializer<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.as_ref() {
        "on" => Ok(true),
        "off" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Value expected was either on or off",
        )),
    }
}


/// Deserialize bool from String with custom value mapping
fn zigbee4523430_regulator_mode_deserializer<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.as_ref() {
        "regulator" => Ok(true),
        "thermostat" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Value expected was either regulator or thermostat",
        )),
    }
}

/// elko:EKO05806 [zigbee2mqtt link](https://www.zigbee2mqtt.io/devices/EKO05806.html)
///
/// 
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize)]
pub struct ZigbeeEko05806 {
    ///Triggered action (e.g. a button click)
    pub action: ZigbeeEko05806Action,
    ///Link quality (signal strength)
    pub linkquality: f64,
    /// Optional last_seen type, set as a global zigbee2mqtt setting
    pub last_seen: Option<LastSeen>,
    /// Optional elapsed type
    pub elapsed: Option<u64>,
}
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize, PartialEq)]
pub enum Zigbee316gledrfPoweronbehavior {
    #[serde(rename = "off")]
    Off,
    #[serde(rename = "on")]
    On,
    #[serde(rename = "previous")]
    Previous,
    #[serde(rename = "toggle")]
    Toggle,
}
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize, PartialEq)]
pub enum Zigbee4523430Runningstate {
    #[serde(rename = "heat")]
    Heat,
    #[serde(rename = "idle")]
    Idle,
}
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize, PartialEq)]
pub enum Zigbee4523430Sensor {
    #[serde(rename = "air")]
    Air,
    #[serde(rename = "floor")]
    Floor,
    #[serde(rename = "supervisor_floor")]
    SupervisorFloor,
}
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize, PartialEq)]
pub enum Zigbee4523430Systemmode {
    #[serde(rename = "heat")]
    Heat,
    #[serde(rename = "off")]
    Off,
}
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "clone", derive(Clone))]
#[derive(Deserialize, PartialEq)]
pub enum ZigbeeEko05806Action {
    #[serde(rename = "brightness_step_down")]
    BrightnessStepDown,
    #[serde(rename = "brightness_step_up")]
    BrightnessStepUp,
    #[serde(rename = "toggle")]
    Toggle,
}
#[cfg(all(feature = "last_seen_epoch", feature = "last_seen_iso_8601"))]
compile_error!{"Feature last_seen epoch and iso_8601 are mutually exclusive and cannot be enabled together.
This was done because it is a global setting in zigbee2mqtt and therefor can't see a reason both would be enabled.
If you have a any reason to have both ways enabled please submit an issue to https://gitlab.com/seam345/zigbee2mqtt-types/-/issues"}