]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 9 Jul 2023 19:13:06 +0000 (21:13 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 9 Jul 2023 19:13:06 +0000 (21:13 +0200)
.idea/workspace.xml
scripts/homeassistant_device_event.php
scripts/lib/homeassistant.php
scripts/lib/scenes.php

index 70a3fd9089baa74892cfc5edf659737b706eefce..126f4b2a760dcf13c72b76a6336f895fe8c0933b 100644 (file)
@@ -5,7 +5,10 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <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/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" />
     <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="14386000" />
+      <workItem from="1688897001591" duration="18367000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="566" />
+    <option name="localTasksCounter" value="567" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 4b5ba5f6eb595ba220e454c2d5b074929d20a09f..d83f629447b4a47ec6db1650b95f3b9d99f8199f 100644 (file)
@@ -53,7 +53,7 @@ function getCubeFace($id = null) {
                $id = $_GET['id'];
        }
        $id = str_replace('_action', '_side', $id);
-       return (int)getState('cube_face_' . $id, 1);
+       return (int)haGetState($id);
 }
 
 function wcSwitch() {
@@ -103,7 +103,7 @@ function cubeBureau() {
                        off('bureau');
                        break;
                case 'slide':
-                       if ($face == 5) {
+                       if ($face == 3) {
                                haAction('script.klarstein_fan_toggle');
                                break;
                        }
@@ -115,14 +115,14 @@ function cubeBureau() {
                        }
                        break;
                case 'rotate_right':
-                       if ($face == 5) {
+                       if ($face == 3) {
                                haAction('script.klarstein_fan_speed_up');
                                break;
                        }
                        volume(config('VOLUME_STEP'), '+');
                        break;
                case 'rotate_left':
-                       if ($face == 5) {
+                       if ($face == 3) {
                                haAction('script.klarstein_fan_speed_down');
                                break;
                        }
index 566d561737072ec1cba90655085f239aad12d8e1..1f42bad49757c66badde8cf239c229663c90a25e 100644 (file)
@@ -8,6 +8,7 @@ const HA_ECO_BASIC = 'switch.ecomode_basic';
 const HA_ECO_SUPER = 'switch.ecomode_super';
 const HA_HOTTE = 'switch.hotte';
 const HA_BAR = 'switch.bar';
+const HA_PLANETARIUM='switch.0xa4c138788071821e';
 
 function haGetState($id, $attribute = null) { //ID to read - for example sensor.foo
 
index 344aaf88edfe1e9d13b231db980ecc69e610d181..1e0ae14e56bff8045adfc317bb80c9da0e5966f1 100644 (file)
@@ -62,7 +62,6 @@ $scenes = [
                ['type' => 'ecomode', 'mode' => '1'],
                ['type' => 'state', 'key' => 'chambre', 'value' => 0],
                ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
                ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
                ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Va Au Lit'],
@@ -93,7 +92,6 @@ $scenes = [
                ['type' => 'ecomode', 'mode' => '1'],
                ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
                ['type' => 'state', 'key' => 'chambre', 'value' => 0],
-               //['type' => 'insteon', 'command' => '0?1332=I=0=0'], // Lustre et tableau off
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
                ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
                ['type' => 'scene', 'scene' => 'sdb/off'],
@@ -104,7 +102,7 @@ $scenes = [
        'chambre/sleep' => [
                ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => '-P3feFyrTnFNfXi'], // Veilleuse +
-               ['type' => 'domoticz', 'scene' => 10, 'command' => true, 'priority' => true],
+               ['type' => 'ha', 'device' => 'scene.chambre_veilleuseplus'],
                ['type' => 'scene', 'scene' => 'chambre/sleep/base'],
                ['type' => 'delay', 'scene' => 'chambre/bed/off', 'delay' => 300], // Tout off dans 5 min
        ],
@@ -112,30 +110,26 @@ $scenes = [
        'chambre/boreal' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'mwAGvt2n70oXCqA'],
-               ['type' => 'domoticz', 'scene' => 4, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/cold'],
+               ['type' => 'ha', 'device' => 'scene.chambre_boreal'],
+               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/savane' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'ABqCuE-ob-sw2vQ'],
-               ['type' => 'domoticz', 'scene' => 5, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_savane'],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/focus' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'Ne6uJnnoPO9yRhl'],
-               ['type' => 'domoticz', 'scene' => 6, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_focus'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/cold'],
+               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/chillout' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => '03gdSwPyZ9sbZVg'],
-               ['type' => 'domoticz', 'scene' => 7, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_chillout'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
@@ -146,80 +140,72 @@ $scenes = [
        'chambre/reading' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'BNiNQjxiWNbKRaH'],
-               ['type' => 'domoticz', 'scene' => 8, 'command' => true, 'priority' => true],
-               // ['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_reading'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/tonic' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'Tlcft9sPK492cJA'],
-               ['type' => 'domoticz', 'scene' => 9, 'command' => true, 'priority' => true],
-               // ['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_tonic'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/cold'],
+               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
 
        'chambre/moon' => [
                ['type' => 'hue', 'group' => $chambre, 'scene' => '5PKfoOn8ss17o2l'], // Clair de lune
-               ['type' => 'domoticz', 'scene' => 11, 'command' => true, 'priority' => true],
+               ['type' => 'ha', 'device' => 'scene.chambre_clairdelune'],
                ['type' => 'scene', 'scene' => 'chambre/sleepbase'],
        ],
        'chambre/party' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'qvQXHDodBPa0cZf'],
-               ['type' => 'domoticz', 'scene' => 12, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1119=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_party'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/flowers' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'VtGPKtpQ7DF-RCd'],
-               ['type' => 'domoticz', 'scene' => 13, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_flowers'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/tropical' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'Mqq8VMsmPQtzEQ0'],
-               ['type' => 'domoticz', 'scene' => 14, 'command' => true, 'priority' => true],
-               // ['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_tropical'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/beach' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'HfMaPG92lEOUDB0'],
-               ['type' => 'domoticz', 'scene' => 15, 'command' => true, 'priority' => true],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_beach'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/nightlights' => [
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'JNieZpDHu5fbMyf'],
-               ['type' => 'domoticz', 'scene' => 16, 'command' => true, 'priority' => true],
+               ['type' => 'ha', 'device' => 'scene.chambre_summernight'],
        ],
        'chambre/summernight' => [
                ['type' => 'scene', 'scene' => 'chambre/nightlights'],
-               //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_summernight'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/lounge' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'XGuSVQ3RCd7JUBC'],
-               ['type' => 'domoticz', 'scene' => 17, 'command' => true, 'priority' => true],
-               // ['type' => 'insteon', 'command' => '0?1131=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_lounge'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
        'chambre/full' => [
                ['type' => 'nightmode', 'mode' => '0'],
                ['type' => 'hue', 'group' => $chambre, 'scene' => 'ZkiQbNQDXJz9-OC'],
-               ['type' => 'domoticz', 'scene' => 18, 'command' => true, 'priority' => true],
-               // ['type' => 'insteon', 'command' => '0?1132=I=0=0'],
+               ['type' => 'ha', 'device' => 'scene.chambre_full'],
                ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
                ['type' => 'scene', 'scene' => 'chambre/cheminee'],
        ],
@@ -232,21 +218,17 @@ $scenes = [
                ['type' => 'state', 'key' => 'chambre', 'value' => 0],
                ['type' => 'state', 'key' => 'chambreOff', 'value' => 1],
                ['type' => 'hue', 'group' => $chambre, 'scene' => array('on' => false)],
-               // ['type' => 'insteon', 'command' => '0?1332=I=0=0'],
-               ['type' => 'domoticz', 'scene' => 19, 'command' => false, 'priority' => true],
+               ['type' => 'ha', 'device' => 'scene.chambre_off'],
                ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
        ],
        'chambre/cheminee' => [
-               ['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true],
+               ['type' => 'ha', 'device' => "scene.chambre_cheminee"],
        ],
        'chambre/cheminee/smallfire' => [
-               ['type' => 'domoticz', 'scene' => 44, 'command' => true, 'priority' => true],
-       ],
-       'chambre/cheminee/cold' => [
-               ['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true],
+               ['type' => 'ha', 'device' => "scene.chambre_cheminee_small"],
        ],
        'chambre/cheminee/off' => [
-               ['type' => 'domoticz', 'scene' => 43, 'command' => false, 'priority' => true],
+               ['type' => 'ha', 'device' => 'light.chambre_cheminee', 'command' => 'turn_off'],
        ],
        'chambre/toggle' => [
                ['type' => 'function', 'function' => 'chambreToggle'],
@@ -1073,13 +1055,13 @@ function checkPlanetarium($periodicOffCheck = true) {
                if ($periodicOffCheck) {
                        $min = intval(date('i'));
                        if ($min % 30 == 0) {
-                               domoticzSwitch($device, false);
+                               haAction(HA_PLANETARIUM, 'turn_off');
                                sleep(5);
                        }
                }
-               domoticzSwitch($device, true);
+               haAction(HA_PLANETARIUM);
        } else {
-               domoticzSwitch($device, false);
+               haAction(HA_PLANETARIUM, 'turn_off');
        }
 }