From 7d6cca710927bcbea58f8b996a6885cd0b55e505 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 16 Oct 2019 09:08:46 +0200 Subject: [PATCH] . --- .idea/workspace.xml | 31 ++++++---- scripts/lib/ecomode.php | 5 ++ scripts/lib/medialibrary.php | 11 ++-- scripts/lib/mediarasp.php | 4 ++ scripts/lib/pc.php | 5 ++ scripts/lib/scenes.php | 113 ++++++++++++++++++++--------------- scripts/lib/squeezebox.php | 9 +-- scripts/media.php | 2 +- scripts/squeeze.php | 40 +++++++------ servers/domoticz.php | 2 +- 10 files changed, 132 insertions(+), 90 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c99dd6f..255c2de 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,15 @@ + + + + - + + + + diff --git a/scripts/lib/ecomode.php b/scripts/lib/ecomode.php index 3bbe9e7..ee0d5ab 100644 --- a/scripts/lib/ecomode.php +++ b/scripts/lib/ecomode.php @@ -22,4 +22,9 @@ function disableSuperEcoMode() if ($currentMode == '2') { ecoMode('1'); } +} + +function nightmode($mode) +{ + setState('night', (!!$mode) ? '1' : '0'); } \ No newline at end of file diff --git a/scripts/lib/medialibrary.php b/scripts/lib/medialibrary.php index 5720bae..6b7d3cd 100644 --- a/scripts/lib/medialibrary.php +++ b/scripts/lib/medialibrary.php @@ -122,6 +122,10 @@ function mediaName($name, $context, $dir, $path) function transcodeOneVideo() { + if (getState('night') == '1') { + return; + } + $list = getVideosList(true); foreach ($list as $item) { @@ -135,11 +139,8 @@ function transcodeOneVideo() set_time_limit(0); ignore_user_abort(true); - $hour = intval(date('H')); - if ($hour > 12 && $hour < 20) { - wakeupPC('avion'); - sleep(5); - } + wakeupPC('avion'); + sleep(5); $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $item->getExtension(); print_r(sshCommand($cmd, 'avion')); diff --git a/scripts/lib/mediarasp.php b/scripts/lib/mediarasp.php index 2ea0f20..ae2365a 100644 --- a/scripts/lib/mediarasp.php +++ b/scripts/lib/mediarasp.php @@ -318,6 +318,10 @@ function mediaRaspCommons($device) } else if ($device == 'bureau') { execScene('bureau/media/play'); stopSqueezebox($squeezeboxPlayers['Bureau']); + if(!isAlive('bureau')){ + sleep(60); + irsend('bureau','Projector','PowerOn'); + } // sshRunCommand('/usr/local/bin/soundtohdmi', 'bureau'); } else if ($device == 'sdb') { execScene('sdb/ampli/on'); diff --git a/scripts/lib/pc.php b/scripts/lib/pc.php index 7dcf4ea..7962578 100644 --- a/scripts/lib/pc.php +++ b/scripts/lib/pc.php @@ -15,11 +15,16 @@ function wakeupPC($device) setState($s, '1'); sleep(10); sshCommand('"C:\Program Files\Scripts\wakeup.bat"', $device, false); + setState($s, '1'); } function sleepPC($device) { $s = 'device_' . $device . '_awake'; + if (getState($s) == '0') { + return; + } + setState($s, '0'); $res = sshCommand('"C:\Program Files\Scripts\sleep.bat"', $device, false); setState($s, '0'); return $res; diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 1c2d1eb..1e24fdf 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -28,6 +28,7 @@ if (getState('vincenthere')) { $scenes = [ 'chambre/matin' => [ + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'ecomode', 'mode' => '0'], ['type' => 'hue', 'group' => $chambre, 'scene' => 'JNieZpDHu5fbMyf'], ['type' => 'hue', 'group' => $chambre, 'scene' => 'dawn', 'delay' => 1], @@ -52,10 +53,12 @@ $scenes = [ ['type' => 'insteon', 'command' => '0?1338=I=0=0'], ], 'chambre/auto' => [ + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'function', 'function' => 'chambreAuto', 'args' => [true]], ], 'chambre/bed' => [ ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]], + ['type' => 'nightmode', 'mode' => '1'], ['type' => 'ecomode', 'mode' => '1'], ['type' => 'state', 'key' => 'chambre', 'value' => 0], ['type' => 'scene', 'scene' => 'chambre/rideaux/close'], @@ -70,21 +73,21 @@ $scenes = [ ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Va Au Lit'], ], 'chambre/boreal' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'mwAGvt2n70oXCqA'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], ['type' => 'scene', 'scene' => 'chambre/cheminee/cold'], ], 'chambre/savane' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'ABqCuE-ob-sw2vQ'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/focus' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'Ne6uJnnoPO9yRhl'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -92,7 +95,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee/cold'], ], 'chambre/chillout' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => '03gdSwPyZ9sbZVg'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -100,7 +103,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/reading' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'BNiNQjxiWNbKRaH'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -108,7 +111,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/tonic' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'Tlcft9sPK492cJA'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -116,6 +119,8 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee/cold'], ], 'chambre/sleepbase' => [ + ['type' => 'nightmode', 'mode' => '1'], + ['type' => 'ecomode', 'mode' => '1'], ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]], ['type' => 'state', 'key' => 'chambre', 'value' => 0], ['type' => 'insteon', 'command' => '0?1332=I=0=0'], // Lustre et tableau off @@ -125,11 +130,8 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'], ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'], - ['type' => 'scene', 'scene' => 'chambre/raspberry/off'], ['type' => 'delay', 'scene' => 'chambre/bedoff', 'delay' => 300], // Tout off dans 5 min ['type' => 'delay', 'scene' => 'chambre/planetarium/off', 'delay' => 3600], // Planétarium off dans une heure - ['type' => 'scene', 'scene' => 'salon/freebox/off'], - ['type' => 'scene', 'scene' => 'sdb/ampli/off'], ], 'chambre/sleep' => [ ['type' => 'hue', 'group' => $chambrebedgroup, 'scene' => '-P3feFyrTnFNfXi'], // Veilleuse + @@ -140,7 +142,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/sleepbase'], ], 'chambre/party' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => '4yj7eRjaNuR6S6x'], ['type' => 'insteon', 'command' => '0?1119=I=0=0'], @@ -148,7 +150,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/flowers' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'VtGPKtpQ7DF-RCd'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -156,7 +158,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/tropical' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'Mqq8VMsmPQtzEQ0'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -164,7 +166,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/beach' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'HfMaPG92lEOUDB0'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -172,7 +174,6 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/summernight' => [ - ['type' => 'ecomode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'JNieZpDHu5fbMyf'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -180,7 +181,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/lounge' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'XGuSVQ3RCd7JUBC'], ['type' => 'insteon', 'command' => '0?1131=I=0=0'], @@ -188,7 +189,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/full' => [ - ['type' => 'ecomode', 'mode' => '0'], + ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], ['type' => 'hue', 'group' => $chambre, 'scene' => 'ZkiQbNQDXJz9-OC'], ['type' => 'insteon', 'command' => '0?1132=I=0=0'], @@ -203,6 +204,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee/off'], ], 'chambre/bedoff' => [ + ['type' => 'nightmode', 'mode' => '1'], ['type' => 'ecomode', 'mode' => '1'], ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]], ['type' => 'state', 'key' => 'chambre', 'value' => 0], @@ -211,8 +213,6 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'], ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]], ['type' => 'scene', 'scene' => 'chambre/cheminee/off'], - ['type' => 'scene', 'scene' => 'salon/freebox/off'], - ['type' => 'scene', 'scene' => 'sdb/ampli/off'], ], 'chambre/cheminee' => [ ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['chambre', 'fire', 1]], @@ -251,18 +251,18 @@ $scenes = [ ['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/west/open' => [ - ['type' => 'insteon', 'command' => '3?02622013CB0F11FF=I=3'], - ], - 'chambre/rideaux/west/close' => [ - ['type' => 'insteon', 'command' => '3?02622013CB0F1300=I=3'], - ], - 'chambre/rideaux/east/open' => [ - ['type' => 'insteon', 'command' => '3?02622014690F1300=I=3'], - ], - 'chambre/rideaux/east/close' => [ - ['type' => 'insteon', 'command' => '3?02622014690F11FF=I=3'], - ], +// 'chambre/rideaux/west/open' => [ +// ['type' => 'insteon', 'command' => '3?02622013CB0F11FF=I=3'], +// ], +// 'chambre/rideaux/west/close' => [ +// ['type' => 'insteon', 'command' => '3?02622013CB0F1300=I=3'], +// ], +// 'chambre/rideaux/east/open' => [ +// ['type' => 'insteon', 'command' => '3?02622014690F1300=I=3'], +// ], +// 'chambre/rideaux/east/close' => [ +// ['type' => 'insteon', 'command' => '3?02622014690F11FF=I=3'], +// ], 'chambre/rideaux/open' => [ ['type' => 'insteon', 'command' => '0?1126=I=0=0'], ], @@ -271,24 +271,24 @@ $scenes = [ ], 'home/alert' => [ ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'], - ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => true, 'priority' => true], + ['type' => 'domoticz', 'device' => '392', 'switchtype' => 'device', 'command' => true, 'priority' => true], ['type' => 'hue', 'group' => $home, 'scene' => ['alert' => 'select']], ['type' => 'hue', 'group' => $home, 'scene' => ['alert' => 'none'], 'delay' => 1], ['type' => 'hue', 'group' => $home, 'scene' => ['alert' => 'select']], ], 'home/aulit' => [ + ['type' => 'nightmode', 'mode' => '1'], + ['type' => 'ecomode', 'mode' => '1'], ['type' => 'scene', 'scene' => 'chambre/bed'], ['type' => 'scene', 'scene' => 'bureau/off'], ['type' => 'scene', 'scene' => 'salon/off'], ['type' => 'function', 'function' => 'stopHarmony'], ['type' => 'function', 'function' => 'stopAllSqueezebox'], - ['type' => 'ecomode', 'mode' => '1'], ], 'home/music/synchro/soiree' => [ ['type' => 'function', 'function' => 'synchroSoiree'], ], 'salon/on' => [ - ['type' => 'ecomode', 'mode' => '0'], ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO'], ['type' => 'insteon', 'command' => '0?113=I=0=0'], ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1], @@ -331,7 +331,6 @@ $scenes = [ ], 'bureau/auto' => [ ['type' => 'function', 'function' => 'bureauAuto', 'args' => [true]], - ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']], ], 'bureau/base/on' => [ ['type' => 'ecomode', 'mode' => '0'], @@ -415,35 +414,33 @@ $scenes = [ ['type' => 'scene', 'scene' => 'bureau/base/on'], ], 'bureau/off' => [ + ['type' => 'scene', 'scene' => 'bureau/plasma/off'], ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]], ['type' => 'hue', 'group' => $bureau, 'scene' => array('on' => false, 'brightness' => 0)], ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'off'], ['type' => 'function', 'function' => 'sleepPC', 'args' => ['avion']], - ['type' => 'scene', 'scene' => 'bureau/plasma/off'], ], - 'bureau/plasma/on' => [ ['type' => 'domoticz', 'device' => '477', 'command' => true, 'priority' => true], - //['type' => 'insteon', 'command' => '0?1138=I=0=0'], ], 'bureau/plasma/off' => [ ['type' => 'domoticz', 'device' => '477', 'command' => false, 'priority' => true], - //['type' => 'insteon', 'command' => '0?1338=I=0=0'], ], - 'bureau/media/play' => [ - ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]], - ['type' => 'ir', 'room' => 'bureau', 'device' => 'Projector', 'command' => 'PowerOn'], - ['type' => 'scene', 'scene' => 'bureau/media/on'], + ['type' => 'function', 'function' => 'bureauMediaOn'], ['type' => 'scene', 'scene' => 'bureau/screen/down'], ['type' => 'scene', 'scene' => 'bureau/rideaux/close'], ['type' => 'scene', 'scene' => 'bureau/off'], + ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]], + ['type' => 'ir', 'room' => 'bureau', 'device' => 'Projector', 'command' => 'PowerOn'], ], 'bureau/media/on' => [ - ['type' => 'insteon', 'command' => '0?1139=I=0=0'] + ['type' => 'insteon', 'command' => '0?1139=I=0=0'], + ['type' => 'domoticz', 'device' => '559', 'command' => true, 'priority' => true], ], 'bureau/media/off' => [ - ['type' => 'insteon', 'command' => '0?1339=I=0=0'] + ['type' => 'insteon', 'command' => '0?1339=I=0=0'], + ['type' => 'domoticz', 'device' => '559', 'command' => false, 'priority' => true], ], 'bureau/screen/down' => [ ['type' => 'domoticz', 'device' => '1', 'command' => true, 'priority' => true], @@ -473,8 +470,6 @@ $scenes = [ ['type' => 'function', 'function' => 'offAllOMX'], ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'], ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Stop All Sounds'], - ['type' => 'scene', 'scene' => 'salon/freebox/off'], - ['type' => 'scene', 'scene' => 'sdb/ampli/off'], ['type' => 'scene', 'scene' => 'chambre/planetarium/off'], ['type' => 'ifttt', 'event' => 'coffee_off'], ['type' => 'ifttt', 'event' => 'oven_off'], @@ -580,8 +575,7 @@ $scenes = [ ], 'ecomode/off' => [ ['type' => 'scene', 'scene' => 'ecomode/notsuper'], - ['type' => 'scene', 'scene' => 'chambre/raspberry/on'], - ['type' => 'scene', 'scene' => 'bureau/media/on'],// Media bureau + ['type' => 'scene', 'scene' => 'chambre/raspberry/on', 'when' => ['night' => 0]], ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => true, 'priority' => false], ], ]; @@ -607,6 +601,19 @@ function execScene($name, $fromUserAction = false, $transitionTime = null) $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); } @@ -654,6 +661,8 @@ function execScene($name, $fromUserAction = false, $transitionTime = null) irsend($action['room'], $action['device'], $action['command']); } else if ($action['type'] == 'ifttt') { ifttt($action['event']); + } else if ($action['type'] == 'nightmode') { + nightmode($action['mode']); } } } @@ -898,4 +907,12 @@ function _wcVMCOff($timeout) if (getState('wcTimeout') == $rand) { insteonCommand('0?1334=I=0=0'); } +} + +function bureauMediaOn() +{ + execScene('bureau/media/on'); + if (!isAlive('bureau')) { + sleep(60); + } } \ No newline at end of file diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index 4cfd1b1..72807fb 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -47,9 +47,6 @@ function squeezeRequest($params, $player = '') function _squeezeRequest($params, $player = '') { global $rpcid; - if (!isAlive('cuisine')) { - return; - } if (!isset($rpcid)) { $rpcid = 1; } @@ -87,6 +84,9 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr if ($player == $squeezeboxPlayers['Salle de bains']) { execScene('sdb/ampli/on'); } + if ($player == $squeezeboxPlayers['Bureau']) { + bureauMediaOn(); + } squeezeRequest('pause', $player); if (null !== $volume) { @@ -103,9 +103,6 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr echo $player . ':' . $command . '
'; squeezeRequest($command, $player); } -// if ($player == $squeezeboxPlayers['Bureau']) { -// sshCommand('/usr/local/bin/soundtojack', 'bureau'); -// } } function _player($player = null) diff --git a/scripts/media.php b/scripts/media.php index 8812378..3957165 100644 --- a/scripts/media.php +++ b/scripts/media.php @@ -3,4 +3,4 @@ $u=$_GET['url']; $e=explode('.',$u); $ext=array_pop($e); -$cached=ROOT.'/cache/media' \ No newline at end of file +$cached=ROOT.'/cache/media'; \ No newline at end of file diff --git a/scripts/squeeze.php b/scripts/squeeze.php index c037e23..a8abfeb 100644 --- a/scripts/squeeze.php +++ b/scripts/squeeze.php @@ -3,31 +3,33 @@ require_once "import.php"; $requests = []; if (isset($_GET['requests'])) { - $requests = json_decode($_GET['requests']); + $requests = json_decode($_GET['requests']); } if (!in_array('stop', $requests) || isset($_GET['name'])) { - if ($_GET['player'] == 'Salon') { - print_r(harmonyActivity("musique-radio")); - } elseif ($_GET['player'] == 'Salle de bains') { - execScene('sdb/ampli/on'); - } - setPlaying('squeezebox'); + if ($_GET['player'] == 'Salon') { + print_r(harmonyActivity("musique-radio")); + } elseif ($_GET['player'] == 'Salle de bains') { + execScene('sdb/ampli/on'); + } else if ($_GET['player'] == 'Bureau') { + bureauMediaOn(); + } + setPlaying('squeezebox'); } else { - if ($_GET['player'] == 'Salle de bains') { - //execScene('sdb/ampli/off'); - } - if (getPlaying() == 'squeezebox') { - setPlaying(''); - } + if ($_GET['player'] == 'Salle de bains') { + //execScene('sdb/ampli/off'); + } + if (getPlaying() == 'squeezebox') { + setPlaying(''); + } } -if (isset($_GET['name'])){ +if (isset($_GET['name'])) { echo $_GET['name']; - squeezePlayByName($_GET['name'], $_GET['player']); + squeezePlayByName($_GET['name'], $_GET['player']); } else if (isset($_GET['requests'])) { - $res = []; - foreach ($requests as $request) { - $res[] = squeezeRequest($request, $_GET['player']); - } + $res = []; + foreach ($requests as $request) { + $res[] = squeezeRequest($request, $_GET['player']); + } } \ No newline at end of file diff --git a/servers/domoticz.php b/servers/domoticz.php index ee18246..335f173 100644 --- a/servers/domoticz.php +++ b/servers/domoticz.php @@ -34,6 +34,6 @@ function handleDomoticzQueue() $redis->igbset($q, $queue); echo 'Run command ' . json_encode($command) . "\n"; runDomoticzCommand($command); - usleep(1000000 * 2.5); + usleep(1000000 * 4); } } \ No newline at end of file -- 2.39.5