]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 9 Jul 2023 15:05:20 +0000 (17:05 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 9 Jul 2023 15:05:20 +0000 (17:05 +0200)
.idea/workspace.xml
scripts/domoticz_device_event.php [deleted file]
scripts/homeassistant_device_event.php

index 857ff84708d0f16b777d6e8bf9636c0a83567e55..1070515edad7aec53baa05deca13aa0fd335ad31 100644 (file)
@@ -5,11 +5,9 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change beforePath="$PROJECT_DIR$/.docker/config/httpd/httpd.conf" beforeDir="false" afterPath="$PROJECT_DIR$/.docker/config/httpd/httpd.conf" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/domoticz_device_event.php" beforeDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/homeassistant_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/homeassistant_device_event.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/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1688750143650" duration="1624000" />
       <workItem from="1688808953960" duration="594000" />
       <workItem from="1688849303515" duration="1558000" />
-      <workItem from="1688897001591" duration="6567000" />
+      <workItem from="1688897001591" duration="8270000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="562" />
+    <option name="localTasksCounter" value="563" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
diff --git a/scripts/domoticz_device_event.php b/scripts/domoticz_device_event.php
deleted file mode 100644 (file)
index df53b15..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-define('TIMELIMIT', 1);
-$_GET['im'] = '5';
-
-$wcswitch = [6448, 6894, 6895];
-$cubesalon = [6844, 6846, 6848];
-$bar = 6890;
-$device = (int)$_GET['device'];
-
-if (in_array($device, $cubesalon)) {
-       $forceConfig = 'salon';
-} elseif ($device == $wcswitch) {
-       $forceConfig = 'wc';
-} elseif ($device == 4600) {
-       $forceConfig = 'bureau';
-} elseif ($device == 4711) {
-       $forceConfig = 'sdb';
-} else if ($device == $bar) {
-       $forceConfig = 'salon';
-}
-//} else if ($device == 6894) {
-//    $forceConfig = 'cour';
-//} else if ($device == 6895) {
-//    $forceConfig = 'cour';
-//}
-
-require_once "import.php";
-
-
-//if ($device === 6894) {
-//     domoticzCmd(6898, 'Toggle');
-//} elseif ($device == 6895) {
-//     domoticzCmd(6899, 'Toggle');
-//} else
-       if ($device == $bar) {
-       execScene('salon/bar/' . mb_strtolower($_GET['state']));
-} elseif ($device == 480) {
-       chambreToggle(true);
-} else if (in_array($device, $cubesalon)) {
-       // Cube
-       if (gloria()) {
-               die('0');
-       }
-       switch ($_GET['state']) {
-               case 'Shake':
-                       execScene('home/alert', true);
-                       break;
-               case 'Flip_90':
-                       execScene('salon/cinema', true);
-                       break;
-               case 'Flip_180':
-                       execScene('salon/auto', true);
-                       break;
-               case 'Free_Fall':
-                       off('salon');
-                       break;
-               case 'Move':
-                       _remoteCmd('pause', 'salon');
-                       break;
-               case 'Clock_Wise':
-                       volume(config('VOLUME_STEP'), '+');
-                       break;
-               case 'Anti_Clock_Wise':
-                       volume(config('VOLUME_STEP'), '-');
-                       break;
-               case 'Tap':
-                       squeezePlayByName('FIP', $squeezeboxPlayers['Salon']);
-                       break;
-               case 'Alert':
-               default:
-                       break;
-       }
-} else if ($device == 1451) {
-       domoticzSwitch(1450);
-} else if (in_array($device, $wcswitch)) {
-       $forceConfig = 'wc';
-       switch ($_GET['state']) {
-               case 'Double_Click':
-                       execScene('wc/spa', true);
-                       setState('wc', 1);
-                       break;
-               case 'Long_Click':
-                       if (isJerome(false) && isVincent()) {
-                               execScene('home/alert', true);
-                       } else {
-                               wcToggle();
-                       }
-                       break;
-               case 'Click':
-               default:
-                       wcToggle();
-                       break;
-       }
-} else if ($device == 4711) {
-       if (gloria()) {
-               die('0');
-       }
-       // Cube SDB
-       switch ($_GET['state']) {
-               case 'Shake':
-                       execScene('home/alert', true);
-                       break;
-               case 'Flip_90':
-                       execScene('sdb/off', true);
-                       break;
-               case 'Flip_180':
-                       execScene('sdb/on', true);
-                       break;
-               case 'Free_Fall':
-                       off('sdb');
-                       break;
-               case 'Move':
-                       //_remoteCmd('pause', 'salon');
-                       break;
-               case 'Clock_Wise':
-                       volume(config('VOLUME_STEP'), '+');
-                       break;
-               case 'Anti_Clock_Wise':
-                       volume(config('VOLUME_STEP'), '-');
-                       break;
-               case 'Tap':
-                       squeezePlayByName('FIP', $squeezeboxPlayers['Salle de bains']);
-                       break;
-               case 'Alert':
-               default:
-                       break;
-       }
-}
-echo '1';
\ No newline at end of file
index 10bbb7ce9f5b369417c72b0055d167fe39e9dcb5..1c50158d8bcbbc961a041e05739f72c82c657c26 100644 (file)
@@ -8,22 +8,43 @@ if ($_GET['state'] === 'None') {
 $wcswitch = 'sensor.0x0c4314fffe7ce957_action';
 $cubebureau = 'sensor.0x00158d00042d7082_action';
 $switchBedroom = 'binary_sensor.switch_bedroom';
+$cubeSDB = 'sensor.0x00158d0005c19a86_action';
+$cubeSalon1 = 'sensor.';
+$cubeSalon2 = 'sensor.';
+$cubeSalon3 = 'sensor.';
 
-if ($_GET['id'] === $wcswitch) {
-       $forceConfig = 'wc';
-} else if ($_GET['id'] == $cubebureau) {
-       $forceConfig = 'bureau';
-} elseif ($_GET['id'] == $switchBedroom) {
-       $forceConfig = 'chambre';
+
+switch ($_GET['id']) {
+       case $wcswitch:
+               $action = 'wcSwitch';
+               $forceConfig = 'wc';
+               break;
+       case $cubebureau:
+               $forceConfig = 'bureau';
+               $action = 'cubeBureau';
+               break;
+       case $switchBedroom:
+               $forceConfig = 'chambre';
+               $action = 'chambreToggle';
+               break;
+       case $cubeSDB:
+               $forceConfig = 'sdb';
+               $action = 'cubeSDB';
+               break;
+       case $cubeSalon1:
+       case $cubeSalon2:
+       case $cubeSalon3:
+               $forceConfig = 'salon';
+               $action = 'cubeSalon';
+       default:
+               exit;
 }
 
 require_once "import.php";
 
-print_r($_GET);
+$action();
 
-if ($_GET['id'] === $switchBedroom) {
-       chambreToggle();
-} else if ($_GET['id'] === $wcswitch) {
+function wcSwitch() {
        switch ($_GET['state']) {
                case '1_double':
                case '2_double':
@@ -45,7 +66,10 @@ if ($_GET['id'] === $switchBedroom) {
                default:
                        break;
        }
-} else if ($_GET['id'] === $cubebureau) {
+}
+
+
+function cubeBureau() {
        if (gloria()) {
                die('0');
        }
@@ -91,4 +115,73 @@ if ($_GET['id'] === $switchBedroom) {
                default:
                        break;
        }
+}
+
+function cubeSDB() {
+       if (gloria()) {
+               die('0');
+       }
+       // Cube SDB
+       switch ($_GET['state']) {
+               case 'shake':
+                       execScene('home/alert', true);
+                       break;
+               case 'flip90':
+                       execScene('sdb/off', true);
+                       break;
+               case 'flip180':
+                       execScene('sdb/on', true);
+                       break;
+               case 'fall':
+               case 'slide':
+                       off('sdb');
+                       break;
+               case 'rotate_right':
+                       volume(config('VOLUME_STEP'), '+');
+                       break;
+               case 'rotate_left':
+                       volume(config('VOLUME_STEP'), '-');
+                       break;
+               case 'tap':
+                       squeezePlayByName('FIP', 'Salle de bains');
+                       break;
+               case 'Alert':
+               default:
+                       break;
+       }
+}
+
+function cubeSalon() {
+       if (gloria()) {
+               die('0');
+       }
+       switch ($_GET['state']) {
+               case 'shake':
+                       execScene('home/alert', true);
+                       break;
+               case 'flip90':
+                       execScene('salon/cinema', true);
+                       break;
+               case 'flip180':
+                       execScene('salon/auto', true);
+                       break;
+               case 'fall':
+                       off('salon');
+                       break;
+               case 'slide':
+                       _remoteCmd('pause', 'salon');
+                       break;
+               case 'rotate_right':
+                       volume(config('VOLUME_STEP'), '+');
+                       break;
+               case 'rotate_left':
+                       volume(config('VOLUME_STEP'), '-');
+                       break;
+               case 'tap':
+                       squeezePlayByName('FIP', 'Salon');
+                       break;
+               case 'Alert':
+               default:
+                       break;
+       }
 }
\ No newline at end of file