]> _ Git - tortuga-home.git/commitdiff
.
authorvincent <vincent@enhydra.fr>
Fri, 7 Jan 2022 17:57:10 +0000 (18:57 +0100)
committervincent <vincent@enhydra.fr>
Fri, 7 Jan 2022 17:57:10 +0000 (18:57 +0100)
.idea/workspace.xml
scripts/cron/cron.php
scripts/domoticz_device_event.php
scripts/lib/denon.php
scripts/lib/scenes.php
scripts/lib/shield.php
servers/logcat.php

index 2056f32fb10bd2e395bc80758914476bb20a233a..f3c0c15415245928288aa7c30e71f3b36313b2b5 100644 (file)
@@ -4,6 +4,9 @@
     <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$/scripts/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/domoticz_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_device_event.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/denon.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/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/logcat.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
     </list>
       <workItem from="1640605282180" duration="3543000" />
       <workItem from="1640618757588" duration="59000" />
       <workItem from="1640778900839" duration="879000" />
-      <workItem from="1640787196827" duration="1027000" />
-    </task>
-    <task id="LOCAL-00451" summary=".">
-      <created>1613067752007</created>
-      <option name="number" value="00451" />
-      <option name="presentableId" value="LOCAL-00451" />
-      <option name="project" value="LOCAL" />
-      <updated>1613067752007</updated>
+      <workItem from="1640787196827" duration="2522000" />
+      <workItem from="1641573994164" duration="2000" />
+      <workItem from="1641574032847" duration="1662000" />
     </task>
     <task id="LOCAL-00452" summary=".">
       <created>1613738341286</created>
       <option name="project" value="LOCAL" />
       <updated>1640615601707</updated>
     </task>
-    <option name="localTasksCounter" value="500" />
+    <task id="LOCAL-00500" summary=".">
+      <created>1640788248689</created>
+      <option name="number" value="00500" />
+      <option name="presentableId" value="LOCAL-00500" />
+      <option name="project" value="LOCAL" />
+      <updated>1640788248690</updated>
+    </task>
+    <option name="localTasksCounter" value="501" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 41a243a17d641aa4db81ca90c3042b4d07d48ed1..7646f6ea29688e492a8cef5fef1c657c1cf4708f 100644 (file)
@@ -129,6 +129,8 @@ function cronRooms($cronmin)
         _logSection('Cour');
         updateCourAuto();
     }
+    _logSection('Cour');
+    updateCuisine();
     _logSection('Planetarium');
     checkPlanetarium();
     if ($cronmin % 2) {
index e3f4bf25819bea255e3511d85fe6baff68834417..e23c3ce438502cb21b6af59807860bf880c73ad0 100644 (file)
@@ -4,17 +4,15 @@ define('TIMELIMIT', 1);
 $_GET['im'] = '5';
 
 $wcswitch = 6448;
+$cubesalon = ['6844'];
 
-if ($_GET['device'] == 4680 || $_GET['device'] == 1476 || $_GET['device'] == 1478 || $_GET['device'] == 4955) {
+if (in_array($_GET['device'], $cubesalon)) {
     $forceConfig = 'salon';
-}
-if ($_GET['device'] == $wcswitch) {
+} elseif ($_GET['device'] == $wcswitch) {
     $forceConfig = 'wc';
-}
-if ($_GET['device'] == 4600) {
+} elseif ($_GET['device'] == 4600) {
     $forceConfig = 'bureau';
-}
-if ($_GET['device'] == 4711) {
+} elseif ($_GET['device'] == 4711) {
     $forceConfig = 'sdb';
 }
 
@@ -23,7 +21,7 @@ require_once "import.php";
 
 if ($_GET['device'] == 480) {
     chambreToggle();
-} else if ($_GET['device'] == 4680 || $_GET['device'] == 1476 || $_GET['device'] == 1478 || $_GET['device'] == 4955) {
+} else if (in_array($_GET['device'], $cubesalon)) {
     // Cube
     switch ($_GET['state']) {
         case 'Shake':
index e085c4050f6cec9c346c6316812f316f609ad84b..e54f0f8e38a65226ebe91a2d1df652c6b77cfb82 100644 (file)
@@ -133,13 +133,19 @@ function denonAVRGetPowerState()
 
 function _denonTelnet($cmd)
 {
-
     $client = getDenonTelnetClient();
     profile('got denon telnet client for ' . $cmd);
 
-    $res = $client->execute($cmd);
-    if ($res->isError()) {
-        return false;
+    for ($i = 0; $i <= 5; $i++) {
+        try {
+            $res = $client->execute($cmd);
+            if ($res->isError()) {
+                return false;
+            }
+            break;
+        } catch (Exception $e) {
+            sleep(5);
+        }
     }
     profile('Denon telnet ' . $cmd);
     return trim($res->getResponseText());
index f595b0cad35c00747bb49a0411f7164c0f92d045..b8c9f72716a6f9fd74552c95f218414cd84d5887 100644 (file)
@@ -350,13 +350,14 @@ $scenes = [
     'salon/on' => [
         ['type' => 'domoticz', 'scene' => 45, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO', 'repeat' => 2],
-        //['type' => 'insteon', 'command' => '0?113=I=0=0'],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'on'],
         ['type' => 'scene', 'scene' => 'cuisine/on', 'delay' => 1],
         ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1],
     ],
     'salon/off' => [
         ['type' => 'domoticz', 'scene' => 45, 'command' => false, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'off'],
         //['type' => 'insteon', 'command' => '0?133=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']],
         ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
@@ -373,12 +374,14 @@ $scenes = [
         ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu', 'repeat' => 2],
         ['type' => 'scene', 'scene' => 'salon/cinemabase'],
         ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
         ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
     ],
     'salon/cinema' => [
         ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35', 'repeat' => 2],
         ['type' => 'scene', 'scene' => 'salon/cinemabase'],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
         ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
         ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
     ],
@@ -386,16 +389,18 @@ $scenes = [
         ['type' => 'ecomode', 'mode' => '0'],
         ['type' => 'domoticz', 'scene' => 48, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU', 'repeat' => 2],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
         // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
-        ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
     ],
     'salon/lecturenocture' => [
         ['type' => 'domoticz', 'scene' => 49, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
         // ['type' => 'insteon', 'command' => '0?1113=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.25]],
-        ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
     ],
     'salon/cheminee' => [
         ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 1]],
@@ -1180,6 +1185,15 @@ function updateBureauAuto()
     execScene('bureau/' . $scene);
 }
 
+function updateCuisine(){
+    $salon=getState('salon','off');
+    if($salon==='on' || $salon==='off' || $salon==='tamise'){
+        execScene('cuisine/on');
+    }else if($salon=='cinema'){
+        execScene('cuisine/tamise');
+    }
+}
+
 function updateCourAuto()
 {
     if (isDay()) {
index a8abdb6812ae1f9d21806fa5ab7098540d879da4..4da18387d44b57f9b494d23c18e017a8554dc152 100644 (file)
@@ -38,7 +38,7 @@ function shieldRunActivity($device = null, $force = false)
     $device = getDevice($device);
     $onlySound = in_array(shieldGetCurrentApp($device), ['spotify']);
 
-    profile('Run activity for shield ' . $device);
+    profile('Run activity for shield ' . $device['id']);
 
     if ($device['id'] === 'salon') {
         stopPlayersIn('salon', true, false);
index e710e6dfde117f65ffcadb53498395dbbfc1a40c..0603df56b2d4780a80871e134e33720338e19406 100644 (file)
@@ -5,26 +5,26 @@ require_once __DIR__ . "/../scripts/import.php";
 set_time_limit(0);
 ignore_user_abort(true);
 
-$cases = [
-    'Going to sleep due to power button' => function () use ($device) {
-        echo 'sleep ' . $device . "\n";
-        off($device);
-    },
-    'Waking up from sleep' => function () use ($device) {
-        echo 'wakeup ' . $device . "\n";
-        shieldRunActivity(null, true);
-    },
-    'WindowManager: handleComboKeys keyCode: 25, keyAction: 1' => function () use ($device) {
-        echo 'volume-down ' . $device . "\n";
-        volume(config('VOLUME_STEP'), '-');
-    },
-    'WindowManager: handleComboKeys keyCode: 24, keyAction: 1' => function () use ($device) {
-        echo 'volume-up ' . $device . "\n";
-        volume(config('VOLUME_STEP'), '+');
-    }
-];
-
 while (true) {
+    $cases = [
+        'Going to sleep due to power button' => function () use ($device) {
+            echo 'sleep ' . $device . "\n";
+            off($device);
+        },
+        'Waking up from sleep' => function () use ($device) {
+            echo 'wakeup ' . $device . "\n";
+            shieldRunActivity(null, true);
+        },
+        'WindowManager: handleComboKeys keyCode: 25, keyAction: 1' => function () use ($device) {
+            echo 'volume-down ' . $device . "\n";
+            volume(config('VOLUME_STEP'), '-');
+        },
+        'WindowManager: handleComboKeys keyCode: 24, keyAction: 1' => function () use ($device) {
+            echo 'volume-up ' . $device . "\n";
+            volume(config('VOLUME_STEP'), '+');
+        }
+    ];
+
     echo 'Run home server logcat ' . $device . "\n";
     shieldLogcat($cases, $device);
     echo 'Logcat ended' . "\n----\n";