]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Tue, 21 Jul 2020 08:15:43 +0000 (10:15 +0200)
committerVincent <vincent@enhydra.fr>
Tue, 21 Jul 2020 08:15:43 +0000 (10:15 +0200)
.idea/workspace.xml
scripts/domoticz_device_event.php
scripts/lib/scenes.php
scripts/vmcoff.php [new file with mode: 0644]

index c976cbc515fe6a38cedfa0bbd3301033444cfe3f..50b1a1d8669e553a926d335a2688d0d52a67e8a7 100644 (file)
@@ -2,8 +2,8 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/vmcoff.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/music.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/music.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/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
     </list>
       <workItem from="1593501805520" duration="1107000" />
       <workItem from="1594399361632" duration="763000" />
       <workItem from="1594621701186" duration="596000" />
-      <workItem from="1595313798230" duration="817000" />
-    </task>
-    <task id="LOCAL-00282" summary=".">
-      <created>1580205716585</created>
-      <option name="number" value="00282" />
-      <option name="presentableId" value="LOCAL-00282" />
-      <option name="project" value="LOCAL" />
-      <updated>1580205716585</updated>
+      <workItem from="1595313798230" duration="4556000" />
     </task>
     <task id="LOCAL-00283" summary=".">
       <created>1580377820162</created>
       <option name="project" value="LOCAL" />
       <updated>1593344786570</updated>
     </task>
-    <option name="localTasksCounter" value="331" />
+    <task id="LOCAL-00331" summary=".">
+      <created>1595314774388</created>
+      <option name="number" value="00331" />
+      <option name="presentableId" value="LOCAL-00331" />
+      <option name="project" value="LOCAL" />
+      <updated>1595314774389</updated>
+    </task>
+    <option name="localTasksCounter" value="332" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="760" y="94" key="#Project_Structure/0.0.2560.1040@0.0.2560.1040" timestamp="1592377765650" />
-    <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog" timestamp="1585852940968">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1585852940968" />
-    <state x="935" y="114" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1593344767278">
+    <state x="935" y="114" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1595314761980">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1593086272091" />
-    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1593344767278" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1595314761980" />
     <state x="1060" y="275" key="FileChooserDialogImpl" timestamp="1590912263817">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="1060" y="275" key="FileChooserDialogImpl/0.0.2560.1040@0.0.2560.1040" timestamp="1590912263817" />
-    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1592205861310">
+    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1595317059300">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1592205861310" />
+    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1595317059300" />
     <state x="1420" y="165" key="SettingsEditor" timestamp="1586722506607">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
       <screen x="0" y="0" width="1920" height="1160" />
     </state>
     <state x="655" y="270" key="Vcs.Push.Dialog.v2/0.0.1920.1160@0.0.1920.1160" timestamp="1591870150868" />
-    <state x="873" y="242" key="Vcs.Push.Dialog.v2/0.0.2560.1040@0.0.2560.1040" timestamp="1585899399605" />
-    <state x="1456" y="240" key="com.intellij.ide.util.TipDialog" timestamp="1586418523328">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="1456" y="240" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1586418523328" />
-    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1593416527009">
+    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1595315147407">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1593416527009" />
+    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1595315147407" />
   </component>
   <component name="antWorkspaceConfiguration">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
index daab694e137e659ef103ced89c69f0ffff279d95..22149f366c34c15d6ea1034ead9031dba7d42086 100644 (file)
@@ -1,8 +1,14 @@
 <?php
 
+define('TIMELIMIT', 1);
+$_GET['im'] = '5';
+
 if ($_GET['device'] == 1033 || $_GET['device'] == 1476 || $_GET['device'] == 1478) {
     $forceConfig = 'salon';
 }
+if ($_GET['device'] == 1695) {
+    $forceConfig = 'wc';
+}
 
 require_once "import.php";
 
@@ -53,12 +59,13 @@ if ($_GET['device'] == 480) {
 } else if ($_GET['device'] == 1451) {
     domoticzSwitch(1450);
 } else if ($_GET['device'] == 1695) {
+    $forceConfig = 'salon';
     switch ($_GET['state']) {
-        case 'Double Click':
+        case 'Double_Click':
             execScene('wc/spa');
             setState('wc', 1);
             break;
-        case 'Long Click':
+        case 'Long_Click':
             execScene('home/alert');
             break;
         case 'Click':
index e91afcd2c7dc2d6fbfe27a24a5f4e1a5a9fc458c..9ddc4edc86509c502b5ee6f342ed77d5a0185a3f 100644 (file)
@@ -436,7 +436,7 @@ $scenes = [
         ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]],
         ['type' => 'hue', 'group' => $bureau, 'scene' => array('on' => false, 'brightness' => 0)],
         ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'off'],
-        ['type' => 'function', 'function' => 'sleepPC', 'args' => ['avion']],
+        ['type' => 'scene', 'scene' => 'bureau/sleepPC'],
     ],
     'bureau/media/play' => [
         ['type' => 'scene', 'scene' => 'bureau/screen/down'],
@@ -457,7 +457,6 @@ $scenes = [
     'bureau/rideaux/open' => [
         ['type' => 'domoticz', 'device' => '391', 'command' => true, 'priority' => true],
     ],
-
     'insteon/off' => [
         ['type' => 'insteon', 'command' => '0?135=I=0=0'],
     ],
@@ -541,7 +540,7 @@ $scenes = [
         ['type' => 'function', 'function' => 'wcVMCOn'],
     ],
     'wc/vmc/off' => [
-        ['type' => 'function', 'function' => 'wcVMCOff', 'args' => [0]],
+        ['type' => 'insteon', 'command' => '0?1334=I=0=0'],
     ],
 
     'sdb/ampli/on' => [
@@ -667,12 +666,7 @@ function execScene($name, $fromUserAction = false, $transitionTime = null)
                 $action['delay'] = 0;
             }
             if ($action['delay'] > 1) {
-                $timeout = $action['delay'] + 30;
-                $url = WEB_ROOT . 'scripts/light.php?r=' . $action['r'] . '&delay=' . $action['delay'] . '&scene=' . $action['scene'] . '&sid=' . session_id();
-                $lynx = "lynx -connect_timeout=$timeout -dump \"$url\"";
-                $cmd = "echo '$lynx' | at now 2>&1";
-                $res = `$cmd`;
-                echo $cmd . " : $res\n";
+                delayScene($action['scene'], $action['delay']);
             } else {
                 if ($action['delay'] > 0) {
                     usleep(round($action['delay'] * 1000000));
@@ -946,12 +940,22 @@ function wcVMCOff($timeout = 600)
 function _wcVMCOff($timeout)
 {
     if ($timeout === 0) {
-        return insteonCommand('0?1334=I=0=0');
-    }
-    $rand = rand(100000, 1000000);
-    setState('wcTimeout', $rand);
-    sleep($timeout);
-    if (getState('wcTimeout') == $rand) {
-        insteonCommand('0?1334=I=0=0');
+        execScene('wc/vmc/off');
+        return;
     }
+    delayHttpCall(WEB_ROOT . 'script/vmcoff.php?delay=' . $timeout, $timeout + 30);
+}
+
+function delayHttpCall($url, $delay)
+{
+    $lynx = "lynx -connect_timeout=$delay -dump \"$url\"";
+    $cmd = "echo '$lynx' | at now 2>&1";
+    return `$cmd`;
+}
+
+function delayScene($scene, $delay)
+{
+    $timeout = $$delay + 30;
+    $url = WEB_ROOT . 'scripts/light.php?delay=' . $delay['delay'] . '&scene=' . $scene . '&sid=' . session_id();
+    return delayHttpCall($url, $timeout);
 }
\ No newline at end of file
diff --git a/scripts/vmcoff.php b/scripts/vmcoff.php
new file mode 100644 (file)
index 0000000..b7d8dd0
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+include "import.php";
+
+$rand = rand(100000, 1000000);
+setState('wcTimeout', $rand);
+sleep($_GET['timeout']);
+if (getState('wcTimeout') == $rand) {
+    execScene('wc/vmc/off');
+}
\ No newline at end of file