]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 25 Nov 2022 12:04:07 +0000 (13:04 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 25 Nov 2022 12:04:07 +0000 (13:04 +0100)
.idea/dataSources.local.xml
.idea/workspace.xml
scripts/lib/scenes.php
scripts/lib/switchbot.php

index ac1846de8c5d25a82a48aa59b64d3d1a23b8d128..37718e2a1ff55489a35eb2e28bf80cdc48730615 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="dataSourceStorageLocal" created-in="IU-222.4345.14">
+  <component name="dataSourceStorageLocal" created-in="IU-222.4459.24">
     <data-source name="LFY(3).db" uuid="e5a3291d-855f-44b2-be41-76fe6b0c2136">
       <database-info product="SQLite" version="3.25.1" jdbc-version="2.1" driver-name="SQLite JDBC" driver-version="3.25.1" dbms="SQLITE" exact-version="3.25.1" exact-driver-version="3.25">
         <identifier-quote-string>&quot;</identifier-quote-string>
index 9a82287e0248975dc70a35407bbb8be0e26a053d..3ce24db9947b69db433c5a949d68640780f96dec 100644 (file)
@@ -3,9 +3,6 @@
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/water.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/water.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/hotwater.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/hotwater.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/redis.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/redis.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/switchbot.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/switchbot.php" afterDir="false" />
     </list>
       <workItem from="1667037570905" duration="1563000" />
       <workItem from="1667739527547" duration="1293000" />
       <workItem from="1668006276656" duration="1860000" />
-      <workItem from="1668260964528" duration="1497000" />
-    </task>
-    <task id="LOCAL-00493" summary=".">
-      <created>1639302540066</created>
-      <option name="number" value="00493" />
-      <option name="presentableId" value="LOCAL-00493" />
-      <option name="project" value="LOCAL" />
-      <updated>1639302540067</updated>
+      <workItem from="1668260964528" duration="2677000" />
+      <workItem from="1668672202122" duration="723000" />
+      <workItem from="1668769338986" duration="676000" />
+      <workItem from="1669206068222" duration="2217000" />
+      <workItem from="1669377758083" duration="43000" />
     </task>
     <task id="LOCAL-00494" summary=".">
       <created>1639837981727</created>
       <option name="project" value="LOCAL" />
       <updated>1668013144815</updated>
     </task>
-    <option name="localTasksCounter" value="542" />
+    <task id="LOCAL-00542" summary=".">
+      <created>1668415032851</created>
+      <option name="number" value="00542" />
+      <option name="presentableId" value="LOCAL-00542" />
+      <option name="project" value="LOCAL" />
+      <updated>1668415032851</updated>
+    </task>
+    <option name="localTasksCounter" value="543" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 05f3650e60eb70e0c85b2882ce52f7a633882c61..e9001df993478fe3e6008070247c27db16eabd20 100644 (file)
@@ -687,12 +687,23 @@ $scenes = [
     ],
 
     'home/welcome/eco' => [
+        ['type' => 'function', 'function' => 'welcomeEco'],
+    ],
+
+    'home/welcome/eco/salon' => [
         ['type' => 'scene', 'scene' => 'cuisine/on'],
         ['type' => 'scene', 'scene' => 'salon/auto'],
         ['type' => 'ecomode', 'mode' => '0'],
         ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
     ],
 
+    'home/welcome/eco/homeoffice' => [
+        ['type' => 'scene', 'scene' => 'cuisine/coffee/on'],
+        ['type' => 'scene', 'scene' => 'bureau/auto'],
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
+    ],
+
     'home/welcome' => [
         ['type' => 'scene', 'scene' => 'home/welcome/eco'],
         ['type' => 'scene', 'scene' => 'bureau/auto'],
@@ -759,7 +770,7 @@ $scenes = [
         ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1']],
     ],
     'sdb/hotwater/auto/force' => [
-        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1',true]],
+        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1', true]],
     ],
     'sdb/hotwater/eco' => [
         ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
@@ -891,6 +902,16 @@ $scenes = [
 ];
 
 
+function welcomeEco()
+{
+    $businessHour = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];
+    if (isWeekEnd() || !in_array(date('G'), $businessHour)) {
+        execScene('home/welcome/eco/salon');
+    } else {
+        execScene('home/welcome/eco/homeoffice');
+    }
+}
+
 function chambreRideaux($ouvre = true)
 {
     $device = 1756;
index 05ee08336ffd297081c5a9dbc450af08cb930c79..c740f771432fd808dff7175cd566bbf963a6dd00 100644 (file)
@@ -30,9 +30,9 @@ function hotwaterCheckMode($force = false)
     $vincent = isVincent($force);
 
     $h = date('G');
-    $d = date('N');
-    $isWeek = $d < 6;
-    $maxLevel = $jerome ? "2" : '1';
+    $isWeek = isWeekDay();
+
+    $maxLevel = '2';
 
     $ecomode = (int)getState('ecomode', '0');
 
@@ -56,7 +56,7 @@ function hotwaterCheckMode($force = false)
             }
         }
     }
-    echo "\n\n" . 'V:' . $vincent . '/J:' . $jerome . '/H:' . $h . '/D:' . $d . '/W:' . $hot . "\n\n";
+    echo "\n\n" . 'V:' . $vincent . '/J:' . $jerome . '/H:' . $h . '/WD:' . $isWeek . '/W:' . $hot . "\n\n";
     hotwater($hot);
 }
 
@@ -96,6 +96,17 @@ function hotwater($newState)
     return $res;
 }
 
+function isWeekDay()
+{
+    $d = date('N');
+    return $d < 6;
+}
+
+function isWeekEnd()
+{
+    return !isWeekDay();
+}
+
 function isVincent($force = false)
 {
     return remember('vincent_in_paris', 3600, function () {