no message
This commit is contained in:
@@ -8,10 +8,9 @@ class VGT_Sub extends IPSModule
|
|||||||
{
|
{
|
||||||
parent::Create();
|
parent::Create();
|
||||||
|
|
||||||
// Konfiguration
|
|
||||||
$this->RegisterPropertyString('DeviceID', '');
|
$this->RegisterPropertyString('DeviceID', '');
|
||||||
|
|
||||||
// Eigene Status Variablen (schreibbar)
|
// Status Variablen
|
||||||
$this->RegisterVariableFloat('PowerProduction', 'Power Production', '', 10);
|
$this->RegisterVariableFloat('PowerProduction', 'Power Production', '', 10);
|
||||||
$this->EnableAction('PowerProduction');
|
$this->EnableAction('PowerProduction');
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ class VGT_Sub extends IPSModule
|
|||||||
$this->RegisterVariableFloat('MaxSoc', 'Max SoC', '', 15);
|
$this->RegisterVariableFloat('MaxSoc', 'Max SoC', '', 15);
|
||||||
$this->EnableAction('MaxSoc');
|
$this->EnableAction('MaxSoc');
|
||||||
|
|
||||||
// Remote-Control Werte (readonly)
|
// Remote-control readonly Variablen
|
||||||
$this->RegisterVariableInteger('PowerSetpoint', 'Power Setpoint', '', 30);
|
$this->RegisterVariableInteger('PowerSetpoint', 'Power Setpoint', '', 30);
|
||||||
IPS_SetVariableCustomAction($this->GetIDForIdent('PowerSetpoint'), 0);
|
IPS_SetVariableCustomAction($this->GetIDForIdent('PowerSetpoint'), 0);
|
||||||
|
|
||||||
@@ -41,7 +40,9 @@ class VGT_Sub extends IPSModule
|
|||||||
public function ApplyChanges()
|
public function ApplyChanges()
|
||||||
{
|
{
|
||||||
parent::ApplyChanges();
|
parent::ApplyChanges();
|
||||||
$this->ConnectParent('{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}');
|
|
||||||
|
// Richtiger Parent
|
||||||
|
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
|
||||||
|
|
||||||
$this->SubscribeTopics();
|
$this->SubscribeTopics();
|
||||||
}
|
}
|
||||||
@@ -61,10 +62,11 @@ class VGT_Sub extends IPSModule
|
|||||||
foreach ($topics as $topic) {
|
foreach ($topics as $topic) {
|
||||||
$this->SendDebug("Subscribe", $topic, 0);
|
$this->SendDebug("Subscribe", $topic, 0);
|
||||||
|
|
||||||
// Richtige MQTT Client Struktur
|
|
||||||
$this->SendDataToParent(json_encode([
|
$this->SendDataToParent(json_encode([
|
||||||
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
|
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
|
||||||
'Topic' => $topic
|
"PacketType" => 8, // Subscribe
|
||||||
|
"Topic" => $topic,
|
||||||
|
"QoS" => 0
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,13 +112,16 @@ class VGT_Sub extends IPSModule
|
|||||||
$json = json_encode($response);
|
$json = json_encode($response);
|
||||||
$topic = "feedback-response/$device";
|
$topic = "feedback-response/$device";
|
||||||
|
|
||||||
$this->SendDebug("TX Feedback", "$topic => $json", 0);
|
$this->SendDebug("TX Feedback", $json, 0);
|
||||||
|
|
||||||
// MQTT Client: Publish
|
// RAW MQTT Publish
|
||||||
$this->SendDataToParent(json_encode([
|
$this->SendDataToParent(json_encode([
|
||||||
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
|
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
|
||||||
'Topic' => $topic,
|
"PacketType" => 3, // Publish
|
||||||
'Payload' => $json
|
"Topic" => $topic,
|
||||||
|
"Payload" => $json,
|
||||||
|
"QoS" => 0,
|
||||||
|
"Retain" => false
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,14 +144,17 @@ class VGT_Sub extends IPSModule
|
|||||||
$topic = "remote-control-response/$device";
|
$topic = "remote-control-response/$device";
|
||||||
$payloadOut = json_encode($json);
|
$payloadOut = json_encode($json);
|
||||||
|
|
||||||
// MQTT Client: Publish
|
$this->SendDebug("TX RemoteControl", $payloadOut, 0);
|
||||||
$this->SendDataToParent(json_encode([
|
|
||||||
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
|
|
||||||
'Topic' => $topic,
|
|
||||||
'Payload' => $payloadOut
|
|
||||||
]));
|
|
||||||
|
|
||||||
$this->SendDebug("TX RemoteControl", "$topic => $payloadOut", 0);
|
// RAW MQTT Publish
|
||||||
|
$this->SendDataToParent(json_encode([
|
||||||
|
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
|
||||||
|
"PacketType" => 3,
|
||||||
|
"Topic" => $topic,
|
||||||
|
"Payload" => $payloadOut,
|
||||||
|
"QoS" => 0,
|
||||||
|
"Retain" => false
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
|
|||||||
Reference in New Issue
Block a user