Tool written in GO for reading metrics from Sofar LSW-3 and writing results into MQTT topics. Program queries logger modbus port in infinite loop and sends data into MQTT topics (e.g. mosquito in HomeAssistant).
- Download go 1.19
- Clone this repo
git clone git@github.com:kubaceg/sofar_g3_lsw3_logger_reader.git
- Go into project directory
cd sofar_g3_lsw3_logger_reader
- Copy example config
cp config-example.yaml config.yaml
- Edit
config.yaml
in Your favorite editor, fill all required stuff - Build program
make build
or build for ARM machines e.g. raspberryPimake build-arm
- Run
./sofar
orsofar-arm
Data will be sent into MQTT topic with name {mqttPrefix}/{fieldName}
where:
- mqttPrefix is value defined in
config.yaml
e.g./sensors/energy/inverter
- fieldName is measurement name, all available measurements are described in
adapters/devices/sofar/sofar_protocol.go
, e.g.PV_Generation_Today
Full topic name for given example values is /sensors/energy/inverter/PV_Generation_Today
.
Additional field is All
which contains all measurements and their values marshalled into one json.
Data can also be sent over OTLP protocol to a gRPC or http server. Typically, this would be received by the OTel-Collector for further export to any required platform.
Metrics are all captured as gauges and recorded and exported at the same frequency that measurements are taken.
Metric names follow the convention sofar.logger.<fieldName>
by default. This can be updated in the configuration file.
You can monitor Your solar instalation using grafana dashboard
This is based on program written by @sigxcpu76 XtheOne/Inverter-Data-Logger#37 (comment).
Feel free if You want to extend this tool with new features. Just open issue or make PR.