Hallo,
Ich habe mir ein Testscript mit folgender Befehlszeile geschrieben:
SC_Move(xxxx,100);
Also komplettes schließen des Rollladens.
Wenn ich dieses Script von der Console aus starte, reagiert diese auf keine Eingabe mehr, solange der Rollladen fährt. Nach Ende der Fahrt ist sie wieder freigegeben und ich kann normal weiter arbeiten.
Woran kann dies liegen (Bug?). Es ist recht ungünstig, wenn meine Konsole für ca. 30 Sekunden komplett blockiert ist.
anbei nochmals meine Skripte:
<?
//Variables provided by ShutterControl Module
//IPS_LogMessage("InstanceID", $SC_INSTANCE); /* InstanceID */
//IPS_LogMessage("Direction", $SC_DIRECTION); /* {0..2} Stop, Up, Down */
//IPS_LogMessage("Duration", $SC_DURATION); /* ms */
// umgeschrieben - $SC_Instance bestimmt den betroffenen Rollladen und wird hier im Skript unterschieden
include("57236.ips.php");
if($IPS_SENDER != "ShutterControl")
die("This script can only be started by the ShutterControl Module");
define("SC_DIRECTION_STOP", 0);
define("SC_DIRECTION_UP", 1);
define("SC_DIRECTION_DOWN", 2);
$instance = IPS_GetInstance($SC_INSTANCE);
switch($instance['ModuleInfo']['ModuleID'])
{
case "{542CC907-CA63-4E7A-A8C7-92F74639FA4C}": //Shutter Control by SW
$running = CreateVariableByName($SC_INSTANCE, "Moving", 0);
//$value = GetValue(IPS_GetStatusVariableID($SC_INSTANCE, "StatusVariable"));
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
if(GetValue($running))
{
FS20_SwitchDuration(Rollladen_mitte, true,1);
SetValue($running, false);
}
break;
case SC_DIRECTION_UP:
if(!GetValue($running))
{
FS20_SwitchDuration(Rollladen_oben, true,1);
SetValue($running, true);
}
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
FS20_SwitchDuration(Rollladen_mitte, true,1);
SetValue($running, false);
}
break;
case SC_DIRECTION_DOWN:
if(!GetValue($running))
{
FS20_SwitchDuration(Rollladen_unten, true,1);
SetValue($running, true);
}
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
FS20_SwitchDuration(Rollladen_mitte, true,1);
SetValue($running, false);
}
break;
}
break;
case "{48FCFDC1-11A5-4309-BB0B-A0DB8042A969}": //FS20
$running = CreateVariableByName($SC_INSTANCE, "Moving", 0);
$value = GetValue(IPS_GetStatusVariableID($SC_INSTANCE, "StatusVariable"));
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
if(GetValue($running))
{
FS20_SwitchMode($SC_INSTANCE, $value);
SetValue($running, false);
}
break;
case SC_DIRECTION_UP:
if(!GetValue($running))
{
FS20_SwitchMode($SC_INSTANCE, true);
SetValue($running, true);
}
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
FS20_SwitchMode($SC_INSTANCE, true);
SetValue($running, false);
}
break;
case SC_DIRECTION_DOWN:
if(!GetValue($running))
{
FS20_SwitchMode($SC_INSTANCE, false);
SetValue($running, true);
}
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
FS20_SwitchMode($SC_INSTANCE, false);
SetValue($running, false);
}
break;
}
break;
case "{1B7B5B7D-CAA9-4AB5-B9D8-EC805EC955AD}": //xComfort
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
MXC_ShutterStop($SC_INSTANCE);
break;
case SC_DIRECTION_UP:
MXC_ShutterMoveUp($SC_INSTANCE);
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
MXC_ShutterStop($SC_INSTANCE);
}
break;
case SC_DIRECTION_DOWN:
MXC_ShutterMoveDown($SC_INSTANCE);
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
MXC_ShutterStop($SC_INSTANCE);
}
break;
}
break;
case "{2D871359-14D8-493F-9B01-26432E3A710F}": //LCN
$type=LCN_GetUnit($SC_INSTANCE);
switch($type)
{
case 0: //Ausgänge
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
LCN_SetIntensity($SC_INSTANCE,0,0);
LCN_SetIntensity($SC_INSTANCE2,0,0);
break;
case SC_DIRECTION_UP:
LCN_SetIntensity($SC_INSTANCE,100,4);
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
LCN_SetIntensity($SC_INSTANCE,0,0);
}
break;
case SC_DIRECTION_DOWN:
LCN_SetIntensity($SC_INSTANCE2,100,4);
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
LCN_SetIntensity($SC_INSTANCE2,0,0);
}
break;
}
break;
case 2: //Reais
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
LCN_SwitchRelay($SC_INSTANCE,false);
break;
case SC_DIRECTION_UP:
LCN_SwitchRelay($SC_INSTANCE,true);
LCN_SwitchRelay($SC_INSTANCE2,false); // Um Relaisrichtung zu ändern bitte auf true
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
LCN_SwitchRelay($SC_INSTANCE,false);
}
break;
case SC_DIRECTION_DOWN:
LCN_SwitchRelay($SC_INSTANCE,true);
LCN_SwitchRelay($SC_INSTANCE2,true);// Um Relaisrichtung zu ändern bitte auf false
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
LCN_SwitchRelay($SC_INSTANCE,false);
}
break;
}
break;
}
break;
case "{9317CC5B-4E1D-4440-AF3A-5CC7FB42CCAA}": //1-Wire Shutter
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
OneWireShutter($SC_INSTANCE, 0, $SC_DURATION);
break;
case SC_DIRECTION_UP:
if($SC_DURATION == 0)
$SC_DURATION = 120000;
OneWireShutter($SC_INSTANCE, 0, $SC_DURATION);
break;
case SC_DIRECTION_DOWN:
if($SC_DURATION == 0)
$SC_DURATION = 120000;
OneWireShutter($SC_INSTANCE, 1, $SC_DURATION);
break;
}
break;
case "{EE4A81C6-5C90-4DB7-AD2F-F6BBD521412E}": //Homematic Shutter
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
HM_WriteValueBoolean($SC_INSTANCE, "STOP", true);
break;
case SC_DIRECTION_UP:
HM_WriteValueFloat($SC_INSTANCE, "LEVEL", 1.0);
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
HM_WriteValueBoolean($SC_INSTANCE, "STOP", true);
}
break;
case SC_DIRECTION_DOWN:
HM_WriteValueFloat($SC_INSTANCE, "LEVEL", 0.0);
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
HM_WriteValueBoolean($SC_INSTANCE, "STOP", true);
}
break;
}
break;
default:
die("No Handler for Module ".$instance['ModuleInfo']['ModuleName']." found");
}
function OneWireShutter($ins, $dir, $sec) {
@TMEX_F29_SetStrobe($ins, True);
$res = ($dir * 128) + ($sec / 1000);
@TMEX_F29_SetPort((integer)$ins, (integer)$res);
}
function CreateVariableByName($id, $name, $type)
{
global $IPS_SELF;
$vid = @IPS_GetVariableIDByName($name, $id);
if($vid===false) {
$vid = IPS_CreateVariable($type);
IPS_SetParent($vid, $id);
IPS_SetName($vid, $name);
IPS_SetInfo($vid, "This Variable was created by Script #$IPS_SELF");
}
return $vid;
}
?>
<?
// Rollladen links
switch($SC_INSTANCE)
{
case 12058:
define("Rollladen_oben", 58689 /*[Innenbereich\Wohnhaus\Etage 3\Wohnzimmer\E3_Wohnzimmer_Rolladen_links_Shutter Control\.E3_Wohnzimmer_Rolladen_links_Taste_oben]*/);
define("Rollladen_mitte", 25327 /*[Innenbereich\Wohnhaus\Etage 3\Wohnzimmer\E3_Wohnzimmer_Rolladen_links_Shutter Control\.E3_Wohnzimmer_Rolladen_links_Taste_mitte]*/);
define("Rollladen_unten", 34977 /*[Innenbereich\Wohnhaus\Etage 3\Wohnzimmer\E3_Wohnzimmer_Rolladen_links_Shutter Control\.E3_Wohnzimmer_Rolladen_links_Taste_unten]*/);
break;
// Rollladen rechts
case 45568:
define("Rollladen_oben", 19315 /*[Innenbereich\Wohnhaus\Etage 3\Wohnzimmer\E3_Wohnzimmer_Rollladen_rechts_Shutter Control\.E3_Wohnzimmer_Rolladen_rechts_Taste_oben]*/);
define("Rollladen_mitte", 50957 /*[Innenbereich\Wohnhaus\Etage 3\Wohnzimmer\E3_Wohnzimmer_Rollladen_rechts_Shutter Control\.E3_Wohnzimmer_Rolladen_rechts_Taste_mitte]*/);
define("Rollladen_unten", 33733 /*[Innenbereich\Wohnhaus\Etage 3\Wohnzimmer\E3_Wohnzimmer_Rollladen_rechts_Shutter Control\.E3_Wohnzimmer_Rolladen_rechts_Taste_unten]*/);
break;
}
?>
Vielen Dank
Stefan