]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Thu, 15 Aug 2019 10:36:19 +0000 (12:36 +0200)
committerVincent <vincent@enhydra.fr>
Thu, 15 Aug 2019 10:36:19 +0000 (12:36 +0200)
.idea/workspace.xml
composer.json
composer.lock
scripts/lib/hue.php
scripts/lib/scenes.php
scripts/light.php

index 4d882ebf6e3c4cfc0ba0a16d1bdd3fb4cb042d67..f80dce17f167f1bb93b4f81f9e74220988071a3f 100644 (file)
@@ -2,21 +2,12 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/scripts/lib/cachemedia.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/media.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.htaccess" beforeDir="false" afterPath="$PROJECT_DIR$/.htaccess" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/tv.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/tv.php" 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/lib/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/domoticz.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/harmony.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/harmony.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/insteon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/insteon.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/tmdb.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/startserver" beforeDir="false" afterPath="$PROJECT_DIR$/servers/startserver" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/stopserver" beforeDir="false" afterPath="$PROJECT_DIR$/servers/stopserver" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/hue.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/hue.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/light.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/light.php" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1563519793746" duration="1393000" />
       <workItem from="1565460240768" duration="6405000" />
       <workItem from="1565597022811" duration="1470000" />
-    </task>
-    <task id="LOCAL-00152" summary=".">
-      <created>1550561095121</created>
-      <option name="number" value="00152" />
-      <option name="presentableId" value="LOCAL-00152" />
-      <option name="project" value="LOCAL" />
-      <updated>1550561095121</updated>
+      <workItem from="1565598552133" duration="873000" />
+      <workItem from="1565857750276" duration="198000" />
+      <workItem from="1565857963461" duration="6119000" />
     </task>
     <task id="LOCAL-00153" summary=".">
       <created>1550561360205</created>
       <option name="project" value="LOCAL" />
       <updated>1563349220383</updated>
     </task>
-    <option name="localTasksCounter" value="201" />
+    <task id="LOCAL-00201" summary=".">
+      <created>1565598575548</created>
+      <option name="number" value="00201" />
+      <option name="presentableId" value="LOCAL-00201" />
+      <option name="project" value="LOCAL" />
+      <updated>1565598575548</updated>
+    </task>
+    <option name="localTasksCounter" value="202" />
     <servers />
   </component>
   <component name="TodoView">
index 74bb6da6d8dce2211faa41545fa641835449c1f8..5304533e7bc6a38fb4ce144082495c0a5dca7632 100644 (file)
@@ -8,7 +8,7 @@
   "require": {
     "datto/json-rpc": "^4.0.4",
     "datto/json-rpc-http": "^3.2.1",
-    "sqmk/phue": "^v1.6.1",
+    "sqmk/phue": "^v1.7.0",
     "zendframework/zend-http": "^2.7.0",
     "alphayax/freebox_api_php": "^1.2.4",
     "guzzlehttp/guzzle": "^6.3.3",
@@ -20,7 +20,6 @@
     "zendframework/zend-db": "^2.10",
     "zendframework/zend-i18n": "^2.9",
     "zendframework/zend-i18n-resources": "^2.6",
-    "ext-ssh2": "*",
     "ext-json": "*"
   }
 }
index b09ebc63a5d74d097edecd9812f9c0f23415a436..64c3c993cb626bd3073eb94aaddd668bd4ff5673 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "9a9272d0b5f0d93af068be64ce3985f1",
+    "content-hash": "25c22f8a7754f5fd081527bd174c49a1",
     "packages": [
         {
             "name": "alphayax/freebox_api_php",
             "authors": [
                 {
                     "name": "Spencer Mortensen",
+                    "role": "Developer",
                     "email": "smortensen@datto.com",
-                    "homepage": "http://spencermortensen.com",
-                    "role": "Developer"
+                    "homepage": "http://spencermortensen.com"
                 }
             ],
             "description": "Fully unit-tested JSON-RPC 2.0 for PHP",
             "authors": [
                 {
                     "name": "Spencer Mortensen",
+                    "role": "Developer",
                     "email": "smortensen@datto.com",
-                    "homepage": "http://spencermortensen.com",
-                    "role": "Developer"
+                    "homepage": "http://spencermortensen.com"
                 }
             ],
             "description": "HTTP client and server for JSON-RPC 2.0",
             "authors": [
                 {
                     "name": "Michael Squires",
-                    "email": "sqmk@php.net",
-                    "role": "lead"
+                    "role": "lead",
+                    "email": "sqmk@php.net"
                 }
             ],
             "description": "Phue - Philips Hue PHP client",
         },
         {
             "name": "symfony/event-dispatcher",
-            "version": "v4.3.2",
+            "version": "v4.3.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/event-dispatcher.git",
-                "reference": "d257021c1ab28d48d24a16de79dfab445ce93398"
+                "reference": "212b020949331b6531250584531363844b34a94e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d257021c1ab28d48d24a16de79dfab445ce93398",
-                "reference": "d257021c1ab28d48d24a16de79dfab445ce93398",
+                "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/212b020949331b6531250584531363844b34a94e",
+                "reference": "212b020949331b6531250584531363844b34a94e",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony EventDispatcher Component",
             "homepage": "https://symfony.com",
-            "time": "2019-06-13T11:03:18+00:00"
+            "time": "2019-06-27T06:42:14+00:00"
         },
         {
             "name": "symfony/event-dispatcher-contracts",
         },
         {
             "name": "symfony/options-resolver",
-            "version": "v4.3.2",
+            "version": "v4.3.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/options-resolver.git",
     "stability-flags": [],
     "prefer-stable": false,
     "prefer-lowest": false,
-    "platform": [],
+    "platform": {
+        "ext-json": "*"
+    },
     "platform-dev": [],
     "platform-overrides": {
         "php": "7.3.3"
index fff2b0787ea8a8248b6787b958c4da4b5ff1a59c..b9082e3960f8cb98e5eff8864d03be885a3caeef 100644 (file)
@@ -26,40 +26,81 @@ function getHueState()
 }
 
 
-function hueApplyScene($groupId, $sceneId)
+function hueApplyScene($groupId, $sceneId, $transitionTime = null)
 {
+
     $hue = getHueInstance();
     $groups = $hue->getGroups();
     $group = $groups[$groupId];
-    print_r($group);
+    echo "Group : ";
+    print_r($group) . "\n";
+    echo "Scene : ";
+    print_r($sceneId);
+    echo "\n";
+    echo "Transition : ";
+    print_r($transitionTime);
+    echo "\n";
+    echo '-----' . "\n\n";
     if (is_array($sceneId)) {
         $command = new Phue\Command\SetGroupState($group);
         foreach ($sceneId as $key => $value) {
             $command->$key($value);
         }
         if (!isset($sceneId['effect'])) {
-            $command->effect = 'none';
+            $command->effect('none');
+        }
+        if (null !== $transitionTime) {
+            $command->transitionTime($transitionTime);
         }
         $hue->sendCommand($command);
+
+        echo "Command !! : ";
+        print_r($command);
+
     } else {
         $command = new Phue\Command\SetGroupState($group);
-        $command->effect = 'none';
+        if (null !== $transitionTime) {
+            $command->transitionTime($transitionTime);
+        } else {
+            $command->effect('none');
+        }
         $hue->sendCommand($command);
         $group->setScene($sceneId);
+
+        echo "Command ! : ";
+        print_r($command);
     }
 }
 
-function hueApplySceneLight($lightId, $sceneId)
+function hueApplySceneLight($lightId, $sceneId, $transitionTime = null)
 {
     $hue = getHueInstance();
     $lights = $hue->getLights();
     $light = $lights[$lightId];
+
+    echo "Light : ";
+    print_r($lightId) . "\n";
+    echo "Scene : ";
+    print_r($sceneId);
+    echo "\n";
+    echo "Transition : ";
+    print_r($transitionTime);
+    echo "\n";
+    echo '-----' . "\n\n";
+
     if (is_array($sceneId)) {
         $command = new Phue\Command\SetLightState($light);
+        if (null !== $transitionTime) {
+            $command->transitionTime($transitionTime);
+        }
         foreach ($sceneId as $key => $value) {
             $command->$key($value);
         }
+
+
         $hue->sendCommand($command);
+        echo "Command : ";
+        print_r($command);
     } else {
         $light->setScene($sceneId);
     }
index f7ad246568007edcac93e2504e20e25a19515709..dc2436fc96616343271ddfc4a4226414baf7b7c6 100644 (file)
@@ -29,8 +29,10 @@ if (getState('vincenthere')) {
 $scenes = [
     'chambre/matin' => [
         ['type' => 'ecomode', 'mode' => '0'],
-        ['type' => 'scene', 'scene' => 'chambre/rideaux/open'],
-        ['type' => 'scene', 'scene' => 'chambre/auto'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'JNieZpDHu5fbMyf'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'dawn', 'delay' => 1],
+        ['type' => 'scene', 'scene' => 'chambre/rideaux/open', 'delay' => 31],
+        ['type' => 'scene', 'scene' => 'chambre/auto', 'delay' => 35],
         ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
         ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
         ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
@@ -43,7 +45,6 @@ $scenes = [
         // ['type' => 'insteon', 'command' => '0?1338=I=0=0'],
     ],
     'chambre/auto' => [
-        ['type' => 'ecomode', 'mode' => '0'],
         ['type' => 'function', 'function' => 'chambreAuto', 'args' => [true]],
     ],
     'chambre/bed' => [
@@ -562,7 +563,7 @@ $scenes = [
 ];
 
 
-function execScene($name, $fromUserAction = false)
+function execScene($name, $fromUserAction = false, $transitionTime = null)
 {
     global $scenes;
     $scene = $scenes[$name];
@@ -588,9 +589,9 @@ function execScene($name, $fromUserAction = false)
 
         if ($action['type'] == 'hue') {
             if (isset($action['group'])) {
-                hueApplyScene($action['group'], $action['scene']);
+                hueApplyScene($action['group'], $action['scene'], $transitionTime);
             } else if (isset($action['light'])) {
-                hueApplySceneLight($action['light'], $action['scene']);
+                hueApplySceneLight($action['light'], $action['scene'], $transitionTime);
             }
         } else if ($action['type'] == 'insteon') {
             insteonCommand($action['command']);
@@ -609,7 +610,7 @@ function execScene($name, $fromUserAction = false)
                 if ($action['delay'] > 0) {
                     usleep(round($action['delay'] * 1000000));
                 }
-                execScene($action['scene'], $fromUserAction);
+                execScene($action['scene'], $fromUserAction, $transitionTime);
             }
         } else if ($action['type'] == 'function') {
             $f = $action['function'];
@@ -774,11 +775,12 @@ function bedbrightness($brightness)
     sshCommand($cmd, 'litjerome');
 }
 
-function chambreAuto($on = true)
+function chambreAuto($on = true, $transitionTime = null)
 {
     if ($on) {
+        ecoMode(0);
         setState('chambreAutoMode', '1');
-        updateChambreAuto();
+        updateChambreAuto($transitionTime);
     } else {
         setState('chambreAutoMode', '0');
     }
@@ -794,7 +796,7 @@ function bureauAuto($on = true)
     }
 }
 
-function updateChambreAuto()
+function updateChambreAuto($transitionTime = null)
 {
     $hours = intval(date('H'));
     if ($hours <= 1) {
@@ -810,7 +812,7 @@ function updateChambreAuto()
     } else {
         $scene = 'tropical';
     }
-    execScene('chambre/' . $scene);
+    execScene('chambre/' . $scene, false, $transitionTime);
 }
 
 function updateBureauAuto()
index d204cd1518cb8bbf79f7a0e9f685f0e49481b94d..5444bd5d31819996bcde7d45ce70fe39bab62203 100644 (file)
@@ -19,6 +19,11 @@ if (isset($_GET['scene'])) {
     $hue = getHueInstance();
     $command = new Phue\Command\DeleteGroup($_GET['group']);
     $command->send($hue);
+} else if (isset($_GET['action']) && $_GET['action'] == 'createDawnScene') {
+    $hue = getHueInstance();
+    $command = new \Phue\Command\CreateScene('dawn', 'dawn', [7, 8, 9, 10, 11, 12, 13, 17, 21]);
+    $command->transitionTime(30);
+    $command->send($hue);
 } else {
     echo '<pre>';
     print_r(getHueState());