]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Thu, 21 Nov 2019 12:45:54 +0000 (13:45 +0100)
committerVincent <vincent@enhydra.fr>
Thu, 21 Nov 2019 12:45:54 +0000 (13:45 +0100)
.idea/workspace.xml
scripts/cron/cron.php
scripts/domoticz_device_event.php
scripts/lib/domoticz.php
scripts/lib/scenes.php
scripts/lib/squeezebox.php
scripts/lib/weatherstation.php

index 3357e507448750a17f375febf9107bc37a2b6ee2..f05df114123916893e35d890db7e55c6f89de0c2 100644 (file)
@@ -2,11 +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/domoticz_status.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/lib/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/domoticz.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/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="HIDDEN_KINDS">
       <set />
     </option>
-    <expand />
+    <expand>
+      <path>
+        <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+        <item name="LFY(3).db" type="feb32156:DbDataSourceImpl" />
+      </path>
+      <path>
+        <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+        <item name="LFY(3).db" type="feb32156:DbDataSourceImpl" />
+        <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+      </path>
+      <path>
+        <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+        <item name="LFY(3).db" type="feb32156:DbDataSourceImpl" />
+        <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+        <item name="main: schema" type="981a47c2:SqliteImplModel$Schema" />
+      </path>
+      <path>
+        <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+        <item name="LFY_ZiGate.db" type="feb32156:DbDataSourceImpl" />
+      </path>
+      <path>
+        <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+        <item name="LFY_ZiGate.db" type="feb32156:DbDataSourceImpl" />
+        <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+      </path>
+      <path>
+        <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+        <item name="LFY_ZiGate.db" type="feb32156:DbDataSourceImpl" />
+        <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+        <item name="main: schema" type="981a47c2:SqliteImplModel$Schema" />
+      </path>
+    </expand>
     <select />
   </component>
   <component name="DefaultGradleProjectSettings">
     <option name="STATE" value="1" />
   </component>
   <component name="PropertiesComponent">
+    <property name="DatabaseDriversLRU" value="sqlite" />
     <property name="DefaultHtmlFileTemplate" value="HTML File" />
     <property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
       <method v="2" />
     </configuration>
   </component>
+  <component name="ServiceViewManager">
+    <option name="allServicesViewState">
+      <serviceView>
+        <treeState>
+          <expand>
+            <path>
+              <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
+              <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@56e2c52e" type="7427dc5b:ServiceModel$ServiceGroupNode" />
+            </path>
+            <path>
+              <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
+              <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@6b2d7142" type="7427dc5b:ServiceModel$ServiceGroupNode" />
+            </path>
+            <path>
+              <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
+              <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@6b2d7142" type="7427dc5b:ServiceModel$ServiceGroupNode" />
+              <item name="com.intellij.execution.services.ServiceModel$ServiceNode@3e99f178" type="9fbbdea:ServiceModel$ServiceNode" />
+            </path>
+          </expand>
+          <select />
+        </treeState>
+      </serviceView>
+    </option>
+  </component>
   <component name="SvnConfiguration">
     <configuration />
   </component>
       <workItem from="1573629043706" duration="29000" />
       <workItem from="1573629088225" duration="3531000" />
       <workItem from="1574065436563" duration="754000" />
-      <workItem from="1574066213679" duration="7326000" />
-    </task>
-    <task id="LOCAL-00196" summary=".">
-      <created>1562740088238</created>
-      <option name="number" value="00196" />
-      <option name="presentableId" value="LOCAL-00196" />
-      <option name="project" value="LOCAL" />
-      <updated>1562740088238</updated>
+      <workItem from="1574066213679" duration="8067000" />
+      <workItem from="1574273415760" duration="2973000" />
+      <workItem from="1574323616439" duration="6793000" />
     </task>
     <task id="LOCAL-00197" summary=".">
       <created>1562743327335</created>
       <option name="project" value="LOCAL" />
       <updated>1574210671610</updated>
     </task>
-    <option name="localTasksCounter" value="245" />
+    <task id="LOCAL-00245" summary=".">
+      <created>1574242924581</created>
+      <option name="number" value="00245" />
+      <option name="presentableId" value="LOCAL-00245" />
+      <option name="project" value="LOCAL" />
+      <updated>1574242924581</updated>
+    </task>
+    <option name="localTasksCounter" value="246" />
     <servers />
   </component>
   <component name="TodoView">
index cd5d682bbaaf55fbb6c690a4b950a0a32bb256fd..868f6367078b9b8d979176a127f82c01425acda0 100644 (file)
@@ -49,14 +49,14 @@ function cronEcoMode($cronmin)
     if ($cronmin % 5 != 0) {
         return;
     }
-    if (getState('ecomode') == 0) {
-        execScene('ecomode/off');
-    }
+    $ecomode = (int)getState('ecomode');
+    $scenes = [0 => 'off', 1 => 'on', 2 => 'super'];
+    execScene('ecomode/' . $scenes[$ecomode]);
 }
 
 function cronTranscode($cronmin)
 {
-    httpRequest('https://home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
+    httpRequest('https://salon.home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
 }
 
 function cronRooms($cronmin)
@@ -159,11 +159,11 @@ function cronWeather($cronmin)
     $weather = json_decode(file_get_contents($cache), true);
     $weather = $weather[0];
     $res['temp'] = round(($weather['Temperature']['Metric']['Value']/* + getState('airtemperature')*/));
-    $res['outdoor_temp'] = toNumber(getDomoticzDeviceStatus(12, 'zigate'),true);
-    $res['outdoor_humidity'] = toNumber(getDomoticzDeviceStatus(13, 'zigate'),true);
-    $res['outdoor_pressure'] = toNumber(getDomoticzDeviceStatus(14, 'zigate'),true);
-    $res['backyard_temp'] = toNumber(getDomoticzDeviceStatus(5, 'zigate'),true);
-    $res['backyard_humidity'] = toNumber(getDomoticzDeviceStatus(6, 'zigate'),true);
+    $res['outdoor_temp'] = toNumber(getDomoticzDeviceStatus(1012), true);
+    $res['outdoor_humidity'] = toNumber(getDomoticzDeviceStatus(1013), true);
+    $res['outdoor_pressure'] = toNumber(getDomoticzDeviceStatus(1014), true);
+    $res['backyard_temp'] = toNumber(getDomoticzDeviceStatus(1005), true);
+    $res['backyard_humidity'] = toNumber(getDomoticzDeviceStatus(1006), true);
     $res['pressure'] = round($weather['Pressure']['Metric']['Value']);
     $res['pressureTendency'] = $weather['PressureTendency']['Code'];
     $res['precipitations24'] = round($weather['PrecipitationSummary']['Past24Hours']['Metric']['Value']);
index 85abaa128e54db100a68e2e42882ede94875ef11..e3d11a561ae020c356b52b6b5efdc1f5e42b89ad 100644 (file)
@@ -2,10 +2,9 @@
 
 require_once "import.php";
 
-if ($_GET['hardware'] == 'rflink' && $_GET['device'] == 480) {
+if ($_GET['device'] == 480) {
     chambreToggle();
-}
-if ($_GET['hardware'] == 'zigate' && $_GET['device'] == 8) {
+} else if ($_GET['device'] == 1008) {
     // Cube
     switch ($_GET['state']) {
         case 'Shake':
@@ -29,8 +28,15 @@ if ($_GET['hardware'] == 'zigate' && $_GET['device'] == 8) {
         case 'Anti_Clock_Wise':
             _remoteCmd('rewind', 'salon');
             break;
-        case 'Alert':
         case 'Tap':
+            if (getCurrentHarmonyActivity() == 'poweroff') {
+                squeezePlayByName('FIP', $squeezeboxPlayers['Salon']);
+            } else if (getCurrentHarmonyActivity() == 'musique-radio') {
+                stopHarmony();
+            }
+            break;
+        case 'Alert':
+        default:
             break;
     }
 }
\ No newline at end of file
index ea1ff44de9d230f112392d5066bd536344d0f93f..21cb088020642ec20b634e94a22b3d84fd77b765 100644 (file)
@@ -1,22 +1,26 @@
 <?php
-function runDomoticzCommand($params, $hardware = 'rflink')
+function runDomoticzCommand($params)
 {
     $default = ['type' => 'command', 'passcode' => ''];
     $params = array_merge($default, $params);
 
-    if ($params['hardware'] == 'rflink') {
-        $ip = '192.168.13.60';
-    } else if ($params['hardware'] == 'zigate') {
-        $ip = '192.168.13.68';
-    }
-    unset($params['hardware']);
+    unset($params['delay']);
 
+    $ip = '192.168.13.68';
     return httpRequest('http://' . $ip . ':8084/json.htm', 'GET', $params);
 }
 
-function domoticzSwitch($device, $cmd, $type = 'light', $priority = false, $hardware = 'rflink')
+function domoticzGroup($group, $command)
+{
+    foreach ($group as $device => $delays) {
+        $delay = $command ? $delays[0] : $delays[1];
+        domoticzSwitch($device, $command, 'light', false, $delay);
+    }
+}
+
+function domoticzSwitch($device, $cmd, $type = 'light', $priority = false, $delay = 0)
 {
-    return domoticzCmd(['idx' => $device, 'switchcmd' => $cmd ? 'On' : 'Off', 'param' => 'switch' . $type, 'level' => '0', 'hardware' => $hardware], $priority);
+    return domoticzCmd(['idx' => $device, 'switchcmd' => $cmd ? 'On' : 'Off', 'param' => 'switch' . $type, 'level' => '0', 'delay' => $delay], $priority);
 }
 
 function domoticzCmd($command, $priority = false)
@@ -38,10 +42,10 @@ function domoticzCmd($command, $priority = false)
     return true;
 }
 
-function getDomoticzDeviceStatus($device, $hardware = 'rflink')
+function getDomoticzDeviceStatus($device)
 {
-    $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device, 'hardware' => $hardware]);
-    $res = json_decode($res->getBody(),true);
+    $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
+    $res = json_decode($res->getBody(), true);
 
     return $res['result'][0]['Data'];
 }
index f616bb2f4dfc1f64f453037be424a4d15251af29..7d80ee6728a02620b3127ce8f5c7bb754b7a7007 100644 (file)
@@ -21,6 +21,15 @@ $home = 15;
 
 $chambrebedgroup = $chambre;
 
+$ecoDevices = [
+    393 => [0, 0], // Prises lit
+    560 => [0, 50], // Raspberry SDB
+    476 => [0, 0], // Raspberry Bureau Sun
+    544 => [0, 0], //Téléphone Cuisine
+    478 => [120, 0],
+];
+$superEcoDevices = [559 => [0, 0], 392 => [0, 0]];
+
 $scenes = [
     'chambre/matin' => [
         ['type' => 'nightmode', 'mode' => '0'],
@@ -60,7 +69,7 @@ $scenes = [
         ['type' => 'insteon', 'command' => '0?1131=I=0=0'],
         ['type' => 'hue', 'group' => $chambrebedgroup, 'scene' => 'JNieZpDHu5fbMyf'],
         ['type' => 'scene', 'scene' => 'sdb/nuit'],
-       ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
         ['type' => 'scene', 'scene' => 'chambre/cheminee'],
         ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
 //        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
@@ -526,7 +535,7 @@ $scenes = [
     ],
     'sdb/on' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-       // ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'none']],
+        // ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'none']],
         ['type' => 'hue', 'group' => $sdb, 'scene' => '0L4cGh7y29uBBez'],
     ],
     'sdb/morning' => [
@@ -555,14 +564,14 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'salon/freebox/off'],
         ['type' => 'scene', 'scene' => 'sdb/ampli/off'],
         ['type' => 'scene', 'scene' => 'chambre/raspberry/off'],
-        ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => false],
+        ['type' => 'domoticz', 'group' => $ecoDevices, 'command' => false],
     ],
     'ecomode/super' => [
         ['type' => 'scene', 'scene' => 'ecomode/basic'],
-        ['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => false],
+        ['type' => 'domoticz', 'group' => $superEcoDevices, 'command' => false],
     ],
     'ecomode/notsuper' => [
-        ['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => true],
+        ['type' => 'domoticz', 'group' => $superEcoDevices, 'command' => true],
     ],
     'ecomode/on' => [
         ['type' => 'scene', 'scene' => 'ecomode/basic'],
@@ -651,7 +660,12 @@ function execScene($name, $fromUserAction = false, $transitionTime = null)
         } else if ($action['type'] == 'ecomode') {
             ecoMode($action['mode']);
         } else if ($action['type'] == 'domoticz') {
-            domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', isset($action['priority']) && $action['priority']);
+            if (isset($action['group'])) {
+                domoticzGroup($action['group'], $action['command']);
+            } else {
+                domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', isset($action['priority']) && $action['priority']);
+            }
+
         } else if ($action['type'] == 'ir') {
             irsend($action['room'], $action['device'], $action['command']);
         } else if ($action['type'] == 'ifttt') {
index 72807fbd7d044a5684b7eda60ed185f5ea822e09..25986a490b7fe1d42058d640b3407bad129b4ce8 100644 (file)
@@ -81,6 +81,9 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr
         return;
     }
 
+    if($player == $squeezeboxPlayers['Salon']){
+        harmonyActivity('musique-radio');
+    }
     if ($player == $squeezeboxPlayers['Salle de bains']) {
         execScene('sdb/ampli/on');
     }
index e0175cf11b37ea7679c9a2a889409faee569a063..1e165972c8176ad9972369fdb2768fb1123ec928 100644 (file)
@@ -19,8 +19,8 @@ function weatherStationScreenSaver()
     $res .= '<div class="temp-max">' . $weather['max'] . '°C</div>';
     $res .= '</div>';
     $res .= '<div class="pp">';
-    $res .= '<i class="fas fa-cloud-rain"></i> ' . $weather['precipitations24'] . ' mm | <i class="fas fa-tachometer-alt"></i> ' . $weather['outdoor_pressure'] . ' hPa <i class="fa fa-arrow-circle-' . $pressureTendency . '"></i> | <i class="fa fa-tint"></i> ' . $weather['outdoor_humidity'] . '%</br>';
-    $res .= '<i class="fas fa-leaf"></i> ' . $weather['backyard_temp'] . ' °C | <i class="fa fa-tint"></i> ' . $weather['backyard_humidity'] . '%';
+    $res .= '<i class="fas fa-cloud-rain"></i> ' . $weather['precipitations24'] . ' mm | <i class="fas fa-tachometer-alt"></i> ' . $weather['outdoor_pressure'] . ' hPa <i class="fa fa-arrow-circle-' . $pressureTendency . '"></i> | <i class="fa fa-tint"></i> ' . $weather['outdoor_humidity'] . '%<br>';
+    $res .= '<br><span style="color:#008048;"><i class="fas fa-leaf"></i> ' . $weather['backyard_temp'] . ' °C | <i class="fa fa-tint"></i> ' . $weather['backyard_humidity'] . '%</span>';
     $res .= '</div>';
     $res .= '</div>';
     $res .= '<div class="forecasts">';