]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 31 Aug 2023 07:56:30 +0000 (09:56 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 31 Aug 2023 07:56:30 +0000 (09:56 +0200)
.idea/workspace.xml
scripts/homeassistant_device_event.php
scripts/lib/denon.php
scripts/lib/ecomode.php
scripts/lib/homeassistant.php
scripts/lib/scenes.php

index a51dd6baecfe006e7921ab745e4034799cf4288f..6972eede447c4f86d2ace9e19cc340a5eada3def 100644 (file)
@@ -5,10 +5,11 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/scripts/nightmode.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="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/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/denon.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/ecomode.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/ecomode.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/homeassistant.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/homeassistant.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1691844371156" duration="3221000" />
       <workItem from="1691860551613" duration="3280000" />
       <workItem from="1693125228572" duration="375000" />
-      <workItem from="1693126142732" duration="1825000" />
+      <workItem from="1693126142732" duration="2307000" />
+      <workItem from="1693131490373" duration="572000" />
+      <workItem from="1693134195261" duration="602000" />
+      <workItem from="1693209704251" duration="1417000" />
+      <workItem from="1693322814662" duration="2000" />
+      <workItem from="1693464071297" duration="1013000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="590" />
+    <option name="localTasksCounter" value="591" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 5fe222623befbd005ca7b757fd62b46334f223fb..5794451451a2c24393b11985d9c9ad3e6eb6177b 100644 (file)
@@ -16,6 +16,9 @@ const HA_CUBE_SALON_3 = 'sensor.0x00158d00058a55da_action';
 
 
 switch ($_GET['id']) {
+    case HA_SALON_PROJ_SENSOR:
+        $action = 'projSensor';
+        $forceConfig = 'salon';
     case HA_SWITCH_WC:
         $action = 'wcSwitch';
         $forceConfig = 'wc';
@@ -52,6 +55,13 @@ require_once "import.php";
 $action();
 
 
+function projSensor()
+{
+    if ($_GET['state'] === 'off') {
+        epson(false, true);
+    }
+}
+
 function getCubeFace($id = null)
 {
     if (null === $id) {
index a66038e142b9c633d37514a42591df2992ea0920..b87dca6be6c8a81b4c52ff4902a9d9af34f13881 100644 (file)
@@ -177,6 +177,9 @@ function denonAVROff()
 function epson($on = true, $force = false)
 {
     profile('Epson ' . $on);
+    if (haGetState(HA_SALON_PROJ_SENSOR) === 'off') {
+        $on = false;
+    }
 
     $currentState = getState('EpsonPowerState', '0') === '1';
     if (!$force && $currentState === $on) {
index 23faa46fc4bdc3569e877202b10c34a205020652..bdea404668045a5f3d09f9ec5cd5e9e2590113b0 100644 (file)
@@ -28,6 +28,7 @@ function disableSuperEcoMode()
 function nightmode($mode)
 {
     setState('night', (!!$mode) ? '1' : '0');
+    haAction('input_boolean.nightmode', (!!$mode) ? 'turn_on' : 'turn_off');
 }
 
 function getNightMode($device = null)
index f5269a44f62661f13d745772bf1c0b0f1e591228..253cfd018cfa8d0650a0503b9a869ab3f1372b10 100644 (file)
@@ -16,6 +16,8 @@ const HA_OFFICE_SCREEN='cover.office_screen';
 const HA_OFFICE_MAIN_SCREEN = 'switch.0xa4c138787633f01d';
 const HA_OFFICE_PLANE_SCREENS = 'switch.0xa4c138ba535d2cc5';
 
+const HA_SALON_PROJ_SENSOR='binary_sensor.0x00158d00094363cc_contact';
+
 function haGetState($id, $attribute = null) { //ID to read - for example sensor.foo
 
 
index a513e8c443ddf9c0c6b5b5237ad7e4568f74d0b4..467b6d1a7ae2fe6bccde0aab8da213824573411e 100644 (file)
@@ -634,13 +634,15 @@ $scenes = [
         ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'open_cover'],
     ],
     'bureau/rideaux/close' => [
-        ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'close_cover'],
+        ['type' => 'function', 'function' => 'bureauRideau', 'args' => ['close_cover']],
+
     ],
     'bureau/rideaux/open' => [
-        ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'open_cover'],
+        ['type' => 'function', 'function' => 'bureauRideau', 'args' => ['open_cover']],
+
     ],
     'bureau/rideaux/toggle' => [
-        ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'toggle'],
+        ['type' => 'function', 'function' => 'bureauRideau', 'args' => ['toggle']],
     ],
     'insteon/off' => [
         // ['type' => 'insteon', 'command' => '0?135=I=0=0'],
@@ -906,6 +908,14 @@ function welcomeEco()
     }
 }
 
+function bureauRideau($cmd)
+{
+    if (haGetState('binary_sensor.0x00124b002933744d_contact') == 'on') {
+        return;
+    }
+    haAction(HA_OFFICE_CURTAIN, $cmd);
+}
+
 function execScene($name, $fromUserAction = false, $transitionTime = null)
 {
     global $scenes;