Hallo Andreas
Erstmal Danke für die Antwort. Also Deine Skripte sind wirklich sehr gut aber doch ein wenig zu viel für mich. Im moment habe ich das Shutter Modul im einsatz und es klappt auch sehr gut. Ich habe es noch ein wenig umgebaut damit es mit meiner Umsetzung klappt jetzt brauche ich auch eigentlich nur noch das meine Taster mit eingebunden werden(sind nicht direkt verknüpft).
Hier mal mein Skript ich habe einfach ein paar Sachen die für LCN gedacht waren mit übernommen. Vieleicht hilft das ja weiter.
<?
//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 */
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 "{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 "{EE4A81C6-5C90-4DB7-AD2F-F6BBD521412E}": //Homematic Shutter
switch($SC_DIRECTION)
{
case SC_DIRECTION_STOP:
HM_WriteValueBoolean($SC_INSTANCE,"STATE",false);
HM_WriteValueBoolean($SC_INSTANCE2,"STATE",false);
break;
case SC_DIRECTION_UP:
HM_WriteValueBoolean($SC_INSTANCE2,"STATE", true);
HM_WriteValueBoolean($SC_INSTANCE,"STATE",true); // Um Relaisrichtung zu ändern bitte auf true
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
HM_WriteValueBoolean($SC_INSTANCE,"STATE",false);
HM_WriteValueBoolean($SC_INSTANCE2,"STATE",false);
}
break;
case SC_DIRECTION_DOWN:
HM_WriteValueBoolean($SC_INSTANCE,"STATE", true);
HM_WriteValueBoolean($SC_INSTANCE2,"STATE",false);// Um Relaisrichtung zu ändern bitte auf false
if($SC_DURATION > 0)
{
IPS_Sleep($SC_DURATION);
HM_WriteValueBoolean($SC_INSTANCE,"STATE",false);
HM_WriteValueBoolean($SC_INSTANCE2,"STATE",false);
}
break;
}
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;
}
?>