Hi,
ich baue gerade an meinem Modul für einen Deye Wechselrichter und bin nun auf ein Problem gestoßen. Im Modul habe ich einige Variablen ,die nur auslesbar sine. andere sind jedoch schreibbar. Die Setze ich mit “EnableAction”, so dass ich sie im Webfront ändern kann. mein Problem ist jetzt, dass zwar für alle schreibbaren Variablen der Befehl ausgeführt wird, aber nur ein paar davon auch wirklich dann editierbar sind.
Die Variablendefinitionen habe ich in einem Array $Variables und in ApplyChanges des Moduls habe ich folgendes stehen.
parent::ApplyChanges(); //Nicht löschen
#Profile Registrieren
#Invertertyp und Status
$this->RegisterProfileIntegerEx('DeyeType', '', '','', $AssInvType, 5, 1);
$this->RegisterProfileIntegerEx('DeyeStatus', '', '','', $AssStatus, 4, 1);
$this->RegisterProfileIntegerEx('DeyeChgMode', '', '','', $AssChargeMode, 3, 1);
$this->RegisterProfileIntegerEx('DeyeBattType', '', '','', $AssBattType, 1, 1);
$this->RegisterProfileIntegerEx('DeyeBattView', '', '','', $AssBattView, 2, 1);
$this->RegisterProfileIntegerEx('DeyeLimControl', '', '','', $AssLimitControl, 2, 1);
#Float Variablen
$this->RegisterProfileFloat('VaR', '', '', ' VAr', 0, 0, 0, 2);
$this->RegisterProfileFloat('VA', '', '', ' VA', 0, 0, 0, 2);
$this->RegisterProfileFloat('PhaseAngle', '', '', ' °', 0, 0, 0, 2);
$this->RegisterProfileFloat('kVArh', '', '', ' kVArh', 0, 100, 0, 2);
#Integer Variablen
$this->RegisterProfileInteger('Volt.I', 'Electricity', '', ' V', 0, 0, 0);
$this->RegisterProfileInteger('Watt.I', 'Electricity', '', ' W', 0, 0, 0);
$this->RegisterProfileInteger('AmpHour.I', 'Electricity', '', ' Ah', 0, 0, 0);
$this->RegisterProfileInteger('VaR.I', '', '', ' VAr', 0, 0, 0);
$this->RegisterProfileInteger('VA.I', '', '', ' VA', 0, 0, 0);
$this->RegisterProfileInteger('Electricity.I', '', '', ' kWh', 0, 0, 0);
#Variablen aus dem Array Erzeugen und prüfung, ob nach Update neue VAriablen dazu gekommen sind.
$NewRows = static::$Variables;
$NewPos = 0;
$Variables = json_decode($this->ReadPropertyString('Variables'), true);
foreach ($Variables as $Variable) {
@$this->MaintainVariable($Variable['Ident'], $Variable['Name'], $Variable['VarType'], $Variable['Profile'], $Variable['Pos'], $Variable['Keep']);
#Die schreibbaren Variablen im Registerbereich 90 bis 499 editierbar machen
if (($Variable['Address'] >= 90 ) && ($Variable['Address'] <= 499 )) {
$this->EnableAction($Variable['Ident']);
$this->SendDebug('Editierbar', $Variable['Name'],0);
}
foreach ($NewRows as $Index => $Row) {
if ($Variable['Ident'] == str_replace(' ', '', $Row[0])) {
unset($NewRows[$Index]);
}
}
if ($NewPos < $Variable['Pos']) {
$NewPos = $Variable['Pos'];
}
}
if (count($NewRows) != 0) {
foreach ($NewRows as $NewVariable) {
$Variables[] = [
'Ident' => str_replace(' ', '', $NewVariable[0]),
'Name' => $this->Translate($NewVariable[0]),
'VarType' => $NewVariable[1], // Symcon Variablentyp
'ValType' => $NewVariable[2], // Deye Datentyp
'Profile' => $NewVariable[3], //Symcon Variablenprofil
'Address' => $NewVariable[4], // Deye Speicheradresse
'Function' => $NewVariable[5], // Deye Schreib-Lese-Funktion
'Quantity' => $NewVariable[6], // Anzahl Bytes
'Factor' => $NewVariable[7], // Umrechnungsfaktor
'Offset' => $NewVariable[8], // Umrechnungsoffset
'Keep' => $NewVariable[9],
'Pos' => ++$NewPos
];
}
IPS_SetProperty($this->InstanceID, 'Variables', json_encode($Variables));
IPS_ApplyChanges($this->InstanceID);
return;
}
#Timer für die Datenabfrage vom Deye aktualisieren
if ($this->ReadPropertyInteger('Interval') < 500) {
if ($this->ReadPropertyInteger('Interval') != 0) {
$this->SetStatus(IS_EBASE + 1);
} else {
$this->SetStatus(IS_ACTIVE);
}
$this->SetTimerInterval('UpdateTimer', 0);
} else {
$this->SetTimerInterval('UpdateTimer', $this->ReadPropertyInteger('Interval'));
$this->SetStatus(IS_ACTIVE);
}
Gibt es da noch einen Trick, wie ich die im Webfron editierbar bekomme außer “EnableAction” bzw. hat jemand eine Idee, weshalb einige Variablen gehen und es bei anderen nicht funktioniert?