solaredge-modbus 0.1.1

SolarEdge modbus client
Documentation

solaredge-modbus

Build Status Documentation Crates.io Maintenance

Support the project | Documentation

Usage

Run:

cargo add solaredge-modbus

Or add to your Cargo.toml:

[dependencies]
solaredge-modbus = "0.1.1"

SolarEdge modbus client for Rust

Enables access to the SolarEdge equipment over the local network via the Modbus protocol (solar panels, inverters, meters) with the nice typed Rust interface.

At the moment only the TCP transport is supported, as this is the only way I can test it, but I'm open for contributions to add support for serial or other transports.

Modbus TCP might need to be enabled first, see for example this guide.

An optional discover feature is available to find the inverters on the local network using mDNS.

use solaredge_modbus::{TcpClient, discover_with_mdns};
use std::time::Duration;

async fn run() -> Result<(), Box<dyn std::error::Error>> {
   let hosts = discover_with_mdns(Duration::from_secs(3), 1).await?;
   let host_info = hosts.into_iter().next().ok_or("No host found")?;
   let mut client = TcpClient::new_from_host_info(&host_info)?;
   let lifetime_energy = client.energy_wh()?;
   Ok(())
}

License

LGPL-3.0