Cannot delete association for boolean types
mit der Fehlermeldung kann ich nix anfangen.
Die kommt bei
IPS_SetVariableProfileAssociation($Name, $Association['Value'], '', '', -1);
was mache ich da wohl falsch bzw. warum kommt diese Fehlermeldung?
$this->RegisterProfileAssociation(
'Echo.Remote.Mute', 'Speaker', '', '', 0, 1, 0, 0, vtBoolean, [
[false, $this->Translate('Mute'), 'Speaker', 0xff3300],
[true, $this->Translate('Unmute'), 'Speaker', 0x00ff55]]
);
löst das aus
private function RegisterProfileAssociation($Name, $Icon, $Prefix, $Suffix, $MinValue, $MaxValue, $Stepsize, $Digits, $Vartype,
$Associations): void
{
if (is_array($Associations) && count($Associations) === 0) {
$MinValue = 0;
$MaxValue = 0;
}
$this->RegisterProfile($Name, $Icon, $Prefix, $Suffix, $MinValue, $MaxValue, $Stepsize, $Digits, $Vartype);
if (is_array($Associations)) {
//zunächst werden alte Assoziationen gelöscht
//bool IPS_SetVariableProfileAssociation ( string $ProfilName, float $Wert, string $Name, string $Icon, integer $Farbe )
foreach (IPS_GetVariableProfile($Name)['Associations'] as $Association) {
IPS_SetVariableProfileAssociation($Name, $Association['Value'], '', '', -1);
}
//dann werden die aktuellen eingetragen
foreach ($Associations as $Association) {
IPS_SetVariableProfileAssociation($Name, $Association[0], $Association[1], $Association[2], $Association[3]);
}
} else {
$Associations = $this->$Associations;
foreach ($Associations as $code => $association) {
IPS_SetVariableProfileAssociation($Name, $code, $this->Translate($association), $Icon, -1);
}
}
}
Die Zeile mit
IPS_SetVariableProfileAssociation
erzeugt den Fehler.