From: Vincent Date: Sat, 21 Nov 2020 16:27:44 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c21a6b84e30b2b3b9462b4d4b4812a73da477dff;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7ac12d2..3d1bd80 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,21 +3,7 @@ - - - - - - - - - - - - - - - + @@ -1308,12 +1306,12 @@ - + - + @@ -1350,10 +1348,11 @@ - - + + + diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index e7c95e4..ca147f3 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -30,13 +30,12 @@ $scenes = [ ['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/auto', 'delay' => 35], ['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' => 'ifttt', 'event' => 'coffee_on'], - ['type' => 'function', 'function' => 'chambreAuto', 'args' => [true]], + ['type' => 'scene', 'scene' => 'chambre/auto', 'delay' => 35], ], 'chambre/deshumidificateur/on' => [ ['type' => 'domoticz', 'device' => $chambrefan, 'command' => true], @@ -709,7 +708,7 @@ function execScene($name, $fromUserAction = false, $transitionTime = null) $e = explode('/', $name); - if ($fromUserAction && $e[1] !== 'auto') { + if ($fromUserAction && $e[1] !== 'auto' && count($e) == 2) { if ($e[0] == 'chambre') { chambreAuto(false); } else if ($e[0] == 'bureau') { @@ -950,8 +949,19 @@ function chambreAuto($on = true, $transitionTime = null) ecoMode(0); setState('chambreAutoMode', '1'); updateChambreAuto($transitionTime); - } else { + } else if (getState('chambreAutoMode') === '1') { setState('chambreAutoMode', '0'); + try { + if (isset($_SERVER['REQUEST_URI'])) { + $r = $_SERVER['REQUEST_URI']; + } else if (php_sapi_name() === 'cli') { + $r = 'cli '; + } + throw new Error('Setting chambre auto mode to false in ' . $r); + } catch (Error $e) { + $log = ROOT . '/log/chambreautooff.log'; + file_put_contents($log, file_get_contents($log) . "\n\n" . date('Y-m-d H:i:s') . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString()); + } } }