Du könntest das Ganze aber auch über eine HTML-Textbox abhandeln. So mache ich das. Immer wenn sich ein Zustand ändert wird die Box neu aufgebaut und angezeigt. Ich zeige die Zustände alle an aber man kann das Skript ja auch so umbauen, dass es bei geschlossen Fenster nicht rendert.
Hier mal der Ansatz wobei das Skript nicht von mir ist, ich hab es nur etwas modifiziert:
<?
IPSUtils_Include ("IPSLogger.inc.php", "IPSLibrary::app::core::IPSLogger");
$bordercolor = "#505050"; // Rahmenfarbe anpassen
$EG = ""; //Strings für die Texte der Geschosse
$OG = "";
$DG = "";
$HT = "";
$LEER = "<tr height='4px'><td /></tr>";
$str = "<table style='border-bottom:1px solid $bordercolor' width='100%' cellspacing='0'>"; //String für das gesamte HTML-Textfeld
foreach(IPS_GetInstanceListByModuleID("{EE4A81C6-5C90-4DB7-AD2F-F6BBD521412E}") as $ids)
{
$id = IPS_GetInstance($ids);
$ident = @IPS_GetObjectIDByIdent("STATE", $id['InstanceID']);
if($ident !== false)
{
$var = IPS_GetVariable($ident);
//IPSLogger_Inf (__file__, $var['VariableCustomProfile']);
// Integer Variable (Drehgriffkontakte)
if(($var['VariableValue']['ValueType'] == 1) && ($var['VariableCustomProfile'] == "TuerStatus"))
{
if(@IPS_GetEventIDByName("Event".$var['VariableID'], $_IPS['SELF']) === false)
{
$ereignis = IPS_CreateEvent(0);
IPS_SetEventTrigger($ereignis, 1, $var['VariableID']);
IPS_SetParent($ereignis, $_IPS['SELF']);
IPS_SetName($ereignis, "Event".$var['VariableID']);
IPS_SetEventActive($ereignis, true);
}
//Setze den Status pro Element
switch(GetValue($var['VariableID']))
{
case 0:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='50px'><img src='/user/skins/CustomIcons-master/icons/Terrassentuer_geschlossen.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor=#004000>Geschlossen</td>";
break;
case 1:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='38px'><img src='/user/skins/CustomIcons-master/icons/Fenster_gekippt.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor='#C08800'>Gekippt</td>";
break;
case 2:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='38px'><img src='/user/skins/CustomIcons-master/icons/Terrassentuer_offen.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor=#800000>Geöffnet</td>";
break;
}
$name = IPS_GetObject($var['VariableID']);
//Sortiere das Element in die Geschosse
switch (substr(IPS_GetName(IPS_GetParent($name['ParentID'])), 0, 2))
{
case "EG":
$EG .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
break;
case "OG":
$OG .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
break;
case "DG":
$DG .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
break;
}
}
$profil = IPS_GetVariable($var['VariableID']);
// Integer Variable (Drehgriffkontakte)
if(($var['VariableValue']['ValueType'] == 1) && ($var['VariableCustomProfile'] == "FensterStatus"))
{
if(@IPS_GetEventIDByName("Event".$var['VariableID'], $_IPS['SELF']) === false)
{
$ereignis = IPS_CreateEvent(0);
IPS_SetEventTrigger($ereignis, 1, $var['VariableID']);
IPS_SetParent($ereignis, $_IPS['SELF']);
IPS_SetName($ereignis, "Event".$var['VariableID']);
IPS_SetEventActive($ereignis, true);
}
//Setze den Status pro Element
switch(GetValue($var['VariableID']))
{
case 0:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='50px'><img src='/user/skins/CustomIcons-master/icons/Fenster_geschlossen.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor=#004000>Geschlossen</td>";
break;
case 1:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='38px'><img src='/user/skins/CustomIcons-master/icons/Fenster_gekippt.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor='#C08800'>Gekippt</td>";
break;
case 2:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='38px'><img src='/user/skins/CustomIcons-master/icons/Fenster_offen.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor=#800000>Geöffnet</td>";
break;
}
$name = IPS_GetObject($var['VariableID']);
//Sortiere das Element in die Geschosse
switch (substr(IPS_GetName(IPS_GetParent($name['ParentID'])), 0, 2))
{
case "EG":
$EG .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
break;
case "OG":
$OG .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
break;
case "DG":
$DG .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
break;
}
}
$profil = IPS_GetVariable($var['VariableID']);
// bool Variable (Fensterkontakte)
if(($var['VariableValue']['ValueType'] == 0) && ($var['VariableCustomProfile'] == "HausTuerStatus")) // Profil eintragen
{
if(@IPS_GetEventIDByName("Event".$var['VariableID'], $_IPS['SELF']) === false)
{
$ereignis = IPS_CreateEvent(0);
IPS_SetEventTrigger($ereignis, 1, $var['VariableID']);
IPS_SetParent($ereignis, $_IPS['SELF']);
IPS_SetName($ereignis, "Event".$var['VariableID']);
IPS_SetEventActive($ereignis, true);
}
//Setze den Status pro Element
switch(GetValue($var['VariableID']))
{
case 0:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='38px'> <img src='/user/skins/CustomIcons-master/icons/Tuer_geschlossen.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor=#004000>Geschlossen</td>";
break;
case 1:
$img = "<td style='border-width:1px 0 0 1px; border-style:solid; border-color:$bordercolor;' align='center' bgcolor='#27292B' width='38px'><img src='/user/skins/CustomIcons-master/icons/Tuer_offen.png'></td>";
$changedID = IPS_GetVariable($var['VariableID']);
$value = "<td style='border-width:1px 1px 0 1px; border-style:solid; border-color:$bordercolor;' width='16%' align='center' bgcolor='#800000'>Geöffnet</td>";
break;
}
$name = IPS_GetObject($var['VariableID']);
$HT .= "<tr height='38px'>$img<td style='border-top:1px solid $bordercolor' bgcolor='#27292B' width='67%'> ".IPS_GetName(IPS_GetParent($name['ParentID']))."</td>".$value."</tr>";
}
}
}
$str .= $HT.$LEER;
$str .= $EG.$LEER;
$str .= $OG.$LEER;
$str .= $DG;
$str .= "</table>";
SetValue(36261 /*[Program\Status\Data\Tür-/Fensterstatus]*/, $str);
?>
Über die Geschosse mache ich die Zuordnung welches Element wo stehen soll und sorge dann noch dafür, dass die einzelnen Abschnitte etwas getrennt dargestellt werden zur besseren Übersicht.
Alle Elemente, die Berücksichtigt werden sollen müssen den entsprechenden Variablentyp haben. Ich unterscheide Fenster und Türstatus weil ich da unterschiedliche Bilder rendere und Haustür geht nur Auf oder Zu aber nicht Gekippt.
Vielleicht hilft das ja.