Crates.io | tokio-sunspec |
lib.rs | tokio-sunspec |
version | 0.2.2 |
source | src |
created_at | 2023-03-02 16:55:14.912815 |
updated_at | 2023-03-22 13:33:23.467552 |
description | Tokio-based SunSpec library |
homepage | https://github.com/lukaskirner/tokio-sunspec |
repository | https://github.com/lukaskirner/tokio-sunspec |
max_upload_size | |
id | 799021 |
size | 219,780 |
A pure Rust SunSpec library based on tokio.
[dependencies]
tokio-sunspec = "*"
The src/models/
folder contains all pre generated models which may be available by the device. If you need to add your own model you can generate one with included Python script in the scripts
folder.
let socket_addr = "<ip-address>:502".parse().unwrap();
let device_id: u8 = 126;
let start_addr: u16 = 40000;
let mut client = tokio_sunspec::connect_tcp(socket_addr, device_id, start_addr).await?;
let res = client.read_point(model1::Mn).await?;
assert_eq!(res, "SMA");
This lib only implements the SunSpec part. The connection via modbus is done by the tokio-modbus lib.
Copyright (c) 2023 Lukas Kirner