]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Thu, 26 Dec 2019 16:21:11 +0000 (17:21 +0100)
committerVincent <vincent@enhydra.fr>
Thu, 26 Dec 2019 16:21:11 +0000 (17:21 +0100)
.idea/workspace.xml
js/home.js
scripts/cron/cron.php
scripts/domoticz_device_event.php
scripts/ecomode.php
scripts/lib/lib.php
scripts/lib/router.php [new file with mode: 0644]
scripts/lib/scenes.php
scripts/pop.php
scripts/router_devices_list.php [new file with mode: 0644]

index 5a8f37abfdeb247fa85007d8aa8a4f9560b3859d..b7edf878a7ead95067acc921d08f402824e26c9d 100644 (file)
@@ -2,8 +2,16 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/lib/router.php" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/scripts/router_devices_list.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/cheminee.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cheminee.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" 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/ecomode.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/ecomode.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/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/pop.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/pop.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <property name="DatabaseDriversLRU" value="sqlite" />
     <property name="DefaultHtmlFileTemplate" value="HTML File" />
     <property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
+    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
     <property name="WebServerToolWindowFactoryState" value="true" />
     <property name="WebServerToolWindowPanel.toolwindow.highlight.mappings" value="true" />
       <workItem from="1576480199671" duration="3374000" />
       <workItem from="1576522031507" duration="1545000" />
       <workItem from="1577298113584" duration="24000" />
-      <workItem from="1577298151244" duration="1212000" />
-    </task>
-    <task id="LOCAL-00206" summary=".">
-      <created>1566380942924</created>
-      <option name="number" value="00206" />
-      <option name="presentableId" value="LOCAL-00206" />
-      <option name="project" value="LOCAL" />
-      <updated>1566380942924</updated>
+      <workItem from="1577298151244" duration="2270000" />
+      <workItem from="1577358967357" duration="4248000" />
     </task>
     <task id="LOCAL-00207" summary=".">
       <created>1566458823293</created>
       <option name="project" value="LOCAL" />
       <updated>1576522982317</updated>
     </task>
-    <option name="localTasksCounter" value="255" />
+    <task id="LOCAL-00255" summary=".">
+      <created>1577310765026</created>
+      <option name="number" value="00255" />
+      <option name="presentableId" value="LOCAL-00255" />
+      <option name="project" value="LOCAL" />
+      <updated>1577310765026</updated>
+    </task>
+    <option name="localTasksCounter" value="256" />
     <servers />
   </component>
   <component name="TodoView">
     </state>
     <state x="720" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577298128269" />
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1576479992407" />
-    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1576522977384">
-      <screen x="0" y="0" width="2560" height="1040" />
+    <state x="701" y="114" key="CommitChangelistDialog2" timestamp="1577310762113">
+      <screen x="0" y="0" width="1920" height="1040" />
     </state>
+    <state x="701" y="114" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1577310762113" />
     <state x="701" y="127" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1575647157027" />
     <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1576522977384" />
-    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1576493932196">
-      <screen x="0" y="0" width="2560" height="1040" />
+    <state x="836" y="443" key="NewPhpFileDialog" timestamp="1577363498855">
+      <screen x="0" y="0" width="1920" height="1040" />
     </state>
+    <state x="836" y="443" key="NewPhpFileDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577363498855" />
     <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1576493932196" />
-    <state x="732" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1577299162028">
+    <state x="732" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1577358968384">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state x="732" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577299162028" />
+    <state x="732" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577358968384" />
     <state x="732" y="383" key="com.intellij.ide.util.TipDialog/0.0.1920.1160@0.0.1920.1160" timestamp="1575647093028" />
     <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1576522032866" />
     <state x="976" y="257" width="607" height="526" key="find.popup" timestamp="1576492890263">
index b0b45b2fd07a6308419d3fab487950746cb69c6c..ca64b6393f23b841a49769be9f4f10ece59e330a 100644 (file)
@@ -38,7 +38,7 @@ $(function () {
         }, 10000);
     }
 
-    if (raspberry) {
+    if (true || raspberry) {
         setInterval(function () {
             checkEcoMode(false);
         }, 60000);
index 54e812b3210cc933dcae0948dcb970324af213d5..edefe84f39360c51bf11b6521322f868864b4c0e 100644 (file)
@@ -13,6 +13,7 @@ function cronOneLoop($cronmin)
         cronVelib($cronmin);
         cronWeather($cronmin);
         cronBackyard($cronmin);
+        cronGuest($cronmin);
     }
     if ($cronmin % 10 == 0) {
         cronSqueezeFavorites($cronmin);
@@ -39,6 +40,11 @@ function cronOneLoop($cronmin)
     cronHeartbeat($cronmin);
 }
 
+function cronGuest($cronmin)
+{
+    setState('guest', hasGuest() ? '1' : '0');
+}
+
 function cronInsteon($cronmin)
 {
     insteonCommand('knock');
index f27c821d9d5b7702383b897b037d8bcc2e91ef42..589a8aa979ee1cb3a8ba50bebc8bc57b51b3936f 100644 (file)
@@ -24,7 +24,9 @@ if ($_GET['device'] == 480) {
             off('salon');
             break;
         case 'Move':
-            _remoteCmd('pause', 'salon');
+            if (getCurrentHarmonyActivity() != 'musique-radio') {
+                _remoteCmd('pause', 'salon');
+            }
             break;
         case 'Clock_Wise':
             if (getCurrentHarmonyActivity() !== 'poweroff') {
index dceac6e6370c2e33144f92e621f512dfb813c30f..82aedc948267dbf3f87cc7f0e44bf74a87e7ebff 100644 (file)
@@ -8,4 +8,10 @@ if (isset($_GET['action'])) {
     heartbeat();
 }
 ob_end_clean();
-die(getState('ecomode'));
+
+$res = getState('ecomode');
+if (!$res && in_array(config('DEVICE'), ['bureau', 'bureausun'])) {
+    $res = getDomoticzDeviceStatus(391) === 'Closed';
+}
+
+die($res);
index 6dbd4a1c0fa8878441281714c03192256db3cc31..e994e1d0e7d214b9b2fe9ed11d94d223be779e08 100644 (file)
@@ -41,6 +41,7 @@ require_once ROOT . '/scripts/lib/heartbeats.php';
 require_once ROOT . '/scripts/lib/ssh.php';
 require_once ROOT . '/scripts/lib/cachemedia.php';
 require_once ROOT . '/scripts/lib/ifttt.php';
+require_once ROOT . '/scripts/lib/router.php';
 
 
 profile('Loaded libraries', __FILE__, __LINE__);
diff --git a/scripts/lib/router.php b/scripts/lib/router.php
new file mode 100644 (file)
index 0000000..3f98228
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+function routerDevicesList()
+{
+    $res = httpRequest('http://192.168.13.1/status-devices.asp', 'get', ['_' => time()], ['admin', 'BDQw479qbJST4u']);
+    // echo $res->getBody();
+    if (preg_match('/dhcpd_lease = ([^;]+);/m', $res->getBody(), $dhcp)) {
+        if (preg_match_all('/192\.168\.13\.[0-9]{1,3}/', $dhcp[1], $matches)) {
+            return $matches[0];
+        }
+    }
+    return [];
+}
+
+function hasGuest()
+{
+    $guests = ['192.168.13.150', '192.168.13.151', '192.168.13.152', '192.168.13.153'];
+    return count(array_intersect(routerDevicesList(), $guests)) > 0;
+}
\ No newline at end of file
index e22ac0985f0ed9ebb3fcaa9b399106adaf8ed28f..b69a133b1b7c3986a9cdd593a3457ee6fcb73864 100644 (file)
@@ -286,26 +286,31 @@ $scenes = [
     ],
     'salon/on' => [
         ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO'],
+        ['type' => 'domoticz', 'device' => '1203', 'command' => true, 'priority' => true], // sapin
         ['type' => 'insteon', 'command' => '0?113=I=0=0'],
         ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1],
     ],
     'salon/off' => [
         ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false, 'brightness' => 0)],
+        ['type' => 'domoticz', 'device' => '1203', 'command' => false, 'priority' => true], // sapin
         ['type' => 'insteon', 'command' => '0?133=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']],
     ],
     'salon/cinema' => [
         ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'domoticz', 'device' => '1203', 'command' => true, 'priority' => true], // sapin
         ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'],
         ['type' => 'insteon', 'command' => '0?1111=I=0=0'],
     ],
     'salon/tamise' => [
+        ['type' => 'domoticz', 'device' => '1203', 'command' => true, 'priority' => true], // sapin
         ['type' => 'ecomode', 'mode' => '0'],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU'],
         ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
     ],
     'salon/lecturenocture' => [
+        ['type' => 'domoticz', 'device' => '1203', 'command' => true, 'priority' => true], // sapin
         ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'],
         ['type' => 'insteon', 'command' => '0?1113=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.25]],
index 738dce5d7e7d1bce7166e1135f31da74783440b5..faa7dffc310cc3ab11ed648cdb7c05270f7f226f 100644 (file)
@@ -4,6 +4,10 @@ define('TIMELIMIT', 1);
 $_GET['im'] = '5';
 include "import.php";
 
+if (getState('guest', '0') === '1' && $_GET['action'] == 'long') {
+    $_GET['action'] = 'tap';
+}
+
 if ($_GET['button'] == 'wc') {
     if ($_GET['action'] == 'tap') {
         wcToggle();
diff --git a/scripts/router_devices_list.php b/scripts/router_devices_list.php
new file mode 100644 (file)
index 0000000..e3dd613
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+require_once "import.php";
+header('Content-Type: text/plain');
+echo hasGuest();
+exit;