unterscheidung ladestation für go-e alt und neu
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"type": "ValidationTextBox",
|
"type": "ValidationTextBox",
|
||||||
"name": "IP_Adresse",
|
"name": "IP_Adresse",
|
||||||
"caption": "IP-Adresse Go-E",
|
"caption": "IP-Adresse Ladestation",
|
||||||
"suffix": ""
|
"suffix": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ class Ladestation_Universal extends IPSModule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function SetAktuelle_Leistung(int $power)
|
public function SetAktuelle_Leistung(int $power)
|
||||||
{
|
{
|
||||||
$internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
$internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||||
@@ -156,11 +158,20 @@ class Ladestation_Universal extends IPSModule
|
|||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
|
||||||
// Setze die URL
|
// Setze die URL
|
||||||
|
if(ReadPropertyInteger("Ladestation")==2){
|
||||||
curl_setopt(
|
curl_setopt(
|
||||||
$ch,
|
$ch,
|
||||||
CURLOPT_URL,
|
CURLOPT_URL,
|
||||||
"http://" . $this->ReadPropertyString("IP_Adresse") . "/api/status"
|
"http://" . $this->ReadPropertyString("IP_Adresse") . "/api/status"
|
||||||
);
|
);
|
||||||
|
}elseif(ReadPropertyInteger("Ladestation")==1){
|
||||||
|
curl_setopt(
|
||||||
|
$ch,
|
||||||
|
CURLOPT_URL,
|
||||||
|
"http://" . $this->ReadPropertyString("IP_Adresse") . "/mqtt?payload="
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setze die Option, die Antwort als String zurückzugeben
|
// Setze die Option, die Antwort als String zurückzugeben
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
@@ -235,9 +246,14 @@ class Ladestation_Universal extends IPSModule
|
|||||||
|
|
||||||
public function sendPowerToStation($value)
|
public function sendPowerToStation($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(ReadPropertyInteger("Ladestation")==2){
|
||||||
|
$baseUrl ="http://" . $this->ReadPropertyString("IP_Adresse") . "/api/set?";
|
||||||
|
}elseif(ReadPropertyInteger("Ladestation")==1){
|
||||||
|
$baseUrl ="http://" . $this->ReadPropertyString("IP_Adresse") . "/mqtt?payload=";
|
||||||
|
}
|
||||||
// Base URL
|
// Base URL
|
||||||
$baseUrl =
|
|
||||||
"http://" . $this->ReadPropertyString("IP_Adresse") . "/api/set?";
|
|
||||||
IPS_LogMessage("Ladestation", "Aufgerufene ip" . $baseUrl);
|
IPS_LogMessage("Ladestation", "Aufgerufene ip" . $baseUrl);
|
||||||
$value = $this->convertPowerToCurrent(
|
$value = $this->convertPowerToCurrent(
|
||||||
$value,
|
$value,
|
||||||
@@ -248,7 +264,12 @@ class Ladestation_Universal extends IPSModule
|
|||||||
|
|
||||||
// If value is 0, make a single request
|
// If value is 0, make a single request
|
||||||
if ($value == 0) {
|
if ($value == 0) {
|
||||||
|
if(ReadPropertyInteger("Ladestation")==2){
|
||||||
$url = $baseUrl . "frc=1";
|
$url = $baseUrl . "frc=1";
|
||||||
|
}elseif(ReadPropertyInteger("Ladestation")==1){
|
||||||
|
$url = $baseUrl . "alw=0";
|
||||||
|
|
||||||
|
}
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
@@ -259,7 +280,13 @@ class Ladestation_Universal extends IPSModule
|
|||||||
// For value between 1 and 32, make two requests
|
// For value between 1 and 32, make two requests
|
||||||
elseif ($value >= 1 && $value <= 32) {
|
elseif ($value >= 1 && $value <= 32) {
|
||||||
// First request
|
// First request
|
||||||
$url1 = $baseUrl . "frc=2";
|
if ($value == 0) {
|
||||||
|
if(ReadPropertyInteger("Ladestation")==2){
|
||||||
|
$url = $baseUrl . "frc=2";
|
||||||
|
}elseif(ReadPropertyInteger("Ladestation")==1){
|
||||||
|
$url = $baseUrl . "alw=1";
|
||||||
|
|
||||||
|
}
|
||||||
curl_setopt($ch, CURLOPT_URL, $url1);
|
curl_setopt($ch, CURLOPT_URL, $url1);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$response1 = curl_exec($ch);
|
$response1 = curl_exec($ch);
|
||||||
@@ -271,7 +298,14 @@ class Ladestation_Universal extends IPSModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second request
|
// Second request
|
||||||
|
|
||||||
|
if ($value == 0) {
|
||||||
|
if(ReadPropertyInteger("Ladestation")==2){
|
||||||
$url2 = $baseUrl . "amp=$value";
|
$url2 = $baseUrl . "amp=$value";
|
||||||
|
}elseif(ReadPropertyInteger("Ladestation")==1){
|
||||||
|
$url2 = $baseUrl . "amx=$value";
|
||||||
|
|
||||||
|
}
|
||||||
curl_setopt($ch, CURLOPT_URL, $url2);
|
curl_setopt($ch, CURLOPT_URL, $url2);
|
||||||
$response2 = curl_exec($ch);
|
$response2 = curl_exec($ch);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "7.1"
|
"version": "7.1"
|
||||||
},
|
},
|
||||||
"version": "0.190",
|
"version": "0.191",
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"date": 0
|
"date": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user