Download the PHP package shob01/foxess without Composer
On this page you can find all versions of the php package shob01/foxess. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shob01/foxess
More information about shob01/foxess
Files in shob01/foxess
Informations about the package foxess
Access FoxEss Cloud Api using PHP classes
Implementation of PHP classes to access FoxEss Cloud data via FoxEss Open API. The official Open API documentation also mentions some restrictions every user should be aware of.
As of today the provided classes are restricted to single inverter installations. The simple reasons for this are that this configuration meets my personal requirements and I would not be able to test for environments with multiple inverters.
Please be aware that this is the result of a hobby project, that I developed in my spare time. I am a professional software developer (C/C++, Databases, ABAP OO), but this is my first bigger project using PHP. I am also not very experienced in Web development and using github. I would really appreciate any helpful hints and tipps regarding dos and don'ts and/or best practice.
Install
Quick start
Copy the file .env.example
to .env
in your document root directory and fill in your
FoxEss configuration data.
Start the PHP internal web server in your document root directory:
Open this URL in your browser: http://localhost:8000/vendor/shob01/foxess/examples/Test.php
Usage example
This little example shows how to read production report data for current month, today and current hour. Additionally, todays min, max, current and trend value for SoC (State of charge), Inverter and Battery Temperation will be obtained as well.
You can find this DashboardData.php
and some more example codes in the examples
directory. There is also a respecting HTML file for each example code, showing the execution output.
Output
Configuration / Dependency Injection Container
There are serveral options to configure how things are done. I implemented a very simple
DI Container that is used to control configurable dependencies. The DI Container is setup in the
PHP code dependencies.php
- `Config::class` defines where the FoxEss configuration data is coming from.
There are already two ready implemented classes available:
- `ConfigDotEnv`: (default) reads the data from a .env file and makes the entries available as local
environment variables.
- `ConfigFile`: reads the data from a json file.
<p/>
- `IRequester::class` defines Request and Response handling. I am using GuzzleHttp, but this can be replaced
by anything that is implementing `\Psr\Http\Message\ResponseInterface`. Just implement your own version
of `IRequester` interface.
- `TZ` defines the timezone that is used for requesting data and also in some output features like
`HtmlTableDataFormatter` and `ResultDataTable`class. See [W3 schools PHP Supported Timezones](https://www.w3schools.com/php/php_ref_timezones.asp) for details.