2017 © Pedro Peláez
 

library sma

Script for extracting realtime data from from SMA Sunny Portal

image

gunna-php/sma

Script for extracting realtime data from from SMA Sunny Portal

  • Saturday, December 12, 2015
  • by srmiles
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SMA Sunny Portal Extractor

Latest Version on Packagist ![Software License][ico-license] Total Downloads, (*1)

This is a php class for collecting data from the SMA Home Energy Monitor via the SMA Sunny Portal Web Interface., (*2)

Install

Via Composer

``` bash $ composer require gunna-php/sma, (*3)

### Manually
 Download the Zip file and extract

``` PHP
require_once '[PATH/TO]/src/SunnyPortal.php';

Usage

Create Instance

``` PHP use GunnaPHP\SMA\SunnyPortal;, (*4)

$portal = new SunnyPortal([ 'username' => '{Portal Login Email}', 'password' => '{Portal Login Password}' ]);, (*5)

### Get a List of Plants
``` PHP
$plants = $portal->getPlantList();
foreach ($plants AS $plantOID=>$plantName) {
    echo $plantName.': '.$plantOID.PHP_EOL;
}

Select Plant

Select the plant you want to collect the live data from, (*6)

``` PHP $poral->setPlant('{SMA Plant OID}');, (*7)


### Collect Data ``` PHP while ( true ) { $data = $portal->liveData(); echo 'PV Generation: '.$data->PV.'kW'.PHP_EOL; echo 'Grid Consumption: '.$data->GridConsumption.'kW'.PHP_EOL; sleep(60); // Note: Minimum Interval between data reads is 15 secs }

Example output

``` PHP stdClass Object ( [__type] => LiveDataUI [Timestamp] => stdClass Object ( [__type] => DateTime [DateTime] => 2015-12-12T08:15:10 [Kind] => Unspecified ) [PV] => [FeedIn] => 0 [GridConsumption] => 0 [DirectConsumption] => [SelfConsumption] => [SelfSupply] => [TotalConsumption] => 0 [DirectConsumptionQuote] => [SelfConsumptionQuote] => [AutarkyQuote] => [BatteryIn] => [BatteryOut] => [BatteryChargeStatus] => [OperationHealth] => [BatteryStateOfHealth] => [InfoMessages] => Array() [WarningMessages] => Array() [ErrorMessages] => Array() [Info] => stdClass Object() ), (*8)

```, (*9)

Credits

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

12/12 2015

dev-master

9999999-dev https://github.com/gunna-php/sma

Script for extracting realtime data from from SMA Sunny Portal

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl >=5.5.0

 

gunnaphp sma sunnyportal