Frage zu sFHTs TimeTable

Hallo zusammen,

ich versuche das sFHTs von V1 in V2 zu konvertieren, denke das mir das bis jetzt ganz gut gelungen ist.

Allerdings habe ich jetzt ein kleines prob. (oder Tomaten auf den Augen).

Ich habe soweit verstanden wofür die ganzen Buchstaben sind:

Season
: W for Winter;
: S for Sommer;

Status
: H für „Ich bin zuhause“ Regelung";
: W für „Ich bin nicht zuhause“ Regelung;
: P für „Party“ Regelung

: D for Default - ALWAYS USE

Day
: 0 Sonntag to 6 for su - sa
: 7 für Wochenende (Sa & So)
: 9 für Täglich (jeden Tag)

ich finde dort aber auch den Buchstaben I

z.Bsp.

IS9 vwhz_temp x x |||||||||…u.s.w

entweder sitze ich zu lange am PC oder dazu gibt es keine Erklärung!

Kann mir jemand weiter Helfen?

Gruß Michael

Hallo Michael,

ich hatte mich in der Vergangenheit intensiv damit beschäftigt (und immer noch in der V1 im Einsatz) und glaube mich zu erinnern, dass der Buchstabe „I“ für alle nicht Holiday Einträge zu nutzen ist (steht sicher für ‚Index‘).

Z.B.:

IW9 vla1_temp ==> wird bei allen ‚normalen‘ Tagen genommen

HW9 vla1_temp ==> wird bei ‚matching‘ Feiertagen genommen

Gruss babba

Hallo babba,

danke für den Hinweis, werde das mal ausprobieren.:slight_smile:

Gruß Michael

Hey Jungs, mädels,

Was baba da schreibt stimmt ganz genau…
Die ‚normale‘ entries gehen mit einer I vorab. I fur Index

Könnte ich mal die v2 version nachsehen bitte? Was sollte da alles angepast werden?
Sollte man langsam nicht mal das wiki auf V2 stand bringen?

Ich bin schon langem nicht mehr an die Kiste gegangen… Vieles hat sich privé geändert deshalb.
Traue mich uberhaupt nicht mehr an die V2 zu gehen :smiley: da gibt es wochen lang zu lesen glaube ich :wink:

Deshalb eure treue hilfe wurde mich ein stuck weiter bringen :wink:

Grusse aus Belgien (wo es jetzt sturmt)
Euer Fredje

Hallo Michael (qs9000) hört sich irgendwie nach Qualitöter an :cool:

Könnte ich mal die v2 version nachsehen bitte?

würde mich auch sehr interessieren, da ich dann so langsam mal die Migration nach V2 beginnen möchte.

Gruss Dieter

Hy zusammen,

@babba -> mir viel zur Zeit nichts besseres ein, allerding liegst du da nicht ganz
falsch, ich Arbeite im größten Aluminiumwalzwerk der Welt :wink: und qs9000 war und ist bis Heute ein Thema.

Hier das script was bei mir( soweit ich erkennen kann läuft )!

Die Variablen und die GlobalDefines müssen nach wie vor wie beschrieben in der WIKI angelegt werden!

@Fredje danke für Info, Grüsse nach Belgien (hier ist das Wetter auch nicht besser).

 <?

 /*
*******************************
 IP-SYNCOM Event Scripting
*******************************
*/
//File: sFHTs.ips.php   PUBLIC       : 0.70   date  08/11/06
//File: sFHTs.ips.php   BETA VERSION : 0.69   date  04/11/06 '7' settings in .ini weekend bad interpret bug by Prof
//File: sFHTs.ips.php   BETA VERSION : 0.68   date  01/11/06 flank-detection problem due to TimerEvent and RunScript
//File: sFHTs.ips.php   BETA VERSION : 0.67   date  29/10/06 flank-detection doesn't work in S regime. bug by Torsteng
//File: sFHTs.ips.php   BETA VERSION : 0.66   date  18/06/06 Back to basic - no good
//File: sFHTs.ips.php   BETA VERSION : 0.65   date  18/06/06 semaphore test
//File: sFHTs.ips.php   BETA VERSION : 0.64   date  17/06/06 debug switch
//File: sFHTs.ips.php   PUBLIC       : 0.63   date  23/01/06
//
//Events : __imhome, __imaway, __party and all FHT_status-intervention variables
/*
Copyright rules applie under GNU-regulations
rest of copyright text ToDo
*/


include("42484.ips.php");
   /* variables needed in GlobalDefines.ips.php !!
      see "tempsettings.ini" and modifie to your environment /*

   /**********  USER SETTINGS  ***********************************************/
   $tempfilepath=__myhome."tempsettings.ini"; //default: 'tempsettings.ini'
   //              |---> defined in GlobalDefines.ips.php

   $use_imhome = true;
   // Note : A IPS variabele '__iamhome' should exist !!
      /* use this switch to overrule general settings
      the effect is that if IPS-variable "__imhome" = true
      the HOLIDAY temperature is sent as the result of
      this function
      !! ATTENTION  BETA WORK !!
      19/11/2005 :  I am not happy with how this implemented but it's a start
      */

   $use_imaway = true;
   // Note : A IPS variabele '__iamaway' should exist !!
      /* use this switch to overrule general settings
      the effect is that if IPS-variable "__imaway" = true
      the AWAY temperature is sent as the result of
      this function
      !! ATTENTION  BETA WORK !!
      */

   $use_party = true;
   // Note : A IPS variabele '__party' should exist !!
      /* For all the party people out there ;-)
      Do YOU Like the Way YOU Feel when YOU Shake
      the effect is that if IPS-variable "__party" = true
      the party settings applie without checking days or dates.
      So starting on a Saturday will set party temperatures until
      you set __party=false on the Wednesday. (Oh my God what a party)
      */
   /**********  END OF USER SETTINGS  ****************************************/

   /**********  ADAPTATION TO YOUR ENVIROMENT  *******************************
   Every FHT has to have 2 variables with the names hereunder
   v(your-name)_soll : f.i. "vliv_temp_soll" = FHT soll temp in livingroom
   o(your-name)      : f.i. "oliv_temp" = device ID of the
                            FHT instance (set in GlobalDefines.ips.php)
   ***********  END ADAPTATION  **********************************************/

   /**********  DEBUG SWITCHES  **********************************************/
   $softswitch = true; /*    Send the temp-settings to FHT or not
                             If you're debugging set it to false
                             so FHZ won't be overbuffered            */
   $use_sollwert = false;
   $sollwert = "19";      //is 'use_sollwert' = true then take this value

   // if you want a master-debug switch : create an IPS variabele "__debug"
   if (IPS_VariableExists(28293 /*[sFHTs\__debug]*/)){
      $debug = GetValueBoolean(28293 /*[sFHTs\__debug]*/);
   } else {
      $debug = false;   // set to true if you want to enable echo-output
   }
   /* logfilepath since we are dealing with variables which cannot be show in
      the direct output window.                                              */
   $logfilepath=__myhome."log/tempSENT.txt";

//   $IPS_SENDER = "TimerEvent";

   /**********  END DEBUG  ***************************************************/

if ($IPS_SENDER == "Designer"){
//do not run when event is triggered by designer
   return;
}
if (IPS_VariableExists(48161 /*[sFHTs\__fht_inhibit]*/)){
   if (GetValueBoolean(48161 /*[sFHTs\__fht_inhibit]*/)){
      if($debug) echo("INHIBITED by '__fht_inhibit'");
      return;
   }
}
if ($IPS_SENDER == "Variable"){
   /* Switch ONLY when __imaway becomes true or __imhome becomes true
      die if false -> script will be triggered in max 30 minutes.
      if settings change from imhome -> imaway, then FHZ buffer get's
      overbuffered because script did run 2 times
      imhome -> false, imaway -> true x 5 FHT-devices = buffer overrun */
   if ($IPS_VARIABLE == "__imaway" && !GetValueBoolean(20271 /*[sFHTs\__imaway]*/)) die;
   // die when imhome = false
   if ($IPS_VARIABLE == "__imhome" && !GetValueBoolean(48485 /*[sFHTs\__imhome]*/)) die;
   if ($IPS_VARIABLE == "__party" && !GetValueBoolean(17551 /*[sFHTs\__party]*/)) die;
   $lastrun=IPS_GetLastRun("GetTemp");
}
if (!file_exists("$tempfilepath")) {
   echo("

******* ERROR: Please install '$tempfilepath'

");
   die;
}
$handle=fopen("$tempfilepath", "r");
if (!$handle){
   // error cannot open file
   echo("******* ERROR: Cannot open file '$tempfilepath'
");
}
//init variable
$aktor = array();
$now = getdate();
$isholiday = false;
$isparty = false;
$holiday="";
$season = "";
$today="";
$alldays="";
$weekend="";
$imhome=false;
$party=false;
$temp_rule="";
if ($use_imhome && IPS_VariableExists(48485 /*[sFHTs\__imhome]*/)){
   $imhome = GetValueBoolean(48485 /*[sFHTs\__imhome]*/);
} elseif ($use_imhome) {
   echo("

******* NOTICE: Variabele '__imhome' not found as a valid IPS variabele

");
   $imhome = false;
} else {
   $imhome = false;
}
if ($use_imaway && IPS_VariableExists(20271 /*[sFHTs\__imaway]*/)){
   $imaway = GetValueBoolean(20271 /*[sFHTs\__imaway]*/);
} elseif ($use_imaway) {
   echo("

******* NOTICE: Variabele '__imaway' not found as a valid IPS variabele

");
   $imaway = false;
} else {
   $imaway = false;
}
if ($use_party && IPS_VariableExists(17551 /*[sFHTs\__party]*/)){
   $party = GetValueBoolean(17551 /*[sFHTs\__party]*/);
} elseif ($use_party) {
   echo("

******* NOTICE: Variabele '__party' not found as a valid IPS variabele

");
   $party = false;
} else {
   $party = false;
}
// the serious work   start with settin' the inhibit switch
SetValueBoolean(48161 /*[sFHTs\__fht_inhibit]*/,true);
// end modifie

while(!feof($handle)) {
   $buffer = fgets($handle);
   Switch (substr($buffer,0,1)) {
   case "@":
      //general settings
      if (substr($buffer,1,7) == "season=") {
         $season = substr($buffer,8,1);
      }
      if (substr($buffer,1,1) == "H") {
         if ((sprintf("%02d",$now["mon"])."/".sprintf("%02d",$now["mday"]) == substr($buffer,2,5)) or (sprintf("%02d",$now["mon"])."/".sprintf("%02d",$now["mday"])."/".$now["year"] == substr($buffer,2,10))) {
            $isholiday = true;
            $temp_rule = substr($buffer,strpos($buffer,"#")+1,strlen($buffer)-strpos($buffer,"#")-3);
            if ($debug) echo "temp rule : $temp_rule";
         }
      }
      break;
   case "D":
      //DEFAULT lines
      if (substr($buffer,1,1) == "$season" && chop(substr($buffer,4,14))=="default"){
          // get default default or default room
          // aktor("default" -> $default OR "room" -> $default)
          $default = substr($buffer,27,48);
      } elseif (substr($buffer,1,1) == "$season") {
         $aktor[chop(substr($buffer,4,14))]["default"] = substr($buffer,27,48);
      }
      break;
   case "H":
      //HOLIDAY table entries
      if ($isholiday) {
         // NOTE THEM DOWN IN array[aktor,["holiday"]
         if (substr($buffer,1,1) == "$season") $aktor[chop(substr($buffer,4,14))]["holiday"]= substr($buffer,27,48);
      } else {
         if (substr($buffer,1,1) == "$season") $aktor[chop(substr($buffer,4,14))]["iamhome"]= substr($buffer,27,48);
      }
      break;
   case "I":
      //Table entries
      // GET RID OF THIS INSTRUCTION    GET THEM ALLL ;-)
      // array[substr(....),alldays, weekends, thisday]
      // ???? Should we apply precendence RULE here ??
      // WE SHOULD HAVE ALL INFO --> see tempfile.ini
      // SO HERE WE DEPEND THE RULE TO APPLY
      // WHAT IF NOT ?? NO APPLICABLE ENTRY ?? THEREFORE ALL THESE IF INSTRUCTIONS
         if ((substr($buffer,1,1) == "$season") and (substr($buffer,2,1) == "9")) $aktor[chop(substr($buffer,4,14))]["alldays"] = substr($buffer,27,48);
         if ((substr($buffer,1,1) == "$season") and (substr($buffer,2,1) == "7") and (($now["wday"] == 0) or ($now["wday"] == 6))) $aktor[chop(substr($buffer,4,14))]["weekend"] = substr($buffer,27,48);
         if ((substr($buffer,1,1) == "$season") and (substr($buffer,2,1) == $now["wday"])) $aktor[chop(substr($buffer,4,14))]["today"]= substr($buffer,27,48);
      break;
   case "W":
      // IamAway settings
      if (substr($buffer,1,1) == "$season" && chop(substr($buffer,4,14))=="default"){
          // get default default or default room
          // aktor("default" -> $default OR "room" -> $default)
          if ($imaway) $default = substr($buffer,27,48);
      }
      break;
   case "P":
      // PaAaRtY settings
      // no date-jump will occure !!
      // tryout 26/11/2005
      if (substr($buffer,1,1) == "$season") $aktor[chop(substr($buffer,4,14))]["party"]= substr($buffer,27,48);
      break;
   default:
      //only thing to expect are comments '#' and temp settings
      // PUT IN ARRAY !!! WE NEED THEM LATER
      // USE array[sign => value]
      if (substr($buffer,0,1) <> "#") {
         $temp[substr($buffer,0,1)] = substr($buffer,1,5);
      }
   }
}
$temp["0"]=false;
$temp["1"]=true;
fclose($handle);
if ($debug) {
   foreach($aktor as $key => $value){
      $thisday = $now["wday"];
      if ($debug) echo("
RESULT for '$key'
--------
");
      if ($debug) echo("  now             :'". $now["hours"] .":". $now["minutes"] . "'
");
      if ($debug) echo("  today is nr#    : $thisday
");
      if ($debug) echo("  season          : $season
");
      if ($debug) echo("  Is it a holiday : $isholiday
");
      if ($debug) echo("  Check precendence hereunder
");
      if ($debug) echo("  Am I home ?     : $imhome
");
      if(array_key_exists("iamhome",$value) && $debug)echo("  IAmHome         : ".$aktor[$key]["iamhome"]."
");
      if ($debug) echo("  Am I away ?     : $imaway
");
      if(array_key_exists("iamaway",$value) && $debug)echo("  IAmAway         : ".$aktor[$key]["iamaway"]."
");
      if(array_key_exists("holiday",$value) && $debug)echo("  holiday         : ".$aktor[$key]["holiday"]."
");
      if ($debug) echo("  Paaaartyy ?     : $party
");
      if(array_key_exists("party",$value) && $debug)echo("  Party           : ".$aktor[$key]["party"]."
");
      if(array_key_exists("today",$value) && $debug)echo("  today           : ".$aktor[$key]["today"]."
");
      if(array_key_exists("weekend",$value) && $debug)echo("  weekends        : ".$value["weekend"]."
");
      if(array_key_exists("alldays",$value) && $debug)echo("  alldays         : ".$aktor[$key]["alldays"]."
");
      if(array_key_exists("default",$value) && $debug)echo("  default rule    : ".$aktor[$key]["default"]."
");
      if ($debug) echo("  def. def. rule: $default
");
      if ($debug) echo("--------------------------------------------------
");
   } //for
} //if
/* precendence rules
   ON ALL ELEMENTS OF ARRAY = Aktors
   VARIABLES = FIELDS OF ARRAY ("AKTOR" [ROOMDEFAULT, HRule, DayRULE, RESULT, soll)
   NEGATIVE LOGIC    Variables are filled in IF applicable */
if ($debug) echo"

";
foreach($aktor as $key => $value){
   if (!array_key_exists("holiday", $value)) {
      if (!array_key_exists("today", $value)) {
         if (!array_key_exists("weekend", $value)) {
            if (!array_key_exists("alldays", $value)) {
               if (!array_key_exists("default", $value)) {
                  $aktor[$key]["result"] = $default;
                  if ($debug) echo "res = def. def";
               } else {
                  $aktor[$key]["result"] = $value["default"];
                  if ($debug) echo "res = default";
               } // if
            } else {
               $aktor[$key]["result"] = $value["alldays"];
               if ($debug) echo "res = alldays";
            }
         } else {
            $aktor[$key]["result"] = $value["weekend"];
            if ($debug) echo "res = weekend";
         }
      } else {
         $aktor[$key]["result"] = $value["today"];
         if ($debug) echo "res = today";
      }
   } else {
      $aktor[$key]["result"] = $value["holiday"];
      if ($debug) echo "res = holiday";
   }
   // attempt to set IAmHome rule !!
   if ($use_imhome and $imhome) {
      if (array_key_exists("iamhome", $value)){
         $aktor[$key]["result"] = $value["iamhome"];
         echo "
OVERRULED RESULT set to HOLIDAY because I AM HOME
";
      }
   }
   // attemp to set Away-rule
   if ($use_imaway and $imaway) {
      $aktor[$key]["result"] = $default;
      if ($debug) echo ("
OVERRULED RESULT set to AWAY
");
   }
   // attempt to set Party rule !!
   if ($use_party and $party) {
      if (array_key_exists("party", $value)){
         $aktor[$key]["result"] = $value["party"];
         echo "
OVERRULED RESULT set to PaAaRrTYyyyy
";
      }
   }
   if ($debug) echo("
For '$key' I did choose    : '".$aktor[$key]["result"]."'
");
}
// here we get the temperature out of string
// USE ARRAY["AKTOR", "soll"]
// change 11/10/2005 'floor' into 'round' because otherwise allways back to ??h00 instead of ??h00 or ??h30
$pos = $now["hours"]*2 + round($now["minutes"]/30);
$prevpos = $pos - 1;
if ($debug) echo("hours: " . $now["hours"] . " hours *2 = " . $now["hours"]*2 . "round($now[minutes]/30) = " . (round($now["minutes"]/30) . "
"));
if ($debug) echo "pos = '$pos'  (check midnight !!
";
// end change
foreach($aktor as $key => $value){
   $aktor[$key]["soll"] = $temp[substr($value["result"],$pos,1)];
   if ($debug) echo "res  : '" . $value["result"]."'
";
   if ($debug) echo "time : '12345678901234567890123456789012345678'
";
   if ($debug) echo "temp = '" . $aktor[$key]["soll"]."'
";
}
// and now deal with the state-event.
// detect flanks
//if ($temp[substr($value["result"],$pos,1)] <> $temp[substr($value["result"],$pos,1)]){

// 11/10/2005 This is still a burdon !! damn boy ... where do you wanne drive the MIN-TEMP to ? and MAX-TEMP ?
//if ($use_imhome and $imhome) {
//   $soll = $temp["+"];
//   $status = "OVERRULED  set to";
//} elseif ($use_imhome) {
//   $soll = $temp["-"];
//   $status = "OVERRULED  set to";
//} else {
//   $status = substr($result,$pos,1)."     : ";
//}
// 19/11/2005 : decided when 'I am Home' is selected to choose 'holiday'-rule

$handle = fopen("$logfilepath","a");
$neg = "NOT (SSw)";
if ($softswitch) $neg = "";

// GET ALL AKTORS OUT OF ARRAY["AKTOR","SOLL"] = nice result of all the -above- work
// loop here : for every aktor in array : setTemp(Aktor, argument);
$junk = 1;
foreach($aktor as $key => $value){
   if ($use_sollwert) {
      echo("OVERRULED BY use_sollwert");
      $value["soll"]= $sollwert;
   }
   SetValueFloat($key."_soll",floatval($value["soll"]));
   if ($debug) echo("FHT temp for '$key"."_soll' set to '".$value["soll"]."' !!
");
   // as the result of the function set aktors to soll
   $thisinstance = "o" . substr($key,1);
   if (!defined($thisinstance)) {
      echo("

******* NOTICE: FHT-ID ($thisinstance) not defined in GlobalDefines.ips.php

");
   } elseif (!IPS_InstanceExists(constant($thisinstance))) {
      echo("

******* NOTICE: FHT with ID '". constant($thisinstance) . "' is not a valid instance in IPS.

");
   } else {
      if ($IPS_SENDER == "Variable") {
         if ($IPS_VARIABLE == "__imhome" || $IPS_VARIABLE == "__imaway" || $IPS_VARIABLE == "__party"){
            if ($softswitch) FHT_SetTemperature(constant($thisinstance),floatval($value["soll"]));
            if ($debug) echo("FHT_SetTemp for $thisinstance $neg SENT due to '$IPS_VARIABLE'-trigger
");
            if ($debug) fwrite($handle, date("d.m.y")."  ". date("H:i:s")."  $IPS_SENDER  - FHT_SetTemp for $thisinstance $neg SENT due to '$IPS_VARIABLE'-trigger
");
         } else {
            if ($debug) fwrite($handle,  date("d.m.y")."  ". date("H:i:s")."  $IPS_SENDER  - $thisinstance is set EXTERNALLY to " . GetValueFloat($key."_state") . "°C due to '$IPS_VARIABLE'-trigger (no value sent... logging only)
");
         }
      } elseif ($IPS_SENDER == "RunScript") {
         // only set soll-temp if there are changes required (flank-detection) to reset manual intervention
         if ($debug) echo("Trigger : timerevent, Is '" . $temp[substr($value["result"],$pos,1)] . "' = '" . $temp[substr($value["result"],$prevpos,1)] . "' ?
");
         if ($temp[substr($value["result"],$pos,1)] <> $temp[substr($value["result"],$prevpos,1)]){
            //flank detected
            if ($softswitch) FHT_SetTemperature(constant($thisinstance),floatval($value["soll"]));
            if ($debug) echo("FHT_SetTemp for $thisinstance $neg SENT due to change of setting (flank detection).
");
            if ($debug) fwrite($handle, date("d.m.y")."  ". date("H:i:s")."  $IPS_SENDER  - FHT_SetTemp for $thisinstance $neg SENT due to change of setting (flank detection).
");
         } else {
            if ($debug) fwrite($handle, date("d.m.y")."  ". date("H:i:s")."  $IPS_SENDER  - No flank detected for $thisinstance.
");
         }
      } else {
         //manual exec.
         if ($softswitch) FHT_SetTemperature(constant($thisinstance),floatval($value["soll"]));
         if ($debug) echo("FHT_SetTemp for $thisinstance $neg SENT due to manual-exec.
");
         if ($debug) fwrite($handle, date("d.m.y")."  ". date("H:i:s")."  $IPS_SENDER/MANUAL - FHT_SetTemp for $thisinstance $neg SENT due to manual-exec.
");
      }
   }
   // ugly way to handle FHZ buffer issues
   // should be done by multiple passes so max 6 commands every 6 minutes
   // multiple passes ToDo
   // Paresy talked about a FHT1000 buffer; maybe there is a way to deal with this??

   // removed in version: 0.66 FHT-buffer now in place
   //if (bcmod($junk, 6) == 0) IPS_Sleep(1000*10); // wait 10 seconds FHZbuffer !!;
   //$junk += 1;
}
// 2006/05/30 modifie due to multi-hreads
SetValueBoolean(48161 /*[sFHTs\__fht_inhibit]*/,false);
// 2006/05/30 end modifie
if ($debug) echo("Finished 
");
if ($debug) fclose($handle);

?>

Ich kann, im moment nicht mehr sagen wo ich was geändert habe(müde) aber es war wirklich nur eine Kleinigkeit, ein oder zwei Befehle die zur V2 geändert wurden!

Gruß Michael