-
Notifications
You must be signed in to change notification settings - Fork 5
/
read.php
33 lines (26 loc) · 935 Bytes
/
read.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
use GoodWe\GoodWeInfo;
use GoodWe\GoodWeProcessor;
use GoodWe\GoodWeConnector;
use GoodWe\ToPvOutput;
require_once "GoodWeInfo.php";
require_once "GoodWeConnector.php";
require_once "GoodWeProcessor.php";
require_once "GoodWeOutput.php";
require_once "GoodWeValidator.php";
require_once "ToPvOutput.php";
require_once "inverters.php";
$connector = new GoodWeConnector();
foreach ($inverters as $inverter) {
echo "===========================" . PHP_EOL;
echo "Trying " . $inverter['name'] . ' (' . $inverter['ip'] . ')' . PHP_EOL;
$serialReply = $connector->getSerial($inverter['ip']);
$goodWeInfo = new GoodWeInfo($serialReply);
$goodWeInfo->show();
$reply = $connector->sendUsageMessage($inverter['ip']);
$goodweOutput = GoodWeProcessor::process($reply);
$goodweOutput->show();
if (array_key_exists('pvoutput', $inverter)) {
ToPvOutput::send($inverter, $goodweOutput);
}
}