zigbee2mqtt_types_vendor_kami/
lib.rs

1use serde::Deserialize;
2use serde::de::Unexpected;
3use serde::de;
4use serde::Deserializer;
5use zigbee2mqtt_types_base_types::LastSeen;
6/// kami:N20 [zigbee2mqtt link](https://www.zigbee2mqtt.io/devices/N20.html)
7///
8/// 
9#[cfg_attr(feature = "debug", derive(Debug))]
10#[cfg_attr(feature = "clone", derive(Clone))]
11#[derive(Deserialize)]
12pub struct ZigbeeN20 {
13    ///Triggered action (e.g. a button click)
14    pub action: ZigbeeN20Action,
15    ///Zigbee herdsman description: "Indicates if the contact is closed (= true) or open (= false)"
16    ///Boolean values can be an unintuitive way round: value_on = false and value_off = true, consider double checking Zigbee2MQTT to understand what they mean
17    pub contact: bool,
18    ///Link quality (signal strength)
19    pub linkquality: f64,
20    /// Optional last_seen type, set as a global zigbee2mqtt setting
21    pub last_seen: Option<LastSeen>,
22    /// Optional elapsed type
23    pub elapsed: Option<u64>,
24}
25#[cfg_attr(feature = "debug", derive(Debug))]
26#[cfg_attr(feature = "clone", derive(Clone))]
27#[derive(Deserialize, PartialEq)]
28pub enum ZigbeeN20Action {
29    #[serde(rename = "motion")]
30    Motion,
31}
32#[cfg(all(feature = "last_seen_epoch", feature = "last_seen_iso_8601"))]
33compile_error!{"Feature last_seen epoch and iso_8601 are mutually exclusive and cannot be enabled together.
34This was done because it is a global setting in zigbee2mqtt and therefor can't see a reason both would be enabled.
35If you have a any reason to have both ways enabled please submit an issue to https://gitlab.com/seam345/zigbee2mqtt-types/-/issues"}