Wakeup_fht in V2

Hallo PHP Künstler,

bin vor einiger Zeit auf die V2 umgestiegen und einige kleinere Scripte konnte ich umbasteln. Leider habe ich noch ein Script das ich nicht zum laufen bekomme. Ich habe hier mal das orig. Script. Einige von euch werden es kennen und habe es vieleicht schon für die V2 angepasst.

Wäre schön wenn ich hilfe bekommen könnte. Ist doch eine Nummer zu groß für mich PHP Leihe.

Mirco

<?
/*
*******************************
 IP-SYMCON Event Scripting
*******************************
File     : Wakeup_FHT.ips.php
Trigger  : Timer
Interval : every 15 minutes
Purpose  : Give fht's that fail to report Temp a kick
*/

// loop thourgh all IPS instances

$INSTANCE_LIST=(IPS_GetInstanceIDs());
// find FHZ and check if enough free buffers
foreach($INSTANCE_LIST as $IPS_INSTANCE)
{
   // Get the Module Instance
   $MODULE_INSTANCE=IPS_GetModuleInstance($IPS_INSTANCE);
   // check if this is the FHZ
   if ($MODULE_INSTANCE['moduleguid'] =='{57040540-4432-4220-8D2D-4676B57E223D}')
   {
    // check if at least 5 buffers free , leave some buffers for other things
    $FREE_BUFFERS = FHZ_GetFreeFHTBuffer($MODULE_INSTANCE['instanceid']) ;
    if ($FREE_BUFFERS > 5 )
      {
      // find the FHT's
        foreach($INSTANCE_LIST as $IPS_INSTANCE)
         {
         // check if we didnt fill to many buffers leave 2 for other things
         if  ($FREE_BUFFERS > 2)
         {
            $MODULE_INSTANCE=IPS_GetModuleInstance($IPS_INSTANCE);
            if ($MODULE_INSTANCE['moduleguid'] =='{A89F8DFA-A439-4BF1-B7CB-43D047208DDD}')
               {
               // get name of variable that tracks FHT temp
               $INSTANCE_DATA=IPS_GetInstanceSettings ($MODULE_INSTANCE['instanceid']);
               //       Echo $INSTANCE_DATA;
               // note 'TemeratureVar' is not a typo in this script, IPS reports it back like this!
               $TEMP_VARIABLE_NAME = substr(stristr(stristr($INSTANCE_DATA,'TemeratureVar Value="'),'"'),1);
               $TEMP_VARIABLE_NAME = substr($TEMP_VARIABLE_NAME,0,strpos($TEMP_VARIABLE_NAME,'"'));
               echo $TEMP_VARIABLE_NAME;
               // :( there must e better ways to parse this, but it works
               // Get time it was last updated
               $LAST_TEMP_UPDATE =IPS_GetUpdateTime ($TEMP_VARIABLE_NAME);
               // if no update for more than 15 minutes then send something to the FHT to wake it up
               if (TIME() - $LAST_TEMP_UPDATE  > 9)
                  {
                  // get name of variable that tracks the FHT mode
                  $MODE_VARIABLE_NAME = substr(stristr(stristr($INSTANCE_DATA,'TargetModeVar Value="'),'"'),1);
                  $MODE_VARIABLE_NAME = substr($MODE_VARIABLE_NAME,0,strpos($MODE_VARIABLE_NAME,'"'));
                   // get the current mode of fht
                  $FHT_CURRENT_MODE =GetValueInteger($MODE_VARIABLE_NAME);
                  //set the FHT to its current mode, changes nothing but triggers 'is' temperatures to be sent again
                  FHT_SetMode ($MODULE_INSTANCE['instanceid'],$FHT_CURRENT_MODE);
                  IPS_LogMessage ('Kicked FHT',$TEMP_VARIABLE_NAME);
                  echo        $TEMP_VARIABLE_NAME;
                  $FREE_BUFFERS =$FREE_BUFFERS -1;
                  }
               }
            }
         }
      }
   }
}
?>