huawei_client

Crates.iohuawei_client
lib.rshuawei_client
version0.0.2
sourcesrc
created_at2022-12-18 18:33:33.274738
updated_at2022-12-18 18:53:56.796994
descriptionHuawei Client for FusionSolar API
homepage
repository
max_upload_size
id740534
size5,806,803
n3wtron (n3wtron)

documentation

README

huawei inverter client

Supported Devices

  • Residential Inverter
  • Power Sensor

Usage

    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);
    }

Tests

env Variables:

  • HUAWEI_USER
  • HUAWEI_PASSWORD
Commit count: 0

cargo fmt