tapo 0.9.0

Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L535, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P110M, P115), power strips (P300, P304M, P306, P316M), hubs (H100), switches (S200B, S200D, S210) and sensors (KE100, T100, T110, T300, T310, T315).
Documentation
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};

use crate::responses::TapoResponseExt;
use crate::utils::der_tapo_datetime_format;

/// Contains local time, current power and the energy usage and runtime for today and for the current month.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "python", pyo3::prelude::pyclass(from_py_object, get_all))]
pub struct EnergyUsageResult {
    /// Current power in milliwatts (mW).
    pub current_power: Option<u64>,
    /// Electricity charge/cost data reported by the device using the tariff configured in the Tapo app.
    /// The third element is the total charge for the current month.
    /// The meaning of the first two elements is not confirmed; please open an issue or pull request if you know.
    pub electricity_charge: Option<[u64; 3]>,
    /// Local time of the device.
    #[serde(deserialize_with = "der_tapo_datetime_format")]
    pub local_time: NaiveDateTime,
    /// Current month energy usage in Watt Hours (Wh).
    pub month_energy: u64,
    /// Current month runtime in minutes.
    pub month_runtime: u64,
    /// Today energy usage in Watt Hours (Wh).
    pub today_energy: u64,
    /// Today runtime in minutes.
    pub today_runtime: u64,
}
impl TapoResponseExt for EnergyUsageResult {}

#[cfg(feature = "python")]
crate::impl_to_dict!(EnergyUsageResult);