Crates.io | huawei_client |
lib.rs | huawei_client |
version | 0.0.2 |
source | src |
created_at | 2022-12-18 18:33:33.274738 |
updated_at | 2022-12-18 18:53:56.796994 |
description | Huawei Client for FusionSolar API |
homepage | |
repository | |
max_upload_size | |
id | 740534 |
size | 5,806,803 |
use crate::client_impl::HuaweiClientImpl;
async fn do_something() {
let cl = HuaweiClientImpl::default(env!("HUAWEI_USER"), env!("HUAWEI_PASSWORD"));
let stations = cl.get_station_list().await.unwrap();
let station = stations.first().unwrap();
let realtime_data = cl.get_realtime_station_data(station.station_code.as_str()).await.unwrap();
println!("{:?}", realtime_data);
let devices = cl.get_device_list(station.station_code.as_str()).await.unwrap();
println!("{:?}", devices);
let power_sensor: &GetDevListData = devices.iter()
.filter(|device| device.dev_type_id == DeviceType::PowerSensor)
.collect::<Vec<&GetDevListData>>()
.first()
.unwrap();
let power_sensor_data = cl.get_realtime_power_sensor_data(power_sensor.id).await.unwrap();
println!("{:?}", power_sensor_data);
let inverter: &GetDevListData = devices.iter()
.filter(|device| device.dev_type_id == DeviceType::ResidentialInverter)
.collect::<Vec<&GetDevListData>>()
.first()
.unwrap();
let inverter_data = cl.get_realtime_residential_inverter_data(inverter.id).await.unwrap();
println!("{:?}", inverter_data);
}
env Variables: