mstroink / solax-inverter
Collects data from Solax Inverter
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:libary
Requires
- php: >=7.1
- php-http/client-common: ^1.9 || ^2.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.6
- psr/http-client: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^1.5
- php-http/guzzle6-adapter: ^1.0
- phpunit/phpunit: ^5.7|^6.0
- symfony/var-dumper: ^4.3
Suggests
- guzzlehttp/psr7: PSR-7 message implementation that also provides common utility methods
- php-http/curl-client: cURL client for PHP-HTTP
This package is auto-updated.
Last update: 2025-03-07 00:27:46 UTC
README
Solax Inverter
Simple PHP Client for reading realtime data from the Solax inverter
Table of Contents
Installation
Via Composer: If you just want to get started quickly you should run the following:
$ composer require mstroink/solax-inverter php-http/guzzle6-adapter php-http/message
Why php-http/guzzle6-adapter php-http/message
? We are decoupled from any HTTP messaging client with help by
HTTPlug. Read about clients in the HTTPlug docs.
Usage
Ensure inverter is connected to your network. Guide (pdf) Confirm datastream from inverter by checking you can access the following URL and get a response. http://INVERTERIP/api/historyData.htm
Default adapter
Initializing Inverter client with guzzle6-adapter and some default settings (timeout etc.)
require 'vendor/autoload.php'; use MStroink\Solax\Inverter; $inverter = Inverter:create('192.168.178.10');
Other adapter
Here is a list of all officially supported clients and adapters by HTTPlug: http://docs.php-http.org/en/latest/clients.html
Note the timeout: At night there is not enough sunlight to power the inverter.
require 'vendor/autoload.php'; use MStroink\Solax\Http\HttpClientConfigurator; use MStroink\Solax\Inverter; use Cake\Http\Client as CakeClient; $clientConfigurator = (new HttpClientConfigurator()) ->setHost('192.168.178.10'); ->setClient(new CakeClient(['timeout' => 10])); $inverter = new Inverter($clientConfigurator)
Response
try { $response = $inverter->getRealTimeData(); echo $response->Inverter->getYieldToday() . "\n"; echo $response->Inverter->getYieldTotal() . "\n"; echo $response->Inverter->getInnerTemperature() . "\n"; $response->Grid->getCurrent(); $response->Grid->getExported(); $response->Grid->getFeedInPower(); $response->Grid->getFrequency(); $response->Grid->getImported(); $response->Grid->getPower(); $response->Grid->getVoltage(); $response->Meta->getMethod(); $response->Meta->getSerialNumber(); $response->Meta->getStatus(); $response->Meta->getType(); $response->Meta->getVersion(); $response->Pv->getPv1Current(); $response->Pv->getPv1Power(); $response->Pv->getPv1Voltage(); $response->Pv->getPv2Current(); $response->Pv->getPv2Power(); $response->Pv->getPv2Voltage(); $response->toArray(); } catch (HttpServerException $e) { //inverter is offline? }
Tests
vendor/bin/phpunit
Support
Please open an issue for support.