Giter Site home page Giter Site logo

solax2ha's Introduction

Solax2HA

Solax2HA is a service that integrates Solax inverters with Home Assistant by creating sensors through the Home Assistant API. The service is built and run on a separate machine and uses cron to run periodically.

Features

  • Real-time Monitoring: Fetch data from your Solax inverter every 10 seconds.
  • Easy Integration: Create sensors in Home Assistant via the API.
  • Automatic Execution: Use cron for automatic periodic execution.

Requirements

  • A machine with network access to HA and Solax inverter
  • Solax Inverter
  • Home Assistant
  • Node.js and npm (for building the service)

Installation

1. Clone the repository:

git clone [email protected]:RobinCK/solax2ha.git
cd solax2ha

2. Install dependencies:

npm install

3. Build the project:

npm run build

4. Create a .env file:

Create a .env file in the root directory with the following content:

SOLAX_URL=http://192.168.100.2
SOLAX_PASSWORD=password
HA_URL=https://192.168.100.3:8123
HA_TOKEN=eyJ
HA_SENSOR_BASE_NAME=solax
HA_SENSOR_BASE_UNIQUE_ID=solax_id
HA_DEVICE_NAME=Solax G2 Inverter
HA_DEVICE_IDENTIFIER=Solax G2 Inverter
HA_DEVICE_MANUFACTURER=Solax
HA_DEVICE_MODEL=G2 3-Phase

5. Run the service:

node ./dist/index.js

6. Set up periodic execution:

Create a bash script to run the service:

#!/bin/bash
cd /path/to/solax2ha
node ./dist/index.js

Using cron:

Open crontab for editing:

crontab -e

Add the following line to run the service every 1 minute:

* * * * * /path/to/bash /path/to/your/script.sh

Using systemd:

If you need to transmit more often than 1 minute, you can create your own service

Step 1: Create a systemd Service File

Create a service file for your script, for example, /etc/systemd/system/solax.service, and add the following content:

[Unit]
Description=Run Solax solax2ha

[Service]
ExecStart=/path/to/bash /path/to/your/script.sh
Step 2: Create a systemd Timer File

Create a timer file to run the service every 10 seconds, for example, /etc/systemd/system/solax.timer, and add the following content:

[Unit]
Description=Run Solax script every 10 seconds

[Timer]
OnBootSec=10sec
OnUnitActiveSec=10sec
Unit=solax.service

[Install]
WantedBy=timers.target
Step 3: Start and Enable the Timer

Run the following commands to start the timer and set it to start automatically at boot:

sudo systemctl daemon-reload
sudo systemctl start solax.timer
sudo systemctl enable solax.timer
Step 4: Check the Status of the Timer

To verify that the timer is working, run:

sudo systemctl status solax.timer

Usage

After installation and configuration, the service will automatically create sensors in Home Assistant, allowing you to monitor your Solax inverter in real-time.

Contributing

We welcome contributions to Solax2HA! If you have any ideas or want to make changes, please fork the repository and submit a pull request. Ensure your code adheres to the existing style and includes tests where applicable.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions, issues, or suggestions, please open an issue on GitHub or contact the maintainer.

solax2ha's People

Contributors

robinck avatar

Stargazers

Vadym Nemchenko avatar

Watchers

 avatar

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.