Git Product home page Git Product logo

sofar-mqtt's Introduction

sofar-mqtt

Rust Version License

sofar-mqtt is a Rust-based project that enables the reception and parsing of data frames from the Sofar photovoltaic (PV) inverter and facilitates sending them to an MQTT broker. This lightweight and efficient tool aims to simplify the integration of Sofar inverters with MQTT-based home automation systems like Home Assistant, energy monitoring platforms, or any other applications requiring real-time PV data.

Features

  • Connects to a Sofar PV inverter via TCP connection to dedicated data logger (LSW-3),
  • Receives data frames emitted by the inverter in a specific protocol format,
  • Parses the received frames to extract relevant data such as current power output, voltage, and other parameters,
  • Sends the parsed data to an MQTT broker for further processing or integration with other systems,
  • Implements error handling and logging to ensure reliable operation.

Installation

  1. Ensure you have Rust and Cargo installed. If not, follow the instructions provided at the Rust website.

  2. Clone the sofar-mqtt repository:

    git clone https://github.com/ceski23/sofar-mqtt.git
  3. Change to the project directory:

    cd sofar-mqtt
  4. Build the project using Cargo:

    cargo build --release

Usage

To run sofar-mqtt, use the following command:

cargo run --release

Alternatively run built executable directly:

./target/[TARGET_ARCHITECTURE]/release/sofar-mqtt

Configuration

sofar-mqtt can be configured using environmental variables. The available configuration options include:

  • MQTT_HOST: Specify the MQTT broker's address to which the parsed data will be sent (Default: localhost)
  • MQTT_PORT: Specify the MQTT broker's port to which the parsed data will be sent (Default: 1883)
  • MQTT_USER: Specify the username used when connecting to MQTT
  • MQTT_PASSWORD: Specify the username used when connecting to MQTT
  • TCP_PORT: Specify the TCP port used to connect to the Sofar Data Logger (Default: 8080)

To set these environmental variables, you can either export them in your shell environment, write them in .env file or specify them when running the Docker container.

Using the Docker Image

Alternatively, you can use the provided Docker image to run sofar-mqtt without having to install Rust and its dependencies manually. The Docker image ensures a consistent and isolated environment for running the application.

Warning For now, only image for ARM64 architecture is provided

To use the Docker image, follow these steps:

  1. Pull the Docker image from the repository:

    docker pull ghcr.io/ceski23/sofar-mqtt:master
  2. Run the Docker container with the necessary configuration options:

    docker run --name sofar-mqtt -d -p 3000:8080 ghcr.io/ceski23/sofar-mqtt:master

Note For more information on available options and configuration, please refer to the configuration section.

Building the Docker Image

If you prefer to build the Docker image locally, follow these steps:

  1. Clone the sofar-mqtt repository:

    git clone https://github.com/ceski23/sofar-mqtt.git
  2. Change to the project directory:

    cd sofar-mqtt
  3. Build the Docker image using the provided Dockerfile:

    docker build -t sofar-mqtt .
  4. Proceed to use the Docker image as described in the previous section.

License

This project is licensed under the MIT License.

Acknowledgments

sofar-mqtt's People

Contributors

ceski23 avatar semantic-release-bot avatar

Watchers

 avatar

sofar-mqtt's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.