pub fn payload(device_id: &str, tt: TuyaType, state: &str) -> Payload {
    Payload::Struct(PayloadStruct {
        dev_id: device_id.to_string(),
        gw_id: Some(device_id.to_string()),
        uid: None,
        t: Some(
            SystemTime::now()
                .duration_since(SystemTime::UNIX_EPOCH)
                .unwrap()
                .as_secs() as u32,
        ),
        dps: dps(tt, state),
    })
}
// Convenience method to create a valid Tuya style payload from a device ID and a state received
// from mqtt.
// Calling:
//
// payload("abcde", TuyaType::Socket, "on");
//
// will render:
//
// {
//   dev_id: abcde,
//   gw_id: abcde,
//   uid: "",
//   t: 132478194, <-- current time
//   dps: {
//     1: true
//   }
// }
//
Convenience method to create a valid Tuya style payload from a device ID and a state received
from mqtt.
Calling.



will render.


Convenience method to create a valid Tuya style payload from a device ID and a state received from mqtt . Calling . will render .
pub fn payload(device_id: &str, tt: TuyaType, state: &str) -> Payload {
    Payload::Struct(PayloadStruct {
        dev_id: device_id.to_string(),
        gw_id: Some(device_id.to_string()),
        uid: None,
        t: Some(
            SystemTime::now()
                .duration_since(SystemTime::UNIX_EPOCH)
                .unwrap()
                .as_secs() as u32,
        ),
        dps: dps(tt, state),
    })
}
pub fn payload ( device_id : & str , tt : TuyaType , state : & str ) -> Payload { Payload :: Struct ( PayloadStruct { dev_id : device_id . to_string ( ) , gw_id : Some ( device_id . to_string ( ) ) , uid : None , t : Some ( SystemTime :: now ( ) . duration_since ( SystemTime :: UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) as u32 , ) , dps : dps ( tt , state ) , } ) }
Convenience method to create a valid Tuya style payload from a device ID and a state received
from mqtt.
Convenience method to create a valid Tuya style payload from a device ID and a state received from mqtt .
device_id
&str
tt
TuyaType
state
&str