A script to control temperature setpoint

Exchange here your tips and question on eedomus rules and programming

A script to control temperature setpoint

Messagepar @VincentRecipon » 03 Nov 2016 00:34

Hi I've written a small php script for our beloved eedomus in order to control my floor heating system.

Php script isn't so complicated to write, particularly when you have such first draft. It's also easier to read that multiple rules working in parallel.

I've made a post about how to use this script in this post : http://www.vrdigitalworld.com/smarthome/domotiser-son-chauffage-au-sol?lang=en
Don't hesitate to have some question here or at the end of the post.

Finally here is the script you can also donwload from the post

Code : Tout sélectionner
<?
//********************************************************
//* Gestion consigne température RDC                 V02 *
//******************************** V. Recipon 2016-08-06 *
//********************************************************
$id_day_phase = getArg('dayphase');
$id_consigne = getArg('consigne');
$id_thermostat = getArg('thermostat');
$id_chauffage = getArg('chauffage');
$id_activite = getArg('activite');

$day_phase = getValue($id_day_phase);
$consigne = getValue($id_consigne);
$thermostat = getValue($id_thermostat);
$chauffage = getValue($id_chauffage);
$activite = getValue($id_activite);

// Sortie des valeurs pour debug
echo "Statut Pièce :<br>";
echo "  - Phase du jour : ".$day_phase['value']."<br>";
echo "  - Consigne : ".$consigne['value']."<br>";
echo "  - Thermostat : ".$thermostat['value']."<br>";
echo "  - Mode de Chauffage : ".$chauffage['value']."<br>";
echo "  - Détection d'activité dans la pièce : ".$activite['value']."<br>";


//--------------------------------------------------------
//----- Définition des valeurs pour les arguments    -----
//--------------------------------------------------------

// Valeurs phase du jour
$val_pyjama=0;
$val_reveil=10;
$val_presence=20;
$val_absence=40;
$val_retour=45;
$val_soiree=50;
$val_nuit=60;
$val_abs_prolongee=70;

//--------------------------------------------------------
//----- Gestion du chauffage                         -----
//--------------------------------------------------------
$settemp = $consigne['value'];

echo "Analyse besoin chauffage :<br>";

if ($chauffage['value'] == 0)
{
   echo "  > Chauffage éteint<br>";

   $settemp = 7;
}
else if ($chauffage['value'] == 200)
{
   echo "  > Chauffage marche forcée<br>";

   $settemp = 30;
}
else
{
   echo "|-> Chauffage allumé.<br>";
   
   if ($day_phase['value'] == $val_abs_prolongee)
   {
      echo "|---> Absence prolongée ou porte ouverte <br>";
      $settemp = 12;
   }
   else if ($day_phase['value'] == $val_nuit)
   {
      echo "|-----> Nuit <br>";
      $settemp = $consigne['value']-1;
   }
   else if ($day_phase['value'] == $val_absence)
   {
      echo "|-----> Absence<br>";
      $settemp = $consigne['value']-0.5;
   }
   else if ($day_phase['value'] == $val_reveil OR $day_phase['value'] == $val_retour)
   {
      echo "|-----> Réveil / retour <br>";
      $settemp = $consigne['value'];

   }
   else
   {
      echo "|-----> présence / soirée <br>";
      if ($activite['value'] == 0)
      {
         echo "|-------> Pas d'activité dans la pièce <br>";
         $settemp = $consigne['value']-0.25;
      }
      else
      {
         echo "|-------> Activité dans la pièce <br>";
         $settemp = $consigne['value'];
      }
   }
}

echo "<br>";
echo "Nouvelles consignes :<br>";

// On met à jour les valeurs des périphériques
// seulement si il y a eu changement, cela évite les interactions avec d'autres actions éventuelles sur les même périphériques (des macros en cours par exemple)

if ($settemp != $thermostat['value'])
{
   setValue($id_thermostat, $settemp);
   echo "  - Thermostat : ".$settemp." (Changement)<br>";      
}
else
   echo "  - Thermostat : ".$settemp." (Pas de changement)<br>";   
   
?>
@VincentRecipon
 
Messages : 19
Inscription : 29 Mai 2014

Re: A script to control temperature setpoint

Messagepar annemanike2 » 27 Mai 2023 07:20

The script then proceeds to analyze the heating requirements based on the provided arguments.

If the heating status is 0 (off), the set temperature is set to 7.
If the heating status is 200 (forced on), the set temperature is set to 30.
If the heating status is any other value, further analysis is performed based on the day phase:
If the day phase is "absence prolongée" (prolonged absence) or "porte ouverte" (door open), the set temperature is set to 12.
If the day phase is "nuit" (night), the set temperature is set to the desired temperature minus 1.
If the day phase is "absence" (absence), the set temperature is set to the desired temperature minus 0.5.
If the day phase is "réveil" (wake-up) or "retour" (return), the set temperature remains the same as the desired temperature.
For any other day phase (presumably "présence" - presence or "soirée" - evening), the set temperature is adjusted based on room activity:
If there is no activity in the room, the set temperature is decreased by 0.25.
If there is activity in the room, the set temperature remains the same as the desired temperature.
---------I Am Here- ApplinkedAptoide TV[B612 apk Android Camera--------
annemanike2
 
Messages : 1
Inscription : 27 Mai 2023


Retour vers Rules & Programming

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 4 invité(s)