wall connector
This commit is contained in:
parent
ef26ce4697
commit
490a50e24c
|
@ -39,6 +39,7 @@ pub enum Product {
|
||||||
Vehicle(Box<VehicleData>),
|
Vehicle(Box<VehicleData>),
|
||||||
Solar(Box<SolarData>),
|
Solar(Box<SolarData>),
|
||||||
Powerwall(Box<PowerwallData>),
|
Powerwall(Box<PowerwallData>),
|
||||||
|
WallConnector,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize_product<'de, D>(deserializer: D) -> Result<Product, D::Error>
|
fn deserialize_product<'de, D>(deserializer: D) -> Result<Product, D::Error>
|
||||||
|
@ -56,6 +57,8 @@ where
|
||||||
} else if v.get("battery_type").is_some() {
|
} else if v.get("battery_type").is_some() {
|
||||||
let powerwall_data = PowerwallData::deserialize(v).map_err(serde::de::Error::custom)?;
|
let powerwall_data = PowerwallData::deserialize(v).map_err(serde::de::Error::custom)?;
|
||||||
Ok(Product::Powerwall(Box::new(powerwall_data)))
|
Ok(Product::Powerwall(Box::new(powerwall_data)))
|
||||||
|
} else if v.get("resource_type").is_some() {
|
||||||
|
Ok(Product::WallConnector)
|
||||||
} else {
|
} else {
|
||||||
Err(serde::de::Error::custom(
|
Err(serde::de::Error::custom(
|
||||||
"No valid key found to determine the product type",
|
"No valid key found to determine the product type",
|
||||||
|
|
Loading…
Reference in a new issue