From: Vincent Date: Tue, 3 Nov 2020 14:43:38 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=629d121b2abbadf5e6219faeb4e4286504881fd0;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 976b62d..1425995 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,18 +3,10 @@ - - - - - - - - @@ -1302,12 +1294,12 @@ - + - + diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index 06865ff..1e1f37f 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -337,23 +337,10 @@ function cronHarmony($cronmin) _logSection('Harmony'); $currentActivity = getCurrentHarmonyActivity(); - if ($currentActivity == 'tv') { - // On allume la freebox si ce n'est pas déjà le cas - execScene('salon/freebox/on'); - } else { - // Toutes les 15 minutes on éteint la freebox si elle est allumée - if ($cronmin % 15 == 0) { - execScene('salon/freebox/off'); - } - } - if (!$currentActivity) { return; } - - if ($currentActivity == 'tv') { - setPlaying('mycanal', 'salon'); - } else if ($currentActivity == 'musique') { + if ($currentActivity == 'musique') { setPlaying('squeezebox', 'salon'); } else if ($currentActivity == 'poweroff' || $currentActivity == 'off') { setPlaying('mycanal', 'salon'); diff --git a/scripts/lib/harmony.php b/scripts/lib/harmony.php index e810aec..aded60d 100644 --- a/scripts/lib/harmony.php +++ b/scripts/lib/harmony.php @@ -30,7 +30,7 @@ function harmonyRequest($uri, $method = 'GET', $hub = 'salon') function harmonyActivity($activity) { - if ($activity == 'tv' $activity == 'poweroff' || $activity == 'off') { + if ($activity == 'poweroff' || $activity == 'off') { setPlaying('mycanal', 'salon'); } $wait = 0; @@ -47,7 +47,7 @@ function harmonyActivity($activity) if ($wait > 0) { sleep($wait); } - if ($activity == 'tv' ) { + if ($activity == 'tv') { runAtEnd('sleep(5);harmonyDeviceCommand(\'videoprojecteur-epson\', \'power-on\');'); } return $res; diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 7b1a97a..f79ae68 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -312,7 +312,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'home/aulitbase'], ['type' => 'scene', 'scene' => 'chambre/bed'], ], - 'home/aulitoff'=>[ + 'home/aulitoff' => [ ['type' => 'scene', 'scene' => 'home/aulitbase'], ['type' => 'scene', 'scene' => 'chambre/bed/off'], ['type' => 'scene', 'scene' => 'sdb/off'], @@ -784,7 +784,7 @@ function execScene($name, $fromUserAction = false, $transitionTime = null) } else if ($action['type'] == 'phonetask') { phoneTask($action['task'], $action['phone'], true); } else if ($action['type'] == 'ecomode') { - ecoMode($action['mode']); + ecoMode($action['mode'], true); } else if ($action['type'] == 'domoticz') { if (isset($action['scene'])) { $action['device'] = $action['scene']; diff --git a/scripts/lib/shield.php b/scripts/lib/shield.php index 0f22b85..5ecbffa 100644 --- a/scripts/lib/shield.php +++ b/scripts/lib/shield.php @@ -16,6 +16,13 @@ function shieldConnect() } } +function shieldRunActivity($device=null){ + $device=getDevice($device); + if($device==='salon'){ + harmonyActivity('tv'); + } +} + function shieldCommand($command, $params) { shieldConnect(); @@ -79,14 +86,10 @@ function shieldKey($keys, $device = true) function shieldNetflix($id = null, $device = null) { + shieldRunActivity($device); shieldHome(); sleep(1); - $device=getDevice($device); - if($device==='salon'){ - harmonyActivity('tv'); - } - $url = 'http://www.netflix.com/'; if (null !== $id && $id !== 'home') { $url .= 'watch/' . $id; @@ -145,6 +148,7 @@ function shieldLaunchApp($activity) function shieldMyCanal($channel = false, $type = 'live', $device = null) { + shieldRunActivity($device); if ($type === 'replay') { if ($channel === 'arte') { return shieldArte(); @@ -158,16 +162,13 @@ function shieldMyCanal($channel = false, $type = 'live', $device = null) } else if ($type === 'live') { $url = 'https://www.canalplus.com/live/?channel=' . $channel; } - $device=getDevice($device); - if($device==='salon'){ - harmonyActivity('tv'); - } setPlaying('mycanal', $device); _adb('shell am start', '-a android.intent.action.VIEW -f 0x10808000 -d ' . $url . ' com.canal.android.canal/com.canal.app.common.legacy.DeepLinkActivity'); } function shieldKodi($file,$device=null) { + shieldRunActivity($device); shieldHome(); $device=getDevice($device); if($device==='salon'){ @@ -187,8 +188,8 @@ function shieldNormalizeURL($input) function shieldVLC($file) { + shieldRunActivity($device); shieldHome(); - $url = 'smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share/' . $file; _adb('shell am start', '-a android.intent.action.VIEW -d \'"' . shieldNormalizeURL($file) . '"\' -n org.videolan.vlc/.StartActivity'); }