]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 27 Aug 2023 09:25:40 +0000 (11:25 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 27 Aug 2023 09:25:40 +0000 (11:25 +0200)
.idea/dataSources.local.xml
.idea/workspace.xml
scripts/lib/ecomode.php
scripts/lib/scenes.php
scripts/nightmode.php [new file with mode: 0644]

index 1e3b65eff9ab09ebf5f6e1771e20a4c798ee7469..210642b4f5cbfcb94bad2eb2412b9284a2aa7036 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="dataSourceStorageLocal" created-in="IU-232.8660.185">
+  <component name="dataSourceStorageLocal" created-in="IU-232.9559.62">
     <data-source name="LFY(3).db" uuid="e5a3291d-855f-44b2-be41-76fe6b0c2136">
       <database-info product="SQLite" version="3.25.1" jdbc-version="2.1" driver-name="SQLite JDBC" driver-version="3.25.1" dbms="SQLITE" exact-version="3.25.1" exact-driver-version="3.25">
         <identifier-quote-string>&quot;</identifier-quote-string>
index 5a57da2fcea76e8a39a959a93718729631e92527..a51dd6baecfe006e7921ab745e4034799cf4288f 100644 (file)
@@ -5,9 +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/lib/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/denon.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/ecomode.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/ecomode.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="1690910375137" duration="580000" />
       <workItem from="1691748561800" duration="1265000" />
       <workItem from="1691844371156" duration="3221000" />
-      <workItem from="1691860551613" duration="1658000" />
+      <workItem from="1691860551613" duration="3280000" />
+      <workItem from="1693125228572" duration="375000" />
+      <workItem from="1693126142732" duration="1825000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="589" />
+    <option name="localTasksCounter" value="590" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index b05b6e0db7c46d792720b31cd0d9f2887de3dc44..23faa46fc4bdc3569e877202b10c34a205020652 100644 (file)
@@ -32,7 +32,8 @@ function nightmode($mode)
 
 function getNightMode($device = null)
 {
-    $device = $device === null ?: config('DEVICE');
+    $device = $device ?? config('DEVICE');
+
     if ($device === 'sdb') {
         $h = date('H');
         if ($h >= 6 && $h <= 8) {
@@ -53,10 +54,6 @@ function getNightMode($device = null)
             return true;
         }
         return getState('bureauOff') == '1';
-    } else if ($device === 'wc') {
-        if (!getState('bureauOff')) {
-            return false;
-        }
     } else if ($device === 'entree' || $device === 'cuisine') {
         $lights = [15, 18, 1, 58, 59, 57, 56, 55, 37];
         $hueLights = getHueInstance()->getLights();
@@ -75,10 +72,14 @@ function getNightMode($device = null)
     return getState('night') == '1';
 }
 
-function getEcoMode()
+function getEcoMode($device = null)
 {
+    $device = $device === null ?: config('DEVICE');
     $res = getState('ecomode', '0');
-    if ($res == '0' && getNightMode()) {
+    if ($res == '1' && !getNightMode($device)) {
+        return '0';
+    }
+    if ($res == '0' && getNightMode($device)) {
         $res = '1';
     }
     return (string)$res;
index c35a455898387ca50f9641d03ad8ee8aee475dec..a513e8c443ddf9c0c6b5b5237ad7e4568f74d0b4 100644 (file)
@@ -24,1234 +24,1261 @@ $chambrefan = 6952;
 $bar = 6985;
 
 $scenes = [
-       'chambre/matin' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'ecomode', 'mode' => '0'],
-               ['type' => 'scene', 'scene' => 'chambre/nightlights'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => 'dawn', 'delay' => 1],
-               ['type' => 'scene', 'scene' => 'chambre/rideaux/open', 'delay' => 31],
-               ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
-               ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Matin'],
-               ['type' => 'scene', 'scene' => 'chambre/auto', 'delay' => 35],
-               ['type' => 'scene', 'scene' => 'cuisine/coffee/on'],
-       ],
-       'chambre/deshumidificateur/on' => [
-               //['type' => 'domoticz', 'device' => $chambrefan, 'command' => true],
-       ],
-       'chambre/deshumidificateur/off' => [
-               //['type' => 'domoticz', 'device' => $chambrefan, 'command' => false],
-       ],
-       'chambre/fan/on' => [
-               ['type' => 'domoticz', 'device' => $chambrefan, 'command' => true],
-       ],
-       'chambre/fan/off' => [
-               ['type' => 'domoticz', 'device' => $chambrefan, 'command' => false],
-       ],
-       'chambre/fan/toggle' => [
-               ['type' => 'domoticz', 'device' => $chambrefan, 'command' => 'Toggle'],
-       ],
-       'chambre/auto' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'function', 'function' => 'chambreAuto', 'args' => [true]],
-       ],
-       'chambre/bed/base' => [
-               ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
-               ['type' => 'nightmode', 'mode' => '1'],
-               ['type' => 'ecomode', 'mode' => '1'],
-               ['type' => 'state', 'key' => 'chambre', 'value' => 0],
-               ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
-               ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
-               ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Va Au Lit'],
-       ],
-       'chambre/bed' => [
-               ['type' => 'scene', 'scene' => 'chambre/bed/base'],
-               ['type' => 'scene', 'scene' => 'chambre/nightlights'],
-               ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
-               ['type' => 'scene', 'scene' => 'sdb/nuit'],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'],
-       ],
-       'chambre/bed/off' => [
-               ['type' => 'scene', 'scene' => 'chambre/bed/base'],
-               ['type' => 'nightmode', 'mode' => '1'],
-               ['type' => 'ecomode', 'mode' => '1'],
-               ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'],
-               ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/off'],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/off', 'delay' => 2],
-       ],
-       'chambre/sleep/off' => [
-               ['type' => 'scene', 'scene' => 'chambre/bed/base'],
-               ['type' => 'scene', 'scene' => 'sdb/off'],
-       ],
-       'chambre/sleep/base' => [
-               ['type' => 'nightmode', 'mode' => '1'],
-               ['type' => 'ecomode', 'mode' => '1'],
-               ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
-               ['type' => 'state', 'key' => 'chambre', 'value' => 0],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
-               ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
-               ['type' => 'scene', 'scene' => 'sdb/off'],
-               ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
-               ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
-               ['type' => 'delay', 'scene' => 'chambre/planetarium/off', 'delay' => 3600], // Planétarium off dans une heure
-       ],
-       'chambre/sleep' => [
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => '-P3feFyrTnFNfXi'], // Veilleuse +
-               ['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
-       ],
-
-       'chambre/boreal' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => 'mwAGvt2n70oXCqA'],
-               ['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' => 'ha', 'device' => 'scene.chambre_savane'],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
-       ],
-       'chambre/focus' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => 'Ne6uJnnoPO9yRhl'],
-               ['type' => 'ha', 'device' => 'scene.chambre_focus'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
-       ],
-       'chambre/chillout' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => '03gdSwPyZ9sbZVg'],
-               ['type' => 'ha', 'device' => 'scene.chambre_chillout'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
-       ],
-       'chambre/reading/fireplace' => [
-               ['type' => 'scene', 'scene' => 'chambre/chillout'],
-               ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Cheminée', $squeezeboxPlayers['Chambre']]],
-       ],
-       'chambre/reading' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => 'BNiNQjxiWNbKRaH'],
-               ['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' => 'ha', 'device' => 'scene.chambre_tonic'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
-       ],
-
-       'chambre/moon' => [
-               ['type' => 'hue', 'group' => $chambre, 'scene' => '5PKfoOn8ss17o2l'], // Clair de lune
-               ['type' => 'ha', 'device' => 'scene.chambre_clairdelune'],
-               ['type' => 'scene', 'scene' => 'chambre/sleepbase'],
-       ],
-       'chambre/party' => [
-               ['type' => 'nightmode', 'mode' => '0'],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => 'qvQXHDodBPa0cZf'],
-               ['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' => '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' => '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' => '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' => 'ha', 'device' => 'scene.chambre_summernight'],
-       ],
-       'chambre/summernight' => [
-               ['type' => 'scene', 'scene' => 'chambre/nightlights'],
-               ['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' => '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' => 'ha', 'device' => 'scene.chambre_full'],
-               ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee'],
-       ],
-       'chambre/off' => [
-               ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'],
-               ['type' => 'scene', 'scene' => 'chambre/cheminee/off'],
-               ['type' => 'scene', 'scene' => 'chambre/fan/off'],
-       ],
-       'chambre/off/exceptcheminee' => [
-               ['type' => 'state', 'key' => 'chambre', 'value' => 0],
-               ['type' => 'state', 'key' => 'chambreOff', 'value' => 1],
-               ['type' => 'hue', 'group' => $chambre, 'scene' => array('on' => false)],
-               ['type' => 'ha', 'device' => 'scene.chambre_off'],
-               ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
-       ],
-       'chambre/cheminee' => [
-               ['type' => 'ha', 'device' => "scene.chambre_cheminee"],
-       ],
-       'chambre/cheminee/smallfire' => [
-               ['type' => 'ha', 'device' => "scene.chambre_cheminee_small"],
-       ],
-       'chambre/cheminee/off' => [
-               ['type' => 'ha', 'device' => 'light.chambre_cheminee', 'command' => 'turn_off'],
-       ],
-       'chambre/toggle' => [
-               ['type' => 'function', 'function' => 'chambreToggle'],
-       ],
-       'chambre/planetarium/off' => [
-               ['type' => 'function', 'function' => 'planetarium', 'args' => [false]],
-       ],
-       'chambre/planetarium/on' => [
-               ['type' => 'function', 'function' => 'planetarium', 'args' => [true]],
-       ],
-       'chambre/vincent/lecture' => [
-               ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 35, 'colorTemp' => 346, 'transitionTime' => 10)],
-       ],
-       'chambre/vincent/litdiscret' => [
-               ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 20, 'hue' => 0, 'saturation' => 255, 'transitionTime' => 1)],
-       ],
-       'chambre/vincent/crepuscule' => [
-               // ['type' => 'insteon', 'command' => '3?0262261ED00F1300=I=3'],
-               ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 60, 'hue' => '0', 'saturation' => 255, 'transitionTime' => 10)],
-               ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => false, 'brightness' => 0, 'transitionTime' => 10 * 60)],
-               //['type' => 'insteon', 'command' => '3?0262261ED00F11FF=I=3'],
-       ],
-       'chambre/vincent/aube' => [
-               ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 0, 'hue' => '46920', 'saturation' => 255, 'transitionTime' => 0)],
-               ['type' => 'hue', 'light' => $litvincent, 'scene' => array('brightness' => 128, 'colorTemp' => 156, 'transitionTime' => 60 * 60)],
-       ],
-
-       'chambre/rideaux/open' => [
-               ['type' => 'ha', 'device' => 'script.rideaux_chambre_ouvre'],
-       ],
-       'chambre/rideaux/close' => [
-               ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
-       ],
-       'home/alert' => [
-               ['type' => 'function', 'function' => 'alert',],
-       ],
-       'home/doalert' => [
-               ['type' => 'domoticz', 'device' => '4207', 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $alert, 'scene' => ['alert' => 'lselect']],
-               ['type' => 'hue', 'group' => $alert, 'delay' => 3, 'scene' => ['alert' => 'none']],
-               ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'],
-               ['type' => 'phonetask', 'phone' => 'sdb', 'task' => 'Tortuga Alerte'],
-       ],
-       'home/aulit' => [
-               ['type' => 'scene', 'scene' => 'chambre/bed'],
-               ['type' => 'scene', 'scene' => 'home/aulitbase'],
-       ],
-       'home/aulitoff' => [
-               ['type' => 'scene', 'scene' => 'home/aulitbase'],
-               ['type' => 'scene', 'scene' => 'chambre/bed/off'],
-               ['type' => 'scene', 'scene' => 'sdb/off'],
-       ],
-       'home/aulitbase' => [
-               ['type' => 'scene', 'scene' => 'bureau/off'],
-               ['type' => 'scene', 'scene' => 'salon/off'],
-               ['type' => 'scene', 'scene' => 'cuisine/off'],
-               ['type' => 'scene', 'scene' => 'cour/off'],
-               ['type' => 'scene', 'scene' => 'salon/media/off'],
-               ['type' => 'function', 'function' => 'stopHarmony'],
-               ['type' => 'function', 'function' => 'stopAllSqueezebox'],
-               ['type' => 'nightmode', 'mode' => '1'],
-               ['type' => 'ecomode', 'mode' => '1'],
-               ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
-       ],
-       'home/music/synchro/soiree' => [
-               ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine', 'Bureau', 'WC']]],
-       ],
-       'home/music/synchro/salon-cuisine' => [
-               ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine']]],
-       ],
-       'home/music/synchro/all' => [
-               ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine', 'Bureau', 'WC', 'Chambre', 'SDB']]],
-       ],
-       'home/music/synchro/chambre-sdb' => [
-               ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Chambre', 'SDB']]],
-       ],
-       'home/music/synchro/bureau-wc' => [
-               ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Bureau', 'WC']]],
-       ],
-       'home/music/synchro/off' => [
-               ['type' => 'function', 'function' => 'stopAllSqueezebox'],
-       ],
-       'salon/projector/on' => [
-               ['type' => 'function', 'function' => 'epson', 'args' => [true, true]],
-       ],
-       'salon/projector/off' => [
-               ['type' => 'function', 'function' => 'epson', 'args' => [false, true]],
-       ],
-       'salon/auto' => [
-               ['type' => 'function', 'function' => 'salonAuto', 'args' => [true]],
-       ],
-       'salon/bar/on' => [
-               ['type' => 'ha', 'device' => HA_BAR, 'priority' => true],
-       ],
-       'salon/bar/off' => [
-               ['type' => 'ha', 'device' => HA_BAR, 'command' => 'turn_off', 'priority' => true],
-       ],
-       'salon/bar/toggle' => [
-               ['type' => 'ha', 'device' => HA_BAR, 'command' => 'toggle', 'priority' => true],
-       ],
-       'salon/day' => [
-               ['type' => 'ha', 'device' => 'scene.salon_on'],
-               ['type' => 'domoticz', 'scene' => 45, 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => '9ay5VtNcjvUZIFF', 'repeat' => 2],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'on'],
-               ['type' => 'scene', 'scene' => 'cuisine/on', 'delay' => 1],
-               ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1],
-               ['type' => 'scene', 'scene' => 'salon/bar/on'],
-       ],
-       'salon/lumineux' => [
-               ['type' => 'ha', 'device' => 'scene.salon_lumineux'],
-               ['type' => 'hue', 'group' => $salon, 'scene' => '9ay5VtNcjvUZIFF', 'repeat' => 2],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'on'],
-               ['type' => 'scene', 'scene' => 'cuisine/on', 'delay' => 1],
-               ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1],
-               ['type' => 'scene', 'scene' => 'salon/bar/on'],
-       ],
-       'salon/off' => [
-               ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
-               ['type' => 'ha', 'device' => 'scene.salon_off'],
-               ['type' => 'domoticz', 'scene' => 45, 'command' => false, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'off'],
-               //['type' => 'insteon', 'command' => '0?133=I=0=0'],
-               ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']],
-               ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
-               ['type' => 'scene', 'scene' => 'salon/fan/off'],
-               ['type' => 'scene', 'scene' => 'salon/bar/off'],
-       ],
-       'salon/cinemabase' => [
-
-               // ['type' => 'scene', 'scene' => 'cuisine/tamise'],
-               //        ['type' => 'ecomode', 'mode' => '0'],
-               // ['type' => 'insteon', 'command' => '0?1111=I=0=0'],
-       ],
-       'salon/cineclub' => [
-               ['type' => 'scene', 'scene' => 'salon/bar/off'],
-               ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
-               ['type' => 'ha', 'device' => 'scene.salon_cineclub'],
-               ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu', 'repeat' => 2],
-               ['type' => 'scene', 'scene' => 'salon/cinemabase'],
-               ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
-               ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
-       ],
-       'salon/cinema' => [
-               ['type' => 'scene', 'scene' => 'salon/bar/off'],
-               ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
-               ['type' => 'ha', 'device' => 'scene.salon_cinema'],
-               ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35', 'repeat' => 2],
-               ['type' => 'scene', 'scene' => 'salon/cinemabase'],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
-               ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
-               ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
-       ],
-       'salon/tamise' => [
-               ['type' => 'ecomode', 'mode' => '0'],
-               ['type' => 'ha', 'device' => 'scene.salon_tamise'],
-               ['type' => 'domoticz', 'scene' => 48, 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU', 'repeat' => 2],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
-               // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
-               ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
-               ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
-               ['type' => 'scene', 'scene' => 'salon/bar/on'],
-       ],
-       'salon/theatre' => [
-               ['type' => 'ecomode', 'mode' => '0'],
-               ['type' => 'domoticz', 'scene' => 53, 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => 'xWNIeznSzek8dKS', 'repeat' => 2],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'theatre'],
-               // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
-               ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
-               ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
-       ],
-       'salon/lecturenocture' => [
-               ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
-               ['type' => 'ha', 'device' => 'scene.salon_lecturenocturne'],
-               ['type' => 'domoticz', 'scene' => 49, 'command' => true, 'priority' => true],
-               ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'],
-               ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
-               // ['type' => 'insteon', 'command' => '0?1113=I=0=0'],
-               ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.25]],
-               ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
-               ['type' => 'scene', 'scene' => 'salon/bar/off'],
-       ],
-       'salon/cheminee' => [
-               ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 1]],
-       ],
-       'salon/cheminee/off' => [
-               ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']],
-       ],
-       'salon/media/off' => [
-               ['type' => 'function', 'function' => 'off', 'args' => ['salon']],
-       ],
-       'salon/media/play' => [
-
-       ],
-       'salon/fan/on' => [
-               ['type' => 'domoticz', 'device' => '478', 'command' => true],
-       ],
-       'salon/fan/off' => [
-               ['type' => 'domoticz', 'device' => '478', 'command' => false],
-       ],
-       'salon/fan/toggle' => [
-               ['type' => 'domoticz', 'device' => '478', 'command' => 'Toggle', 'priority' => true],
-       ],
-       'bureau/pc/wakeup' => [
-               ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']],
-       ],
-       'bureau/pc/sleep' => [
-               ['type' => 'function', 'function' => 'sleepPC', 'args' => ['avion']],
-       ],
-       'bureau/pc/shutdown' => [
-               ['type' => 'function', 'function' => 'shutdownPC', 'args' => ['avion']],
-       ],
-       'bureau/screens/off' => [
-               ['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Games', 'avion']]
-       ],
-       'bureau/screens/on' => [
-               ['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Tortuga', 'avion']]
-       ],
-       'bureau/fan/on' => [
-               ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
-       ],
-       'bureau/fan/off' => [
-               ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
-       ],
-       'bureau/fan/toggle' => [
-               ['type' => 'ha', 'device' => 'script.klarstein_fan_toggle'],
-       ],
-       'bureau/auto' => [
-               ['type' => 'function', 'function' => 'bureauAuto', 'args' => [true]],
-       ],
-       'bureau/base/on' => [
-               ['type' => 'ecomode', 'mode' => '0'],
-               ['type' => 'scene', 'scene' => 'bureau/pc/wakeup'],
-       ],
-       'bureau/cinema' => [
-               ['type' => 'scene', 'scene' => 'bureau/base/off'],
-               ['type' => 'hue', 'group' => $bureau, 'scene' => '7mofVclWdtvpVyt'],
-               ['type' => 'ha', 'device' => 'scene.bureau_cinema'],
-       ],
-       'bureau/lumineux' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'SdXwtZu5PCDjK2h'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'lumineux'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_lumineux'],
-       ],
-       'bureau/veilleuse' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'ooQq4Jfbf1CleDy'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'veilleuse'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_veilleuse'],
-       ],
-       'bureau/flowers' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'mJ-AVlYFyL5x1cN'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'flowers'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_flowers'],
-       ],
-       'bureau/videogames' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'ooQq4Jfbf1CleDy'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'veilleuse'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/off'],
-               ['type' => 'ha', 'device' => 'scene.bureau_videogames'],
-       ],
-       'bureau/tchernobyl' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'KoByn2ehWHDdchu'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tchernobyl'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_tchernobyl'],
-       ],
-       'bureau/outrun' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => '9TzWQt6f7-EgVtm'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'outrun'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_outrun'],
-       ],
-       'bureau/boreal' => [
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'boreal'],
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'dJaWFQBb0APEgtL'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_boreal'],
-       ],
-       'bureau/tropical' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'biXLpKpIZYDlxen'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tropical'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_tropical'],
-
-       ],
-       'bureau/lounge' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'vvE8WAMdNpgswrw'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'lounge'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_lounge'],
-
-       ],
-       'bureau/focus' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'yPYgG-zQWuAA13d'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'space'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_focus'],
-
-       ],
-       'bureau/tonic' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'S-YiVWKsEKipL0G'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tonic'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_tonic'],
-
-       ],
-       'bureau/lecture' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'Hjr7rfz4LC9xVoB'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'lecture'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_lecture'],
-
-       ],
-       'bureau/chillout' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => '-UOMTUG6z-hMbRA'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'chillout'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_chillout'],
-
-       ],
-       'bureau/tamise' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => '8fgGg2ylE4aO3t3'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tamise'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_tamise'],
-       ],
-       'bureau/beach' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => '0mPAKOl-Kw8Fwb1'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'beach'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_beach'],
-
-       ],
-       'bureau/jellyfish' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'VhHVIcN-nKLwP9E'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'jellyfish'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_jellyfish'],
-
-       ],
-       'bureau/sharks' => [
-               ['type' => 'hue', 'group' => $bureau, 'scene' => 'VhHVIcN-nKLwP9E'],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'sharks'],
-               ['type' => 'scene', 'scene' => 'bureau/base/on'],
-               ['type' => 'scene', 'scene' => 'bureau/screens/on'],
-               ['type' => 'ha', 'device' => 'scene.bureau_jellyfish'],
-
-       ],
-       'bureau/base/off' => [
-               ['type' => 'ha', 'device' => 'scene.bureau_off'],
-               ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]],
-               ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'off'],
-               ['type' => 'hue', 'group' => $bureau, 'scene' => array('on' => false)],
-               ['type' => 'hue', 'light' => 23, 'scene' => array('on' => false)],
-       ],
-       'bureau/off' => [
-               ['type' => 'scene', 'scene' => 'bureau/base/off'],
-               ['type' => 'scene', 'scene' => 'bureau/pc/sleep'],
-       ],
-       'bureau/media/play' => [
-               ['type' => 'state', 'key' => 'bureauPlaying', 'value' => '1'],
-               ['type' => 'scene', 'scene' => 'bureau/screen/down'],
-               ['type' => 'scene', 'scene' => 'bureau/rideaux/close'],
-               ['type' => 'scene', 'scene' => 'bureau/cinema'],
-               ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]],
-               ['type' => 'function', 'function' => 'harmonyActivity', 'args' => [HARMONY_TV]],
-       ],
-       'bureau/media/stop' => [
-               ['type' => 'state', 'key' => 'bureauPlaying', 'value' => '0'],
-               ['type' => 'scene', 'scene' => 'bureau/screen/up'],
-               ['type' => 'scene', 'scene' => 'bureau/rideaux/open'],
-               ['type' => 'scene', 'scene' => 'bureau/auto'],
-       ],
-       'bureau/screen/down' => [
-               ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'close_cover'],
-       ],
-       'bureau/screen/up' => [
-               ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'open_cover'],
-       ],
-       'bureau/rideaux/close' => [
-               ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'close_cover'],
-       ],
-       'bureau/rideaux/open' => [
-               ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'open_cover'],
-       ],
-       'bureau/rideaux/toggle' => [
-               ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'toggle'],
-       ],
-       'insteon/off' => [
-               // ['type' => 'insteon', 'command' => '0?135=I=0=0'],
-       ],
-       'home/off' => [
-               ['type' => 'scene', 'scene' => 'home/hueoff'],
-               ['type' => 'ecomode', 'mode' => '2'],
-               ['type' => 'scene', 'scene' => 'cuisine/off'],
-               ['type' => 'scene', 'scene' => 'salon/off'],
-               ['type' => 'scene', 'scene' => 'cour/off'],
-               ['type' => 'scene', 'scene' => 'bureau/base/off'],
-               ['type' => 'scene', 'scene' => 'chambre/off'],
-               ['type' => 'scene', 'scene' => 'sdb/off'],
-               ['type' => 'scene', 'scene' => 'wc/off'],
-               ['type' => 'function', 'function' => 'stopHarmony'],
-               ['type' => 'function', 'function' => 'stopAllSqueezebox'],
-               ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
-               ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
-               ['type' => 'scene', 'scene' => 'cuisine/coffee/off'],
-               ['type' => 'scene', 'scene' => 'bureau/pc/shutdown'],
-               ['type' => 'scene', 'scene' => 'home/hueoff'],
-               ['type' => 'scene', 'scene' => 'salon/media/off'],
-               ['type' => 'scene', 'scene' => 'salon/off', 'delay' => 2],
-               ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
-       ],
-
-       'home/welcome/eco' => [
-               ['type' => 'function', 'function' => 'welcomeEco'],
-       ],
-
-       'home/welcome/eco/salon' => [
-               ['type' => 'scene', 'scene' => 'salon/auto'],
-               ['type' => 'scene', 'scene' => 'cuisine/on'],
-               ['type' => 'ecomode', 'mode' => '0'],
-               ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
-               ['type' => 'scene', 'scene' => 'bureau/off'],
-               ['type' => 'scene', 'scene' => 'chambre/off'],
-       ],
-
-       'home/welcome/eco/homeoffice' => [
-               ['type' => 'scene', 'scene' => 'bureau/auto'],
-               ['type' => 'scene', 'scene' => 'cuisine/on'],
-               ['type' => 'ecomode', 'mode' => '0'],
-               ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
-               ['type' => 'scene', 'scene' => 'salon/off'],
-               ['type' => 'scene', 'scene' => 'chambre/off'],
-               ['type' => 'ha', 'device' => HA_OFFICE_PLANE_SCREENS, 'action' => 'turn_off'],
-       ],
-
-       'home/welcome' => [
-               ['type' => 'scene', 'scene' => 'cuisine/on'],
-               ['type' => 'scene', 'scene' => 'salon/auto'],
-               ['type' => 'scene', 'scene' => 'bureau/auto'],
-               ['type' => 'ha', 'device' => HA_OFFICE_PLANE_SCREENS],
-               ['type' => 'scene', 'scene' => 'chambre/auto'],
-               ['type' => 'scene', 'scene' => 'sdb/on'],
-               ['type' => 'scene', 'scene' => 'cour/auto'],
-               ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
-               ['type' => 'ecomode', 'mode' => '0'],
-       ],
-       'home/hueoff' => [
-               ['type' => 'hue', 'group' => 17, 'scene' => ['on' => false, 'effect' => 'none']],
-       ],
-       'wc/on' => [
-               ['type' => 'function', 'function' => 'wcOn'],
-       ],
-       'wc/morning' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => 'NC5ejamHGUNURj8'],
-               ['type' => 'function', 'function' => 'wcMusic', 'args' => [70]],
-       ],
-       'wc/day' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => 'qfuu8z5QaJ6J26W'],
-               ['type' => 'function', 'function' => 'wcMusic', 'args' => [80]],
-       ],
-       'wc/evening' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => 'h82j28eNu6ZHVhM'],
-               ['type' => 'function', 'function' => 'wcMusic', 'args' => [80]],
-       ],
-       'wc/late' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => 'IGo4F5jRQXc1H95'],
-               ['type' => 'function', 'function' => 'wcMusic', 'args' => [70]],
-       ],
-       'wc/night' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => 'eJy09JTEzCiIL1P'],
-       ],
-       'wc/nightambiance' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => ['effect' => 'none']],
-               ['type' => 'scene', 'scene' => 'wc/night'],
-               ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Nuit d\'été', $squeezeboxPlayers['WC'], 100, false]],
-       ],
-       'wc/off' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => ['on' => false, 'effect' => 'none']],
-               ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['WC'], false]],
-               ['type' => 'state', 'key' => 'wc', 'value' => 0],
-               ['type' => 'function', 'function' => 'wcVMCOff'],
-       ],
-       'wc/spa' => [
-               ['type' => 'hue', 'group' => $wc, 'scene' => ['effect' => 'colorloop', 'on' => true, 'brightness' => 128]],
-               ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Rivière', $squeezeboxPlayers['WC'], 100]],
-               ['type' => 'function', 'function' => 'wcVMCOff'],
-       ],
-       'wc/vmc/on' => [
-               ['type' => 'function', 'function' => 'wcVMCOn'],
-       ],
-       'wc/vmc/off' => [
-               ['type' => 'ha', 'device' => HA_WC_VMC, 'command' => 'turn_off', 'priority' => true],
-       ],
-       'sdb/ampli/on' => [
-               ['type' => 'ha', 'device' => HA_SDB_AMPLI,  'priority' => true],
-               //['type' => 'domoticz', 'device' => $amplisdb, 'command' => true, 'priority' => true],
-       ],
-       'sdb/ampli/off' => [
-               ['type' => 'ha', 'device' => HA_SDB_AMPLI, 'command' => 'turn_off', 'priority' => true],
-               //['type' => 'domoticz', 'device' => $amplisdb, 'command' => false, 'priority' => true],
-       ],
-       'sdb/hotwater/auto' => [
-               ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1']],
-       ],
-       'sdb/hotwater/auto/force' => [
-               ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1', true]],
-       ],
-       'sdb/hotwater/eco' => [
-               ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
-               ['type' => 'function', 'function' => 'hotwater', 'args' => ['1']],
-       ],
-       'sdb/hotwater/max' => [
-               ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
-               ['type' => 'function', 'function' => 'hotwater', 'args' => ['2']],
-       ],
-       'sdb/hotwater/off' => [
-               ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
-               ['type' => 'function', 'function' => 'hotwater', 'args' => ['0']],
-       ],
-       'sdb/off' => [
-               ['type' => 'state', 'key' => 'sdb', 'value' => 0],
-               ['type' => 'domoticz', 'scene' => 20, 'command' => false, 'priority' => true],
-               ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['Salle de bains'], false]],
-       ],
-       'sdb/on' => [
-               ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-               ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-               ['type' => 'domoticz', 'scene' => 20, 'command' => true, 'priority' => true],
-       ],
-       'sdb/morning' => [
-               ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-               ['type' => 'scene', 'scene' => 'sdb/on'],
-               ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['France Info', $squeezeboxPlayers['Salle de bains'], 30]],
-       ],
-       'sdb/nuit' => [
-               ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-               ['type' => 'domoticz', 'scene' => 21, 'command' => true, 'priority' => true],
-       ],
-       'sdb/spa' => [
-               ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-               ['type' => 'domoticz', 'scene' => 22, 'command' => true, 'priority' => true],
-               ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Nature sounds', $squeezeboxPlayers['Salle de bains'], 65]],
-       ],
-       'salon/freebox/on' => [
-               ['type' => 'domoticz', 'device' => '1439', 'command' => true, 'priority' => true],
-       ],
-       'salon/freebox/off' => [
-               ['type' => 'domoticz', 'device' => '1439', 'command' => false],
-       ],
-       'cuisine/hotte/on' => [
-               ['type' => 'ha', 'device' => HA_HOTTE],
-       ],
-       'cuisine/hotte/off' => [
-               ['type' => 'ha', 'device' => HA_HOTTE, 'command' => 'turn_off'],
-       ],
-       'cuisine/base/on' => [
-               ['type' => 'hue', 'group' => $cuisine, 'scene' => 'UDlNCnVQjTHZJFF'],
-       ],
-       'cuisine/on' => [
-               ['type' => 'scene', 'scene' => 'cuisine/hotte/on'],
-               ['type' => 'scene', 'scene' => 'cuisine/base/on'],
-       ],
-       'cuisine/tamise' => [
-               ['type' => 'scene', 'scene' => 'cuisine/hotte/on'],
-               ['type' => 'hue', 'group' => $cuisine, 'scene' => '44yXoQdJErFPksE']
-       ],
-       'cuisine/off' => [
-               ['type' => 'scene', 'scene' => 'cuisine/hotte/off'],
-               //['type' => 'hue', 'group' => $cuisine, 'scene' => array('on' => false)]
-       ],
-       'cuisine/toaster/toggle' => [
-               ['type' => 'domoticz', 'device' => '1453', 'command' => 'Toggle', 'priority' => true],
-       ],
-       'cuisine/toaster/on' => [
-               ['type' => 'domoticz', 'device' => '1453', 'command' => true, 'priority' => true],
-       ],
-       'cuisine/toaster/off' => [
-               ['type' => 'domoticz', 'device' => '1453', 'command' => false, 'priority' => true],
-       ],
-       'cuisine/coffee/on' => [
-               ['type' => 'function', 'function' => 'coffee_on'],
-       ],
-       'cuisine/coffee/off' => [
-               ['type' => 'function', 'function' => 'coffee_off'],
-       ],
-       'cour/auto' => [
-               ['type' => 'domoticz', 'device' => '6899', 'command' => true],
-               ['type' => 'function', 'function' => 'courAuto', 'args' => [true]],
-       ],
-       'cour/daylight' => [
-               ['type' => 'domoticz', 'device' => '6899', 'command' => true],
-               ['type' => 'hue', 'group' => $cour, 'scene' => '8RyJJ3Dn7ayPQ8t'],
-       ],
-       'cour/lumineux' => [
-               ['type' => 'domoticz', 'device' => '6899', 'command' => true],
-               ['type' => 'hue', 'group' => $cour, 'scene' => 'XzV1CuYIdHXPKoJ'],
-       ],
-       'cour/tropical' => [
-               ['type' => 'domoticz', 'device' => '6899', 'command' => true],
-               ['type' => 'hue', 'group' => $cour, 'scene' => 'wBdbymg1w5ZZvtS'],
-       ],
-       'cour/grow' => [
-               ['type' => 'domoticz', 'device' => '6899', 'command' => true],
-               ['type' => 'hue', 'group' => $cour, 'scene' => 'WVanIpWUWjkBjsS'],
-       ],
-       'cour/off' => [
-               ['type' => 'hue', 'group' => $cour, 'scene' => ['on' => false]],
-               ['type' => 'function', 'function' => 'courAuto', 'args' => [false]],
-               ['type' => 'domoticz', 'device' => '6899', 'command' => false],
-       ],
-       'cour/projecteurs/on' => [
-               ['type' => 'domoticz', 'device' => '6898', 'command' => true],
-       ],
-       'cour/projecteurs/off' => [
-               ['type' => 'domoticz', 'device' => '6898', 'command' => false],
-       ],
-       'ecomode/basic' => [
-               ['type' => 'ha', 'device' => HA_ECO_BASIC, 'command' => 'turn_off'],
-       ],
-       'ecomode/super' => [
-               ['type' => 'scene', 'scene' => 'ecomode/basic'],
-               ['type' => 'ha', 'device' => HA_ECO_SUPER, 'command' => 'turn_off'],
-       ],
-       'ecomode/notsuper' => [
-               ['type' => 'ha', 'device' => HA_ECO_SUPER],
-       ],
-       'ecomode/on' => [
-               ['type' => 'scene', 'scene' => 'ecomode/basic'],
-               ['type' => 'scene', 'scene' => 'ecomode/notsuper'],
-       ],
-       'ecomode/off' => [
-               ['type' => 'scene', 'scene' => 'ecomode/notsuper'],
-               ['type' => 'ha', 'device' => HA_ECO_BASIC],
-       ],
+    'chambre/matin' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'scene', 'scene' => 'chambre/nightlights'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'dawn', 'delay' => 1],
+        ['type' => 'scene', 'scene' => 'chambre/rideaux/open', 'delay' => 31],
+        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
+        ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
+        ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Matin'],
+        ['type' => 'scene', 'scene' => 'chambre/auto', 'delay' => 35],
+        ['type' => 'scene', 'scene' => 'cuisine/coffee/on'],
+    ],
+    'chambre/deshumidificateur/on' => [
+        //['type' => 'domoticz', 'device' => $chambrefan, 'command' => true],
+    ],
+    'chambre/deshumidificateur/off' => [
+        //['type' => 'domoticz', 'device' => $chambrefan, 'command' => false],
+    ],
+    'chambre/fan/on' => [
+        ['type' => 'domoticz', 'device' => $chambrefan, 'command' => true],
+    ],
+    'chambre/fan/off' => [
+        ['type' => 'domoticz', 'device' => $chambrefan, 'command' => false],
+    ],
+    'chambre/fan/toggle' => [
+        ['type' => 'domoticz', 'device' => $chambrefan, 'command' => 'Toggle'],
+    ],
+    'chambre/auto' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'function', 'function' => 'chambreAuto', 'args' => [true]],
+    ],
+    'chambre/bed/base' => [
+        ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
+        ['type' => 'nightmode', 'mode' => '1'],
+        ['type' => 'ecomode', 'mode' => '1'],
+        ['type' => 'state', 'key' => 'chambre', 'value' => 0],
+        ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
+        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
+        ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Va Au Lit'],
+    ],
+    'chambre/bed' => [
+        ['type' => 'scene', 'scene' => 'chambre/bed/base'],
+        ['type' => 'scene', 'scene' => 'chambre/nightlights'],
+        ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
+        ['type' => 'scene', 'scene' => 'sdb/nuit'],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'],
+    ],
+    'chambre/bed/off' => [
+        ['type' => 'scene', 'scene' => 'chambre/bed/base'],
+        ['type' => 'nightmode', 'mode' => '1'],
+        ['type' => 'ecomode', 'mode' => '1'],
+        ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'],
+        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee/off'],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee/off', 'delay' => 2],
+    ],
+    'chambre/sleep/off' => [
+        ['type' => 'scene', 'scene' => 'chambre/bed/base'],
+        ['type' => 'scene', 'scene' => 'sdb/off'],
+    ],
+    'chambre/sleep/base' => [
+        ['type' => 'nightmode', 'mode' => '1'],
+        ['type' => 'ecomode', 'mode' => '1'],
+        ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
+        ['type' => 'state', 'key' => 'chambre', 'value' => 0],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
+        ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
+        ['type' => 'scene', 'scene' => 'sdb/off'],
+        ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
+        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
+        ['type' => 'delay', 'scene' => 'chambre/planetarium/off', 'delay' => 3600], // Planétarium off dans une heure
+    ],
+    'chambre/sleep' => [
+        ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => '-P3feFyrTnFNfXi'], // Veilleuse +
+        ['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
+    ],
+
+    'chambre/boreal' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'mwAGvt2n70oXCqA'],
+        ['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' => 'ha', 'device' => 'scene.chambre_savane'],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee'],
+    ],
+    'chambre/focus' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'Ne6uJnnoPO9yRhl'],
+        ['type' => 'ha', 'device' => 'scene.chambre_focus'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee'],
+    ],
+    'chambre/chillout' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => '03gdSwPyZ9sbZVg'],
+        ['type' => 'ha', 'device' => 'scene.chambre_chillout'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee'],
+    ],
+    'chambre/reading/fireplace' => [
+        ['type' => 'scene', 'scene' => 'chambre/chillout'],
+        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Cheminée', $squeezeboxPlayers['Chambre']]],
+    ],
+    'chambre/reading' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'BNiNQjxiWNbKRaH'],
+        ['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' => 'ha', 'device' => 'scene.chambre_tonic'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee'],
+    ],
+
+    'chambre/moon' => [
+        ['type' => 'hue', 'group' => $chambre, 'scene' => '5PKfoOn8ss17o2l'], // Clair de lune
+        ['type' => 'ha', 'device' => 'scene.chambre_clairdelune'],
+        ['type' => 'scene', 'scene' => 'chambre/sleepbase'],
+    ],
+    'chambre/party' => [
+        ['type' => 'nightmode', 'mode' => '0'],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => 'qvQXHDodBPa0cZf'],
+        ['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' => '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' => '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' => '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' => 'ha', 'device' => 'scene.chambre_summernight'],
+    ],
+    'chambre/summernight' => [
+        ['type' => 'scene', 'scene' => 'chambre/nightlights'],
+        ['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' => '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' => 'ha', 'device' => 'scene.chambre_full'],
+        ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee'],
+    ],
+    'chambre/off' => [
+        ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee/off'],
+        ['type' => 'scene', 'scene' => 'chambre/fan/off'],
+    ],
+    'chambre/off/exceptcheminee' => [
+        ['type' => 'state', 'key' => 'chambre', 'value' => 0],
+        ['type' => 'state', 'key' => 'chambreOff', 'value' => 1],
+        ['type' => 'hue', 'group' => $chambre, 'scene' => array('on' => false)],
+        ['type' => 'ha', 'device' => 'scene.chambre_off'],
+        ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]],
+    ],
+    'chambre/cheminee' => [
+        ['type' => 'ha', 'device' => "scene.chambre_cheminee"],
+    ],
+    'chambre/cheminee/smallfire' => [
+        ['type' => 'ha', 'device' => "scene.chambre_cheminee_small"],
+    ],
+    'chambre/cheminee/off' => [
+        ['type' => 'ha', 'device' => 'light.chambre_cheminee', 'command' => 'turn_off'],
+    ],
+    'chambre/toggle' => [
+        ['type' => 'function', 'function' => 'chambreToggle'],
+    ],
+    'chambre/planetarium/off' => [
+        ['type' => 'function', 'function' => 'planetarium', 'args' => [false]],
+    ],
+    'chambre/planetarium/on' => [
+        ['type' => 'function', 'function' => 'planetarium', 'args' => [true]],
+    ],
+    'chambre/vincent/lecture' => [
+        ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 35, 'colorTemp' => 346, 'transitionTime' => 10)],
+    ],
+    'chambre/vincent/litdiscret' => [
+        ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 20, 'hue' => 0, 'saturation' => 255, 'transitionTime' => 1)],
+    ],
+    'chambre/vincent/crepuscule' => [
+        // ['type' => 'insteon', 'command' => '3?0262261ED00F1300=I=3'],
+        ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 60, 'hue' => '0', 'saturation' => 255, 'transitionTime' => 10)],
+        ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => false, 'brightness' => 0, 'transitionTime' => 10 * 60)],
+        //['type' => 'insteon', 'command' => '3?0262261ED00F11FF=I=3'],
+    ],
+    'chambre/vincent/aube' => [
+        ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 0, 'hue' => '46920', 'saturation' => 255, 'transitionTime' => 0)],
+        ['type' => 'hue', 'light' => $litvincent, 'scene' => array('brightness' => 128, 'colorTemp' => 156, 'transitionTime' => 60 * 60)],
+    ],
+
+    'chambre/rideaux/open' => [
+        ['type' => 'ha', 'device' => 'script.rideaux_chambre_ouvre'],
+    ],
+    'chambre/rideaux/close' => [
+        ['type' => 'ha', 'device' => 'script.rideaux_chambre_ferme'],
+    ],
+    'home/alert' => [
+        ['type' => 'function', 'function' => 'alert',],
+    ],
+    'home/doalert' => [
+        ['type' => 'domoticz', 'device' => '4207', 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $alert, 'scene' => ['alert' => 'lselect']],
+        ['type' => 'hue', 'group' => $alert, 'delay' => 3, 'scene' => ['alert' => 'none']],
+        ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'],
+        ['type' => 'phonetask', 'phone' => 'sdb', 'task' => 'Tortuga Alerte'],
+    ],
+    'home/aulit' => [
+        ['type' => 'scene', 'scene' => 'chambre/bed'],
+        ['type' => 'scene', 'scene' => 'home/aulitbase'],
+    ],
+    'home/aulitoff' => [
+        ['type' => 'scene', 'scene' => 'home/aulitbase'],
+        ['type' => 'scene', 'scene' => 'chambre/bed/off'],
+        ['type' => 'scene', 'scene' => 'sdb/off'],
+    ],
+    'home/aulitbase' => [
+        ['type' => 'scene', 'scene' => 'bureau/off'],
+        ['type' => 'scene', 'scene' => 'salon/off'],
+        ['type' => 'scene', 'scene' => 'cuisine/off'],
+        ['type' => 'scene', 'scene' => 'cour/off'],
+        ['type' => 'scene', 'scene' => 'salon/media/off'],
+        ['type' => 'function', 'function' => 'stopHarmony'],
+        ['type' => 'function', 'function' => 'stopAllSqueezebox'],
+        ['type' => 'nightmode', 'mode' => '1'],
+        ['type' => 'ecomode', 'mode' => '1'],
+        ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
+    ],
+    'home/music/synchro/soiree' => [
+        ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine', 'Bureau', 'WC']]],
+    ],
+    'home/music/synchro/salon-cuisine' => [
+        ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine']]],
+    ],
+    'home/music/synchro/all' => [
+        ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine', 'Bureau', 'WC', 'Chambre', 'SDB']]],
+    ],
+    'home/music/synchro/chambre-sdb' => [
+        ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Chambre', 'SDB']]],
+    ],
+    'home/music/synchro/bureau-wc' => [
+        ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Bureau', 'WC']]],
+    ],
+    'home/music/synchro/off' => [
+        ['type' => 'function', 'function' => 'stopAllSqueezebox'],
+    ],
+    'salon/projector/on' => [
+        ['type' => 'function', 'function' => 'epson', 'args' => [true, true]],
+    ],
+    'salon/projector/off' => [
+        ['type' => 'function', 'function' => 'epson', 'args' => [false, true]],
+    ],
+    'salon/auto' => [
+        ['type' => 'function', 'function' => 'salonAuto', 'args' => [true]],
+    ],
+    'salon/bar/on' => [
+        ['type' => 'ha', 'device' => HA_BAR, 'priority' => true],
+    ],
+    'salon/bar/off' => [
+        ['type' => 'ha', 'device' => HA_BAR, 'command' => 'turn_off', 'priority' => true],
+    ],
+    'salon/bar/toggle' => [
+        ['type' => 'ha', 'device' => HA_BAR, 'command' => 'toggle', 'priority' => true],
+    ],
+    'salon/day' => [
+        ['type' => 'ha', 'device' => 'scene.salon_on'],
+        ['type' => 'domoticz', 'scene' => 45, 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => '9ay5VtNcjvUZIFF', 'repeat' => 2],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'on'],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'delay' => 1],
+        ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1],
+        ['type' => 'scene', 'scene' => 'salon/bar/on'],
+    ],
+    'salon/lumineux' => [
+        ['type' => 'ha', 'device' => 'scene.salon_lumineux'],
+        ['type' => 'hue', 'group' => $salon, 'scene' => '9ay5VtNcjvUZIFF', 'repeat' => 2],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'on'],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'delay' => 1],
+        ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1],
+        ['type' => 'scene', 'scene' => 'salon/bar/on'],
+    ],
+    'salon/off' => [
+        ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
+        ['type' => 'ha', 'device' => 'scene.salon_off'],
+        ['type' => 'domoticz', 'scene' => 45, 'command' => false, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'off'],
+        //['type' => 'insteon', 'command' => '0?133=I=0=0'],
+        ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']],
+        ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
+        ['type' => 'scene', 'scene' => 'salon/fan/off'],
+        ['type' => 'scene', 'scene' => 'salon/bar/off'],
+    ],
+    'salon/cinemabase' => [
+
+        // ['type' => 'scene', 'scene' => 'cuisine/tamise'],
+        //        ['type' => 'ecomode', 'mode' => '0'],
+        // ['type' => 'insteon', 'command' => '0?1111=I=0=0'],
+    ],
+    'salon/cineclub' => [
+        ['type' => 'scene', 'scene' => 'salon/bar/off'],
+        ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
+        ['type' => 'ha', 'device' => 'scene.salon_cineclub'],
+        ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu', 'repeat' => 2],
+        ['type' => 'scene', 'scene' => 'salon/cinemabase'],
+        ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
+        ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
+    ],
+    'salon/cinema' => [
+        ['type' => 'scene', 'scene' => 'salon/bar/off'],
+        ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
+        ['type' => 'ha', 'device' => 'scene.salon_cinema'],
+        ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35', 'repeat' => 2],
+        ['type' => 'scene', 'scene' => 'salon/cinemabase'],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
+        ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
+        ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
+    ],
+    'salon/tamise' => [
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'ha', 'device' => 'scene.salon_tamise'],
+        ['type' => 'domoticz', 'scene' => 48, 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU', 'repeat' => 2],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
+        // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
+        ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
+        ['type' => 'scene', 'scene' => 'salon/bar/on'],
+    ],
+    'salon/theatre' => [
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'domoticz', 'scene' => 53, 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => 'xWNIeznSzek8dKS', 'repeat' => 2],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'theatre'],
+        // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
+        ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
+    ],
+    'salon/lecturenocture' => [
+        ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
+        ['type' => 'ha', 'device' => 'scene.salon_lecturenocturne'],
+        ['type' => 'domoticz', 'scene' => 49, 'command' => true, 'priority' => true],
+        ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'],
+        ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
+        // ['type' => 'insteon', 'command' => '0?1113=I=0=0'],
+        ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.25]],
+        ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
+        ['type' => 'scene', 'scene' => 'salon/bar/off'],
+    ],
+    'salon/cheminee' => [
+        ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 1]],
+    ],
+    'salon/cheminee/off' => [
+        ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']],
+    ],
+    'salon/media/off' => [
+        ['type' => 'function', 'function' => 'off', 'args' => ['salon']],
+    ],
+    'salon/media/play' => [
+
+    ],
+    'salon/fan/on' => [
+        ['type' => 'domoticz', 'device' => '478', 'command' => true],
+    ],
+    'salon/fan/off' => [
+        ['type' => 'domoticz', 'device' => '478', 'command' => false],
+    ],
+    'salon/fan/toggle' => [
+        ['type' => 'domoticz', 'device' => '478', 'command' => 'Toggle', 'priority' => true],
+    ],
+    'bureau/pc/wakeup' => [
+        ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']],
+    ],
+    'bureau/pc/sleep' => [
+        ['type' => 'function', 'function' => 'sleepPC', 'args' => ['avion']],
+    ],
+    'bureau/pc/shutdown' => [
+        ['type' => 'function', 'function' => 'shutdownPC', 'args' => ['avion']],
+    ],
+    'bureau/screens/off' => [
+        ['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Games', 'avion']]
+    ],
+    'bureau/screens/on' => [
+        ['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Tortuga', 'avion']]
+    ],
+    'bureau/fan/on' => [
+        ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
+    ],
+    'bureau/fan/off' => [
+        ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
+    ],
+    'bureau/fan/toggle' => [
+        ['type' => 'ha', 'device' => 'script.klarstein_fan_toggle'],
+    ],
+    'bureau/auto' => [
+        ['type' => 'function', 'function' => 'bureauAuto', 'args' => [true]],
+    ],
+    'bureau/base/on' => [
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'scene', 'scene' => 'bureau/pc/wakeup'],
+    ],
+    'bureau/cinema' => [
+        ['type' => 'scene', 'scene' => 'bureau/base/off'],
+        ['type' => 'hue', 'group' => $bureau, 'scene' => '7mofVclWdtvpVyt'],
+        ['type' => 'ha', 'device' => 'scene.bureau_cinema'],
+    ],
+    'bureau/lumineux' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'SdXwtZu5PCDjK2h'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'lumineux'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_lumineux'],
+    ],
+    'bureau/veilleuse' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'ooQq4Jfbf1CleDy'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'veilleuse'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_veilleuse'],
+    ],
+    'bureau/flowers' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'mJ-AVlYFyL5x1cN'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'flowers'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_flowers'],
+    ],
+    'bureau/videogames' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'ooQq4Jfbf1CleDy'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'veilleuse'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/off'],
+        ['type' => 'ha', 'device' => 'scene.bureau_videogames'],
+    ],
+    'bureau/tchernobyl' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'KoByn2ehWHDdchu'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tchernobyl'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_tchernobyl'],
+    ],
+    'bureau/outrun' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => '9TzWQt6f7-EgVtm'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'outrun'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_outrun'],
+    ],
+    'bureau/boreal' => [
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'boreal'],
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'dJaWFQBb0APEgtL'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_boreal'],
+    ],
+    'bureau/tropical' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'biXLpKpIZYDlxen'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tropical'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_tropical'],
+
+    ],
+    'bureau/lounge' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'vvE8WAMdNpgswrw'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'lounge'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_lounge'],
+
+    ],
+    'bureau/focus' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'yPYgG-zQWuAA13d'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'space'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_focus'],
+
+    ],
+    'bureau/tonic' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'S-YiVWKsEKipL0G'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tonic'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_tonic'],
+
+    ],
+    'bureau/lecture' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'Hjr7rfz4LC9xVoB'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'lecture'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_lecture'],
+
+    ],
+    'bureau/chillout' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => '-UOMTUG6z-hMbRA'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'chillout'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_chillout'],
+
+    ],
+    'bureau/tamise' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => '8fgGg2ylE4aO3t3'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tamise'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_tamise'],
+    ],
+    'bureau/beach' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => '0mPAKOl-Kw8Fwb1'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'beach'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_beach'],
+
+    ],
+    'bureau/jellyfish' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'VhHVIcN-nKLwP9E'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'jellyfish'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_jellyfish'],
+
+    ],
+    'bureau/sharks' => [
+        ['type' => 'hue', 'group' => $bureau, 'scene' => 'VhHVIcN-nKLwP9E'],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'sharks'],
+        ['type' => 'scene', 'scene' => 'bureau/base/on'],
+        ['type' => 'scene', 'scene' => 'bureau/screens/on'],
+        ['type' => 'ha', 'device' => 'scene.bureau_jellyfish'],
+
+    ],
+    'bureau/base/off' => [
+        ['type' => 'ha', 'device' => 'scene.bureau_off'],
+        ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]],
+        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'off'],
+        ['type' => 'hue', 'group' => $bureau, 'scene' => array('on' => false)],
+        ['type' => 'hue', 'light' => 23, 'scene' => array('on' => false)],
+    ],
+    'bureau/off' => [
+        ['type' => 'scene', 'scene' => 'bureau/base/off'],
+        ['type' => 'scene', 'scene' => 'bureau/pc/sleep'],
+    ],
+    'bureau/media/play' => [
+        ['type' => 'state', 'key' => 'bureauPlaying', 'value' => '1'],
+        ['type' => 'scene', 'scene' => 'bureau/screen/down'],
+        ['type' => 'scene', 'scene' => 'bureau/rideaux/close'],
+        ['type' => 'scene', 'scene' => 'bureau/cinema'],
+        ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]],
+        ['type' => 'function', 'function' => 'harmonyActivity', 'args' => [HARMONY_TV]],
+    ],
+    'bureau/media/stop' => [
+        ['type' => 'state', 'key' => 'bureauPlaying', 'value' => '0'],
+        ['type' => 'scene', 'scene' => 'bureau/screen/up'],
+        ['type' => 'scene', 'scene' => 'bureau/rideaux/open'],
+        ['type' => 'scene', 'scene' => 'bureau/auto'],
+    ],
+    'bureau/screen/down' => [
+        ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'close_cover'],
+    ],
+    'bureau/screen/up' => [
+        ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'open_cover'],
+    ],
+    'bureau/rideaux/close' => [
+        ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'close_cover'],
+    ],
+    'bureau/rideaux/open' => [
+        ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'open_cover'],
+    ],
+    'bureau/rideaux/toggle' => [
+        ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'toggle'],
+    ],
+    'insteon/off' => [
+        // ['type' => 'insteon', 'command' => '0?135=I=0=0'],
+    ],
+    'home/off' => [
+        ['type' => 'scene', 'scene' => 'home/hueoff'],
+        ['type' => 'ecomode', 'mode' => '2'],
+        ['type' => 'scene', 'scene' => 'cuisine/off'],
+        ['type' => 'scene', 'scene' => 'salon/off'],
+        ['type' => 'scene', 'scene' => 'cour/off'],
+        ['type' => 'scene', 'scene' => 'bureau/base/off'],
+        ['type' => 'scene', 'scene' => 'chambre/off'],
+        ['type' => 'scene', 'scene' => 'sdb/off'],
+        ['type' => 'scene', 'scene' => 'wc/off'],
+        ['type' => 'function', 'function' => 'stopHarmony'],
+        ['type' => 'function', 'function' => 'stopAllSqueezebox'],
+        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
+        ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
+        ['type' => 'scene', 'scene' => 'cuisine/coffee/off'],
+        ['type' => 'scene', 'scene' => 'bureau/pc/shutdown'],
+        ['type' => 'scene', 'scene' => 'home/hueoff'],
+        ['type' => 'scene', 'scene' => 'salon/media/off'],
+        ['type' => 'scene', 'scene' => 'salon/off', 'delay' => 2],
+        ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
+    ],
+
+    'home/welcome/eco' => [
+        ['type' => 'function', 'function' => 'welcomeEco'],
+    ],
+
+    'home/welcome/eco/salon' => [
+        ['type' => 'scene', 'scene' => 'salon/auto'],
+        ['type' => 'scene', 'scene' => 'cuisine/on'],
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
+        ['type' => 'scene', 'scene' => 'bureau/off'],
+        ['type' => 'scene', 'scene' => 'chambre/off'],
+    ],
+
+    'home/welcome/eco/homeoffice' => [
+        ['type' => 'scene', 'scene' => 'bureau/auto'],
+        ['type' => 'scene', 'scene' => 'cuisine/on'],
+        ['type' => 'ecomode', 'mode' => '0'],
+        ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'],
+        ['type' => 'scene', 'scene' => 'salon/off'],
+        ['type' => 'scene', 'scene' => 'chambre/off'],
+        ['type' => 'ha', 'device' => HA_OFFICE_PLANE_SCREENS, 'action' => 'turn_off'],
+    ],
+
+    'home/welcome' => [
+        ['type' => 'scene', 'scene' => 'cuisine/on'],
+        ['type' => 'scene', 'scene' => 'salon/auto'],
+        ['type' => 'scene', 'scene' => 'bureau/auto'],
+        ['type' => 'ha', 'device' => HA_OFFICE_PLANE_SCREENS],
+        ['type' => 'scene', 'scene' => 'chambre/auto'],
+        ['type' => 'scene', 'scene' => 'sdb/on'],
+        ['type' => 'scene', 'scene' => 'cour/auto'],
+        ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
+        ['type' => 'ecomode', 'mode' => '0'],
+    ],
+    'home/hueoff' => [
+        ['type' => 'hue', 'group' => 17, 'scene' => ['on' => false, 'effect' => 'none']],
+    ],
+    'wc/on' => [
+        ['type' => 'function', 'function' => 'wcOn'],
+    ],
+    'wc/morning' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'NC5ejamHGUNURj8'],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [70]],
+    ],
+    'wc/day' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'qfuu8z5QaJ6J26W'],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [80]],
+    ],
+    'wc/evening' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'h82j28eNu6ZHVhM'],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [80]],
+    ],
+    'wc/late' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'IGo4F5jRQXc1H95'],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [70]],
+    ],
+    'wc/night' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'eJy09JTEzCiIL1P'],
+    ],
+    'wc/nightambiance' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => ['effect' => 'none']],
+        ['type' => 'scene', 'scene' => 'wc/night'],
+        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Nuit d\'été', $squeezeboxPlayers['WC'], 100, false]],
+    ],
+    'wc/off' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => ['on' => false, 'effect' => 'none']],
+        ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['WC'], false]],
+        ['type' => 'state', 'key' => 'wc', 'value' => 0],
+        ['type' => 'function', 'function' => 'wcVMCOff'],
+    ],
+    'wc/spa' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => ['effect' => 'colorloop', 'on' => true, 'brightness' => 128]],
+        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Rivière', $squeezeboxPlayers['WC'], 100]],
+        ['type' => 'function', 'function' => 'wcVMCOff'],
+    ],
+    'wc/silentmorning' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'NC5ejamHGUNURj8'],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [50]],
+    ],
+    'wc/vmc/on' => [
+        ['type' => 'function', 'function' => 'wcVMCOn'],
+    ],
+    'wc/vmc/off' => [
+        ['type' => 'ha', 'device' => HA_WC_VMC, 'command' => 'turn_off', 'priority' => true],
+    ],
+    'sdb/ampli/on' => [
+        ['type' => 'ha', 'device' => HA_SDB_AMPLI, 'priority' => true],
+        //['type' => 'domoticz', 'device' => $amplisdb, 'command' => true, 'priority' => true],
+    ],
+    'sdb/ampli/off' => [
+        ['type' => 'ha', 'device' => HA_SDB_AMPLI, 'command' => 'turn_off', 'priority' => true],
+        //['type' => 'domoticz', 'device' => $amplisdb, 'command' => false, 'priority' => true],
+    ],
+    'sdb/hotwater/auto' => [
+        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1']],
+    ],
+    'sdb/hotwater/auto/force' => [
+        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1', true]],
+    ],
+    'sdb/hotwater/eco' => [
+        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
+        ['type' => 'function', 'function' => 'hotwater', 'args' => ['1']],
+    ],
+    'sdb/hotwater/max' => [
+        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
+        ['type' => 'function', 'function' => 'hotwater', 'args' => ['2']],
+    ],
+    'sdb/hotwater/off' => [
+        ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
+        ['type' => 'function', 'function' => 'hotwater', 'args' => ['0']],
+    ],
+    'sdb/off' => [
+        ['type' => 'state', 'key' => 'sdb', 'value' => 0],
+        ['type' => 'domoticz', 'scene' => 20, 'command' => false, 'priority' => true],
+        ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['Salle de bains'], false]],
+    ],
+    'sdb/on' => [
+        ['type' => 'state', 'key' => 'sdb', 'value' => 1],
+        ['type' => 'state', 'key' => 'sdb', 'value' => 1],
+        ['type' => 'domoticz', 'scene' => 20, 'command' => true, 'priority' => true],
+    ],
+    'sdb/morning' => [
+        ['type' => 'state', 'key' => 'sdb', 'value' => 1],
+        ['type' => 'scene', 'scene' => 'sdb/on'],
+        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['France Info', $squeezeboxPlayers['Salle de bains'], 30]],
+    ],
+    'sdb/nuit' => [
+        ['type' => 'state', 'key' => 'sdb', 'value' => 1],
+        ['type' => 'domoticz', 'scene' => 21, 'command' => true, 'priority' => true],
+    ],
+    'sdb/spa' => [
+        ['type' => 'state', 'key' => 'sdb', 'value' => 1],
+        ['type' => 'domoticz', 'scene' => 22, 'command' => true, 'priority' => true],
+        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Nature sounds', $squeezeboxPlayers['Salle de bains'], 65]],
+    ],
+    'salon/freebox/on' => [
+        ['type' => 'domoticz', 'device' => '1439', 'command' => true, 'priority' => true],
+    ],
+    'salon/freebox/off' => [
+        ['type' => 'domoticz', 'device' => '1439', 'command' => false],
+    ],
+    'cuisine/hotte/on' => [
+        ['type' => 'ha', 'device' => HA_HOTTE],
+    ],
+    'cuisine/hotte/off' => [
+        ['type' => 'ha', 'device' => HA_HOTTE, 'command' => 'turn_off'],
+    ],
+    'cuisine/base/on' => [
+        ['type' => 'hue', 'group' => $cuisine, 'scene' => 'UDlNCnVQjTHZJFF'],
+    ],
+    'cuisine/on' => [
+        ['type' => 'scene', 'scene' => 'cuisine/hotte/on'],
+        ['type' => 'scene', 'scene' => 'cuisine/base/on'],
+    ],
+    'cuisine/tamise' => [
+        ['type' => 'scene', 'scene' => 'cuisine/hotte/on'],
+        ['type' => 'hue', 'group' => $cuisine, 'scene' => '44yXoQdJErFPksE']
+    ],
+    'cuisine/off' => [
+        ['type' => 'scene', 'scene' => 'cuisine/hotte/off'],
+        //['type' => 'hue', 'group' => $cuisine, 'scene' => array('on' => false)]
+    ],
+    'cuisine/toaster/toggle' => [
+        ['type' => 'domoticz', 'device' => '1453', 'command' => 'Toggle', 'priority' => true],
+    ],
+    'cuisine/toaster/on' => [
+        ['type' => 'domoticz', 'device' => '1453', 'command' => true, 'priority' => true],
+    ],
+    'cuisine/toaster/off' => [
+        ['type' => 'domoticz', 'device' => '1453', 'command' => false, 'priority' => true],
+    ],
+    'cuisine/coffee/on' => [
+        ['type' => 'function', 'function' => 'coffee_on'],
+    ],
+    'cuisine/coffee/off' => [
+        ['type' => 'function', 'function' => 'coffee_off'],
+    ],
+    'cour/auto' => [
+        ['type' => 'domoticz', 'device' => '6899', 'command' => true],
+        ['type' => 'function', 'function' => 'courAuto', 'args' => [true]],
+    ],
+    'cour/daylight' => [
+        ['type' => 'domoticz', 'device' => '6899', 'command' => true],
+        ['type' => 'hue', 'group' => $cour, 'scene' => '8RyJJ3Dn7ayPQ8t'],
+    ],
+    'cour/lumineux' => [
+        ['type' => 'domoticz', 'device' => '6899', 'command' => true],
+        ['type' => 'hue', 'group' => $cour, 'scene' => 'XzV1CuYIdHXPKoJ'],
+    ],
+    'cour/tropical' => [
+        ['type' => 'domoticz', 'device' => '6899', 'command' => true],
+        ['type' => 'hue', 'group' => $cour, 'scene' => 'wBdbymg1w5ZZvtS'],
+    ],
+    'cour/grow' => [
+        ['type' => 'domoticz', 'device' => '6899', 'command' => true],
+        ['type' => 'hue', 'group' => $cour, 'scene' => 'WVanIpWUWjkBjsS'],
+    ],
+    'cour/off' => [
+        ['type' => 'hue', 'group' => $cour, 'scene' => ['on' => false]],
+        ['type' => 'function', 'function' => 'courAuto', 'args' => [false]],
+        ['type' => 'domoticz', 'device' => '6899', 'command' => false],
+    ],
+    'cour/projecteurs/on' => [
+        ['type' => 'domoticz', 'device' => '6898', 'command' => true],
+    ],
+    'cour/projecteurs/off' => [
+        ['type' => 'domoticz', 'device' => '6898', 'command' => false],
+    ],
+    'ecomode/basic' => [
+        ['type' => 'ha', 'device' => HA_ECO_BASIC, 'command' => 'turn_off'],
+    ],
+    'ecomode/super' => [
+        ['type' => 'scene', 'scene' => 'ecomode/basic'],
+        ['type' => 'ha', 'device' => HA_ECO_SUPER, 'command' => 'turn_off'],
+    ],
+    'ecomode/notsuper' => [
+        ['type' => 'ha', 'device' => HA_ECO_SUPER],
+    ],
+    'ecomode/on' => [
+        ['type' => 'scene', 'scene' => 'ecomode/basic'],
+        ['type' => 'scene', 'scene' => 'ecomode/notsuper'],
+    ],
+    'ecomode/off' => [
+        ['type' => 'scene', 'scene' => 'ecomode/notsuper'],
+        ['type' => 'ha', 'device' => HA_ECO_BASIC],
+    ],
 ];
 
 
-function welcomeEco() {
-       $businessHour = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];
-       if (isWeekEnd() || !in_array(date('G'), $businessHour)) {
-               execScene('home/welcome/eco/salon');
-       } else {
-               execScene('home/welcome/eco/homeoffice');
-       }
+function welcomeEco()
+{
+    $businessHour = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];
+    if (isWeekEnd() || !in_array(date('G'), $businessHour)) {
+        execScene('home/welcome/eco/salon');
+    } else {
+        execScene('home/welcome/eco/homeoffice');
+    }
 }
 
-function execScene($name, $fromUserAction = false, $transitionTime = null) {
-       global $scenes;
-
-       $scene = $scenes[$name];
-
-       profile('Exec scene ' . $name . '/' . $fromUserAction, __FILE__, __LINE__);
-
-       $e = explode('/', $name);
-
-       $autoRooms = ['bureau', 'chambre', 'salon', 'cour'];
-
-       if (in_array($e[0], $autoRooms) && count($e) == 2) {
-               setState($e[0] . 'Off', $e[1] === 'off' ? '1' : '0');
-               if ($fromUserAction && $e[1] !== 'auto') {
-                       call_user_func($e[0] . 'Auto', false);
-               }
-       }
-
-       //    $killurl = WEB_ROOT . 'scripts/light.php?r=2';
-       //    $kill = "/usr/bin/pkill -f $killurl";
-       //    $res = `$kill`;
-
-       foreach ($scene as $action) {
-               if (isset($action['when'])) {
-                       $ok = true;
-                       foreach ($action['when'] as $k => $v) {
-                               if (getState('k') != $v) {
-                                       $ok = false;
-                                       break;
-                               }
-                       }
-                       if (!$ok) {
-                               continue;
-                       }
-               }
-
-               if (isset($action['wait']) && $action['wait'] > 0) {
-                       usleep($action['wait'] * 10000000);
-               }
-
-               if ($action['type'] == 'hue') {
-                       hueCommand($action, $transitionTime);
-               } else if ($action['type'] == 'delay' || $action['type'] == 'scene') {
-                       if (!isset($action['delay'])) {
-                               $action['delay'] = 0;
-                       }
-                       if ($action['delay'] > 1) {
-                               delayScene($action['scene'], $action['delay']);
-                       } else {
-                               if ($action['delay'] > 0) {
-                                       usleep(round($action['delay'] * 1000000));
-                               }
-                               execScene($action['scene'], $fromUserAction, $transitionTime);
-                       }
-               } else if ($action['type'] == 'function') {
-                       if (!isset($action['args'])) {
-                               $action['args'] = array();
-                       }
-                       call_user_func_array($action['function'], $action['args']);
-               } else if ($action['type'] == 'state') {
-                       setState($action['key'], $action['value']);
-               } else if ($action['type'] == 'phonetask') {
-                       phoneTask($action['task'], $action['phone'], true);
-               } else if ($action['type'] == 'ecomode') {
-                       ecoMode($action['mode'], $fromUserAction);
-               } else if ($action['type'] == 'domoticz') {
-                       if (isset($action['scene'])) {
-                               $action['device'] = $action['scene'];
-                               $action['switchtype'] = 'scene';
-                       }
-                       domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', $action['priority'] ?? false);
-               } else if ($action['type'] === 'ha') {
-                       if(isset($action['action']) && !isset($action['command'])){
-                               $action['command']=$action['action'];
-                               unset($action['action']);
-                       }
-                       haAction($action['device'], $action['command'] ?? null);
-               } else if ($action['type'] == 'ir') {
-                       irsend($action['room'], $action['device'], $action['command']);
-               } else if ($action['type'] == 'ifttt') {
-                       ifttt($action['event']);
-               } else if ($action['type'] == 'nightmode') {
-                       nightmode($action['mode']);
-               }
-       }
+function execScene($name, $fromUserAction = false, $transitionTime = null)
+{
+    global $scenes;
+
+    $scene = $scenes[$name];
+
+    profile('Exec scene ' . $name . '/' . $fromUserAction, __FILE__, __LINE__);
+
+    $e = explode('/', $name);
+
+    $autoRooms = ['bureau', 'chambre', 'salon', 'cour'];
+
+    if (in_array($e[0], $autoRooms) && count($e) == 2) {
+        setState($e[0] . 'Off', $e[1] === 'off' ? '1' : '0');
+        if ($fromUserAction && $e[1] !== 'auto') {
+            call_user_func($e[0] . 'Auto', false);
+        }
+    }
+
+    //    $killurl = WEB_ROOT . 'scripts/light.php?r=2';
+    //    $kill = "/usr/bin/pkill -f $killurl";
+    //    $res = `$kill`;
+
+    foreach ($scene as $action) {
+        if (isset($action['when'])) {
+            $ok = true;
+            foreach ($action['when'] as $k => $v) {
+                if (getState('k') != $v) {
+                    $ok = false;
+                    break;
+                }
+            }
+            if (!$ok) {
+                continue;
+            }
+        }
+
+        if (isset($action['wait']) && $action['wait'] > 0) {
+            usleep($action['wait'] * 10000000);
+        }
+
+        if ($action['type'] == 'hue') {
+            hueCommand($action, $transitionTime);
+        } else if ($action['type'] == 'delay' || $action['type'] == 'scene') {
+            if (!isset($action['delay'])) {
+                $action['delay'] = 0;
+            }
+            if ($action['delay'] > 1) {
+                delayScene($action['scene'], $action['delay']);
+            } else {
+                if ($action['delay'] > 0) {
+                    usleep(round($action['delay'] * 1000000));
+                }
+                execScene($action['scene'], $fromUserAction, $transitionTime);
+            }
+        } else if ($action['type'] == 'function') {
+            if (!isset($action['args'])) {
+                $action['args'] = array();
+            }
+            call_user_func_array($action['function'], $action['args']);
+        } else if ($action['type'] == 'state') {
+            setState($action['key'], $action['value']);
+        } else if ($action['type'] == 'phonetask') {
+            phoneTask($action['task'], $action['phone'], true);
+        } else if ($action['type'] == 'ecomode') {
+            ecoMode($action['mode'], $fromUserAction);
+        } else if ($action['type'] == 'domoticz') {
+            if (isset($action['scene'])) {
+                $action['device'] = $action['scene'];
+                $action['switchtype'] = 'scene';
+            }
+            domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', $action['priority'] ?? false);
+        } else if ($action['type'] === 'ha') {
+            if (isset($action['action']) && !isset($action['command'])) {
+                $action['command'] = $action['action'];
+                unset($action['action']);
+            }
+            haAction($action['device'], $action['command'] ?? null);
+        } else if ($action['type'] == 'ir') {
+            irsend($action['room'], $action['device'], $action['command']);
+        } else if ($action['type'] == 'ifttt') {
+            ifttt($action['event']);
+        } else if ($action['type'] == 'nightmode') {
+            nightmode($action['mode']);
+        }
+    }
 }
 
-function chambreToggle($fromUserAction = false) {
-       if (getState('chambreOff') == 0) {
-               execScene('chambre/off', $fromUserAction);
-       } else {
-               execScene('chambre/full', $fromUserAction);
-       }
+function chambreToggle($fromUserAction = false)
+{
+    if (getState('chambreOff') == 0) {
+        execScene('chambre/off', $fromUserAction);
+    } else {
+        execScene('chambre/full', $fromUserAction);
+    }
 }
 
-function wcMusic($volume) {
-       $d = date('w');
-       if ($d == 4) {
-               $music = 'New Morning';
-       } else if ($d == 3) {
-               $music = 'Radio Michel';
-       } else if ($d == 5) {
-               $music = 'Samba';
-               //$volume += 10;
-       } else {
-               $music = 'FIP';
-       }
-       squeezePlayByName($music, 'WC', $volume, false);
+function wcMusic($volume)
+{
+    $d = date('w');
+    if ($d == 4) {
+        $music = 'New Morning';
+    } else if ($d == 3) {
+        $music = 'Radio Michel';
+    } else if ($d == 5) {
+        $music = 'Samba';
+        //$volume += 10;
+    } else {
+        $music = 'FIP';
+    }
+    squeezePlayByName($music, 'WC', $volume, false);
 }
 
-function wcToggle() {
-       if (getState('wc') == 1) {
-               execScene('wc/off', true);
-       } else {
-               wcOn();
-       }
+function wcToggle()
+{
+    if (getState('wc') == 1) {
+        execScene('wc/off', true);
+    } else {
+        wcOn();
+    }
 }
 
-function sdbToggle() {
-       if (getState('sdb') == 1) {
-               execScene('sdb/off');
-               stopSqueezebox('Salle de bains');
-       } else {
-               execScene('sdb/on');
-       }
+function sdbToggle()
+{
+    if (getState('sdb') == 1) {
+        execScene('sdb/off');
+        stopSqueezebox('Salle de bains');
+    } else {
+        execScene('sdb/on');
+    }
 }
 
-function wcOn($vmc = true) {
-       $hour = getHour();
-       if (getNightMode()) {
-               $period = 'night';
-       } else if ($hour > 0 && $hour < 6.75) {
-               $period = 'late';
-       } else if ($hour >= 6.75 && $hour < 10) {
-               $period = 'morning';
-       } else if ($hour >= 10 && $hour < 20) {
-               $period = 'day';
-       } else {
-               $period = 'evening';
-       }
-       execScene('wc/' . $period, true);
-       setState('wc', 1);
-       if ($vmc && $period != 'night') {
-               wcVMCOn();
-       } else {
-               wcVMCOff(0);
-       }
+function wcOn($vmc = true)
+{
+    $hour = getHour();
+    if (getNightMode('chambre') && getNightMode('bureau')) {
+        $period = 'night';
+    } else if (getNightMode('chambre') && !getNightMode('bureau')) {
+        $period = 'silentmorning';
+    } else if ($hour > 0 && $hour < 6.75) {
+        $period = 'late';
+    } else if ($hour >= 6.75 && $hour < 10) {
+        $period = 'morning';
+    } else if ($hour >= 10 && $hour < 20) {
+        $period = 'day';
+    } else {
+        $period = 'evening';
+    }
+    execScene('wc/' . $period, true);
+    setState('wc', 1);
+    if ($vmc && $period != 'night' && $period !== 'silentmorning') {
+        wcVMCOn();
+    } else {
+        wcVMCOff(0);
+    }
 }
 
-function planetarium($on) {
-       setState('planetarium', $on ? '1' : '0');
-       checkPlanetarium(false);
+function planetarium($on)
+{
+    setState('planetarium', $on ? '1' : '0');
+    checkPlanetarium(false);
 }
 
-function checkPlanetarium($periodicOffCheck = true) {
-       $device = 6989;
-
-       $on = getState('planetarium') == '1';
-       $h = date('G');
-       if ($h >= 2 && $h <= 20) {
-               $on = false;
-       }
-       if ($on) {
-               if ($periodicOffCheck) {
-                       $min = intval(date('i'));
-                       if ($min % 30 == 0) {
-                               haAction(HA_PLANETARIUM, 'turn_off');
-                               sleep(5);
-                       }
-               }
-               haAction(HA_PLANETARIUM);
-       } else {
-               haAction(HA_PLANETARIUM, 'turn_off');
-       }
+function checkPlanetarium($periodicOffCheck = true)
+{
+    $device = 6989;
+
+    $on = getState('planetarium') == '1';
+    $h = date('G');
+    if ($h >= 2 && $h <= 20) {
+        $on = false;
+    }
+    if ($on) {
+        if ($periodicOffCheck) {
+            $min = intval(date('i'));
+            if ($min % 30 == 0) {
+                haAction(HA_PLANETARIUM, 'turn_off');
+                sleep(5);
+            }
+        }
+        haAction(HA_PLANETARIUM);
+    } else {
+        haAction(HA_PLANETARIUM, 'turn_off');
+    }
 }
 
-function cheminee($lightId, $room = 'salon', $program = 'fire', $brightness = 1) {
-       $start = time();
-       $hue = getHueInstance();
-       $speed = 2;
-       $brightness *= 100;
-       $brightnessAmplitude = $brightness * 0.75;
-
-       set_time_limit(0);
-
-       while (true) {
-               if ($program == 'fire') {
-                       $time = rand(1 / $speed, 40 / $speed) / 10;
-                       $color = rand(0, 10000);
-               } else if ($program == 'cold') {
-                       $time = rand(20 / $speed, 40 / $speed) / 2;
-                       $color = rand(25500, 46920);
-               }
-               if ($color < 0) {
-                       $color += 65280;
-               }
-
-               $command = new \Phue\Command\SetLightState($lightId);
-               $command->on(true);
-               $command->hue($color);
-               $command->brightness(max(0, min(255, rand(0, $brightnessAmplitude) + $brightness - $brightnessAmplitude / 2)));
-               $command->saturation(max(0, min(255, 220 + rand(0, 36))));
-               $command->transitionTime($time);
-               $command->send($hue);
-               usleep($time * 1000000);
-       }
+function cheminee($lightId, $room = 'salon', $program = 'fire', $brightness = 1)
+{
+    $start = time();
+    $hue = getHueInstance();
+    $speed = 2;
+    $brightness *= 100;
+    $brightnessAmplitude = $brightness * 0.75;
+
+    set_time_limit(0);
+
+    while (true) {
+        if ($program == 'fire') {
+            $time = rand(1 / $speed, 40 / $speed) / 10;
+            $color = rand(0, 10000);
+        } else if ($program == 'cold') {
+            $time = rand(20 / $speed, 40 / $speed) / 2;
+            $color = rand(25500, 46920);
+        }
+        if ($color < 0) {
+            $color += 65280;
+        }
+
+        $command = new \Phue\Command\SetLightState($lightId);
+        $command->on(true);
+        $command->hue($color);
+        $command->brightness(max(0, min(255, rand(0, $brightnessAmplitude) + $brightness - $brightnessAmplitude / 2)));
+        $command->saturation(max(0, min(255, 220 + rand(0, 36))));
+        $command->transitionTime($time);
+        $command->send($hue);
+        usleep($time * 1000000);
+    }
 }
 
-function killCheminee($room) {
-       // Kill current animation
-       $kill = '/usr/bin/pkill -f cheminee_running/' . $room;
-       $res = `$kill`;
-       echo 'Kill cheminée ' . $room . ' :: ' . $res;
-       return $res;
+function killCheminee($room)
+{
+    // Kill current animation
+    $kill = '/usr/bin/pkill -f cheminee_running/' . $room;
+    $res = `$kill`;
+    echo 'Kill cheminée ' . $room . ' :: ' . $res;
+    return $res;
 }
 
-function chemineeLight($lightId, $room, $program = 'fire', $brightness = 1) {
-       $run = "export QUERY_STRING=\"cheminee=running&light=" . $lightId . "&room=" . $room . "&program=" . $program . "&brightness=" . $brightness . "&sid=" . session_id() . "\";php -e " . __DIR__ . '/../light.php -- cheminee_running/' . $room;
-       $cmd = "echo '$run' | at now 2>&1";
-       return $cmd . ' : ' . `$cmd`;
+function chemineeLight($lightId, $room, $program = 'fire', $brightness = 1)
+{
+    $run = "export QUERY_STRING=\"cheminee=running&light=" . $lightId . "&room=" . $room . "&program=" . $program . "&brightness=" . $brightness . "&sid=" . session_id() . "\";php -e " . __DIR__ . '/../light.php -- cheminee_running/' . $room;
+    $cmd = "echo '$run' | at now 2>&1";
+    return $cmd . ' : ' . `$cmd`;
 }
 
-function chemineeOff($room) {
-       global $cheminee;
-       killCheminee($room);
-       $hue = getHueInstance();
-       // Turn off lights
-       $command = new \Phue\Command\SetGroupState($cheminee[$room]);
-       $command->transitionTime(5);
-       $command->saturation(255);
-       $command->hue(0);
-       $command->brightness(0);
-       $command->on(false);
-       $command->send($hue);
+function chemineeOff($room)
+{
+    global $cheminee;
+    killCheminee($room);
+    $hue = getHueInstance();
+    // Turn off lights
+    $command = new \Phue\Command\SetGroupState($cheminee[$room]);
+    $command->transitionTime(5);
+    $command->saturation(255);
+    $command->hue(0);
+    $command->brightness(0);
+    $command->on(false);
+    $command->send($hue);
 }
 
-function chemineeOn($room, $program = 'fire', $brightness = 1) {
-       global $chemineeLights;
-       killCheminee($room);
-       $res = '';
-       foreach ($chemineeLights[$room] as $lightId) {
-               $res .= chemineeLight($lightId, $room, $program, $brightness);
-       }
-       echo $res;
+function chemineeOn($room, $program = 'fire', $brightness = 1)
+{
+    global $chemineeLights;
+    killCheminee($room);
+    $res = '';
+    foreach ($chemineeLights[$room] as $lightId) {
+        $res .= chemineeLight($lightId, $room, $program, $brightness);
+    }
+    echo $res;
 }
 
-function bedbrightness($brightness) {
-       $cmd = 'sudo /usr/local/bin/screenbrightness ' . $brightness;
+function bedbrightness($brightness)
+{
+    $cmd = 'sudo /usr/local/bin/screenbrightness ' . $brightness;
 
-       sshCommand($cmd, 'litvincent');
-       sshCommand($cmd, 'litjerome');
+    sshCommand($cmd, 'litvincent');
+    sshCommand($cmd, 'litjerome');
 }
 
 
-function wcVMCOn() {
-       setState('lastVMCOn', time());
-       // Start VMC
-       haAction(HA_WC_VMC);
-       //domoticzSwitch(6449, true, 'light', true);
+function wcVMCOn()
+{
+    setState('lastVMCOn', time());
+    // Start VMC
+    haAction(HA_WC_VMC);
+    //domoticzSwitch(6449, true, 'light', true);
 }
 
-function wcVMCOff($timeout = 'auto') {
-       if ($timeout === 'auto') {
-               $d = time() - getState('lastVMCOn');
-               if ($d <= 120) {
-                       $timeout = 1200;
-               } else if ($d <= 300) {
-                       $timeout = 1800;
-               } else {
-                       $timeout = 3200;
-               }
-       }
-       $t = time() + $timeout;
-       $max = max(getState('wcVMCOff', -1), $t);
-       setState('wcVMCOff', $max);
-       if ($max <= time()) {
-               execScene('wc/vmc/off');
-       }
+function wcVMCOff($timeout = 'auto')
+{
+    if ($timeout === 'auto') {
+        $d = time() - getState('lastVMCOn');
+        if ($d <= 120) {
+            $timeout = 1200;
+        } else if ($d <= 300) {
+            $timeout = 1800;
+        } else {
+            $timeout = 3200;
+        }
+    }
+    $t = time() + $timeout;
+    $max = max(getState('wcVMCOff', -1), $t);
+    setState('wcVMCOff', $max);
+    if ($max <= time()) {
+        execScene('wc/vmc/off');
+    }
 }
 
-function checkWCVMC() {
-       $offtime = getState('wcVMCOff', -1);
-       $time = time();
-       if ($offtime == -1 || $offtime > $time || getState('lastVMCOn') > $offtime) {
-               return;
-       }
-       execScene('wc/vmc/off');
+function checkWCVMC()
+{
+    $offtime = getState('wcVMCOff', -1);
+    $time = time();
+    if ($offtime == -1 || $offtime > $time || getState('lastVMCOn') > $offtime) {
+        return;
+    }
+    execScene('wc/vmc/off');
 }
 
-function delayHttpCall($url, $params, $delay) {
-       try {
-               $params['delay'] = $delay;
-               $res = httpRequest($url, 'get', $params, null, 1);
-               echo $url;
-               echo $res->getBody()->getContents();
-       } catch (Exception $e) {
-               print_r($e);
-       }
+function delayHttpCall($url, $params, $delay)
+{
+    try {
+        $params['delay'] = $delay;
+        $res = httpRequest($url, 'get', $params, null, 1);
+        echo $url;
+        echo $res->getBody()->getContents();
+    } catch (Exception $e) {
+        print_r($e);
+    }
 }
 
-function delayScene($scene, $delay) {
-       $host = $_SERVER['HTTP_HOST'] ?? 'entree.home.tortuga.enhydra.fr';
-       $url = 'https://' . $host . '/scripts/light.php';
-       delayHttpCall($url, ['scene' => $scene], $delay);
+function delayScene($scene, $delay)
+{
+    $host = $_SERVER['HTTP_HOST'] ?? 'entree.home.tortuga.enhydra.fr';
+    $url = 'https://' . $host . '/scripts/light.php';
+    delayHttpCall($url, ['scene' => $scene], $delay);
 }
 
-function alert() {
-       if (getNightMode()) {
-               return;
-       }
-
-       execScene('home/doalert');
-
-       $rep = 1 * 2;
-       $domoticzDevices = [4016, 4017, 4033, 4201, 4202, 4203, 4204, 4205, 4614, 4622];
-       $domoticzStates = [];
-
-       foreach ($domoticzDevices as $domoticzDevice) {
-               $domoticzStates[$domoticzDevice] = getDomoticzDeviceStatus($domoticzDevice);
-       }
-
-       for ($i = 0; $i < $rep; $i++) {
-               foreach ($domoticzDevices as $device) {
-                       domoticzSwitch($device, 'Toggle', 'light', true);
-               }
-       }
-
-       $hue = getHueInstance();
-       $group = $hue->getGroups()[18];
-       $allLights = $hue->getLights();
-       $lights = [];
-
-       foreach ($group->getLightIds() as $lightId) {
-               $lights[$lightId] = $allLights[$lightId]->isOn();
-       }
-
-       for ($i = 0; $i < $rep; $i++) {
-               $reverse = $i % 2 === 0;
-               foreach ($lights as $light => $state) {
-                       hueCommand(['light' => $light, 'scene' => ['on' => $reverse ? !$state : $state]]);
-               }
-       }
-
-       sleep(15);
-
-       foreach ($lights as $lightId => $state) {
-               hueCommand(['light' => $lightId, 'scene' => ['on' => $state]]);
-       }
-
-       foreach ($domoticzStates as $domoticzDevice => $domoticzState) {
-               domoticzSwitch($domoticzDevice, $domoticzState);
-       }
+function alert()
+{
+    if (getNightMode()) {
+        return;
+    }
+
+    execScene('home/doalert');
+
+    $rep = 1 * 2;
+    $domoticzDevices = [4016, 4017, 4033, 4201, 4202, 4203, 4204, 4205, 4614, 4622];
+    $domoticzStates = [];
+
+    foreach ($domoticzDevices as $domoticzDevice) {
+        $domoticzStates[$domoticzDevice] = getDomoticzDeviceStatus($domoticzDevice);
+    }
+
+    for ($i = 0; $i < $rep; $i++) {
+        foreach ($domoticzDevices as $device) {
+            domoticzSwitch($device, 'Toggle', 'light', true);
+        }
+    }
+
+    $hue = getHueInstance();
+    $group = $hue->getGroups()[18];
+    $allLights = $hue->getLights();
+    $lights = [];
+
+    foreach ($group->getLightIds() as $lightId) {
+        $lights[$lightId] = $allLights[$lightId]->isOn();
+    }
+
+    for ($i = 0; $i < $rep; $i++) {
+        $reverse = $i % 2 === 0;
+        foreach ($lights as $light => $state) {
+            hueCommand(['light' => $light, 'scene' => ['on' => $reverse ? !$state : $state]]);
+        }
+    }
+
+    sleep(15);
+
+    foreach ($lights as $lightId => $state) {
+        hueCommand(['light' => $lightId, 'scene' => ['on' => $state]]);
+    }
+
+    foreach ($domoticzStates as $domoticzDevice => $domoticzState) {
+        domoticzSwitch($domoticzDevice, $domoticzState);
+    }
 
 }
diff --git a/scripts/nightmode.php b/scripts/nightmode.php
new file mode 100644 (file)
index 0000000..bc694fe
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+require_once "import.php";
+$devices = ['entree', 'cuisine', 'salon', 'wc', 'bureau', 'chambre', 'sdb'];
+foreach ($devices as $device) {
+    echo $device . ' : ' . getNightMode($device) . "<br>";
+}
\ No newline at end of file