no message
This commit is contained in:
@@ -243,12 +243,36 @@ class Shelly_Parser_MQTT extends IPSModule
|
|||||||
IPS_SetParent($vid, $folder);
|
IPS_SetParent($vid, $folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OUTPUT → Switch-UI + Action
|
// OUTPUT: Switch-Profil + ActionScript
|
||||||
if (str_contains($ident, '_output_')) {
|
if (str_contains($ident, '_output_')) {
|
||||||
|
|
||||||
IPS_SetVariableCustomProfile($vid, '~Switch');
|
IPS_SetVariableCustomProfile($vid, '~Switch');
|
||||||
IPS_SetVariableCustomAction($vid, $this->InstanceID);
|
|
||||||
|
// Action Script suchen / erstellen
|
||||||
|
$scriptIdent = $ident . "_action";
|
||||||
|
$scriptID = @IPS_GetObjectIDByIdent($scriptIdent, $folder);
|
||||||
|
|
||||||
|
if ($scriptID === false) {
|
||||||
|
$scriptID = IPS_CreateScript(0); // 0 = PHP Script
|
||||||
|
IPS_SetParent($scriptID, $folder);
|
||||||
|
IPS_SetIdent($scriptID, $scriptIdent);
|
||||||
|
IPS_SetName($scriptID, $name . " Action");
|
||||||
|
|
||||||
|
$code = <<<EOF
|
||||||
|
<?php
|
||||||
|
\$module = IPS_GetParent(\$_IPS['SELF']);
|
||||||
|
RequestAction(\$module, \$_IPS['VARIABLE'], \$_IPS['VALUE']);
|
||||||
|
?>
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
IPS_SetScriptContent($scriptID, $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variable zeigt auf dieses Action-Script
|
||||||
|
IPS_SetVariableCustomAction($vid, $scriptID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $vid;
|
return $vid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user