added sync from linked variable
This commit is contained in:
1 parent
faa518ccd8
commit
ac0621ffe4
6 files changed
+89
-5
No files matched your search
@@ -42,6 +42,12 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [],
|
||||
"actions": [
|
||||
{
|
||||
"type": "Button",
|
||||
"caption": "Set total energy to current meter value",
|
||||
"onClick": "ECC_SetTotalEnergyToCurrentSource($id);"
|
||||
}
|
||||
],
|
||||
"status": []
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
"de": {
|
||||
"Energy Counter Display": "Energiezähler Anzeige",
|
||||
"Values are calculated and reset only by the associated main module. This form controls visibility only; hidden values remain available in the background.": "Die Werte werden ausschließlich durch das zugehörige Hauptmodul berechnet und zurückgesetzt. Hier wird nur ihre Sichtbarkeit gesteuert; ausgeblendete Werte bleiben im Hintergrund vorhanden.",
|
||||
"Set total energy to current meter value": "Gesamtenergie auf aktuellen Zählerstand setzen",
|
||||
"Display variables": "Anzuzeigende Variablen",
|
||||
"Show total energy": "Gesamtenergie anzeigen",
|
||||
"Show total cost": "Gesamtkosten anzeigen",
|
||||
|
||||
@@ -13,6 +13,7 @@ class EnergyCounterChild extends IPSModule
|
||||
// nicht im Formular angeboten. Die Childinstanz bleibt reine Anzeige.
|
||||
$this->RegisterPropertyInteger('ParentInstanceID', 0);
|
||||
$this->RegisterPropertyString('CounterKey', '');
|
||||
$this->RegisterPropertyInteger('SourceVariableID', 0);
|
||||
|
||||
$this->RegisterPropertyBoolean('ShowTotalEnergy', true);
|
||||
$this->RegisterPropertyBoolean('ShowTotalCost', true);
|
||||
@@ -35,6 +36,25 @@ class EnergyCounterChild extends IPSModule
|
||||
$this->SetStatus(102);
|
||||
}
|
||||
|
||||
/** Setzt die Gesamtenergie über das Hauptmodul auf den aktuellen Zählerstand. */
|
||||
public function SetTotalEnergyToCurrentSource(): bool
|
||||
{
|
||||
$parentInstanceID = $this->ReadPropertyInteger('ParentInstanceID');
|
||||
$counterKey = $this->ReadPropertyString('CounterKey');
|
||||
if ($parentInstanceID <= 0 || $counterKey === '') {
|
||||
IPS_LogMessage('EnergyCounterChild', 'Gesamtenergie kann nicht gesetzt werden: Zuordnung zum Hauptmodul fehlt.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$function = 'ECM_SetCounterTotalEnergyFromSource';
|
||||
if (!function_exists($function)) {
|
||||
IPS_LogMessage('EnergyCounterChild', 'Gesamtenergie kann nicht gesetzt werden: Hauptmodul-Funktion ist nicht verfügbar.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return $function($parentInstanceID, $counterKey);
|
||||
}
|
||||
|
||||
private function RegisterValueVariables()
|
||||
{
|
||||
$this->RegisterVariableFloat('TotalEnergy', $this->Translate('Total Energy'), self::ENERGY_PROFILE, 10);
|
||||
|
||||
Reference in new issue
Block a user