From 7e717e916e28854c1d25ab1a55f481df9b225707 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 25 Jan 2021 15:45:02 +0100 Subject: [PATCH] . --- .idea/workspace.xml | 36 +++++++++++++++++++++---------- config/bureau.php | 3 +-- scripts/cron/cron.php | 10 ++++----- scripts/domoticz_device_event.php | 24 ++++++++++----------- scripts/lib/freebox.php | 4 ++-- scripts/lib/harmony.php | 9 ++++---- scripts/lib/hue.php | 3 +-- scripts/lib/mediarasp.php | 10 +++------ scripts/lib/off.php | 5 +++-- scripts/lib/scenes.php | 15 +++++++------ scripts/lib/shield.php | 9 +++----- scripts/lib/squeezebox.php | 11 +++++----- scripts/pcgames.php | 2 +- scripts/share.php | 2 +- scripts/squeeze.php | 2 +- servers/logcat.php | 6 ++---- 16 files changed, 77 insertions(+), 74 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d9a84aa..2ffe36d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,21 @@ + + + + + - + + - + + + + + + diff --git a/config/bureau.php b/config/bureau.php index f4171cb..b8b4daf 100644 --- a/config/bureau.php +++ b/config/bureau.php @@ -3,8 +3,7 @@ config('ROOM_NAME', 'Bureau'); config('ROOM', 'bureau'); config('SQUEEZEBOX_PLAYER', 'Bureau'); config('VIDEOPLAYER', 'mediarasp'); -config('VOLUME', 85); -config('VOLUME_DEVICE', 'shield'); +config('VOLUME_DEVICE', 'harmony'); config('SLEEPTYPE', 'screensaver'); config('SCREENSAVER', 'suncurve'); config('SLEEPSCREEN', 15); diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index 5493cd1..b4f8ee1 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -381,16 +381,16 @@ function cronHarmony($cronmin) return; } if ($currentActivity == 'musique') { - setPlaying('squeezebox', 'salon'); + setPlaying('squeezebox', 'bureau'); } else if ($currentActivity == 'poweroff' || $currentActivity == 'off') { - setPlaying('mycanal', 'salon'); - harmonyDeviceCommand('videoprojecteur-epson', 'power-off'); + setPlaying('mycanal', 'bureau'); + harmonyDeviceCommand('sony-projecteur', 'power-off'); } if ($currentActivity === 'poweroff' || $currentActivity === 'off' || $currentActivity === 'musique') { - harmonyDeviceCommand('videoprojecteur-epson', 'power-off'); + harmonyDeviceCommand('sony-projecteur', 'power-off'); } else { - harmonyDeviceCommand('videoprojecteur-epson', 'power-on'); + harmonyDeviceCommand('sony-projecteur', 'power-on'); } } diff --git a/scripts/domoticz_device_event.php b/scripts/domoticz_device_event.php index 2e214d6..21cc7de 100644 --- a/scripts/domoticz_device_event.php +++ b/scripts/domoticz_device_event.php @@ -33,22 +33,16 @@ if ($_GET['device'] == 480) { off('salon'); break; case 'Move': - if (getCurrentHarmonyActivity() != 'musique') { - _remoteCmd('pause', 'salon'); - } + _remoteCmd('pause', 'salon'); break; case 'Clock_Wise': - volume(3,'+'); + volume(3, '+'); break; case 'Anti_Clock_Wise': - volume(3,'-'); + volume(3, '-'); break; case 'Tap': - if (getCurrentHarmonyActivity() == 'poweroff') { - squeezePlayByName('FIP', $squeezeboxPlayers['Salon']); - } else if (getCurrentHarmonyActivity() == 'musique') { - stopHarmony(); - } + squeezePlayByName('FIP', $squeezeboxPlayers['Salon']); break; case 'Alert': default: @@ -91,13 +85,17 @@ if ($_GET['device'] == 480) { off('bureau'); break; case 'Clock_Wise': - volume(5, '+'); + volume(3, '+'); break; case 'Anti_Clock_Wise': - volume(5, '-'); + volume(3, '-'); break; case 'Tap': - squeezePlayByName('Samba', $squeezeboxPlayers['Bureau']); + if (getCurrentHarmonyActivity() == 'poweroff') { + squeezePlayByName('Samba', $squeezeboxPlayers['Bureau']); + } else if (getCurrentHarmonyActivity() == 'musique') { + stopHarmony(); + } break; case 'Alert': default: diff --git a/scripts/lib/freebox.php b/scripts/lib/freebox.php index d56dbc4..e99a28d 100644 --- a/scripts/lib/freebox.php +++ b/scripts/lib/freebox.php @@ -2,7 +2,7 @@ function freeboxChannel($channel) { - if (config('DEVICE') === 'salon') { + if (config('DEVICE') === 'bureau') { $currentActivity = getCurrentHarmonyActivity(); harmonyActivity('tv'); } @@ -15,7 +15,7 @@ function freeboxChannel($channel) } $keys = array_merge(array('home', 'pause=2', 'home', 'pause=1', 'home', 'left', 'right', 'home'), $commands); - if (config('DEVICE') === 'salon') { + if (config('DEVICE') === 'bureau') { if ($currentActivity != 'tv') { sleep(50); } diff --git a/scripts/lib/harmony.php b/scripts/lib/harmony.php index 90f3d8f..fc9ff9b 100644 --- a/scripts/lib/harmony.php +++ b/scripts/lib/harmony.php @@ -1,7 +1,7 @@ 0) { sleep($wait); } if ($activity == 'tv') { - execScene('salon/cinema'); - runAtEnd('sleep(15);harmonyDeviceCommand(\'videoprojecteur-epson\', \'power-on\');'); + runAtEnd('sleep(15);harmonyDeviceCommand(\'sony-projecteur\', \'power-on\');'); } return $res; } diff --git a/scripts/lib/hue.php b/scripts/lib/hue.php index 1d12463..5d00583 100644 --- a/scripts/lib/hue.php +++ b/scripts/lib/hue.php @@ -17,7 +17,7 @@ function getHueState() return array('groups' => $hue->getGroups(), 'scenes' => $hue->getScenes(), 'lights' => $hue->getLights()); } -function hueCommand($action, $transitionTime, $repeat = 2) +function hueCommand($action, $transitionTime) { $redis = connectRedis(); $queue = $redis->igbget('hue_queue'); @@ -26,7 +26,6 @@ function hueCommand($action, $transitionTime, $repeat = 2) } $command = $action; $command['transitionTime'] = $transitionTime; - $command['repeat'] = $repeat; $queue[] = $command; $redis->igbset('hue_queue', $queue); $redis->publish('hue_event', 'handle_queue'); diff --git a/scripts/lib/mediarasp.php b/scripts/lib/mediarasp.php index 531f69c..426d102 100644 --- a/scripts/lib/mediarasp.php +++ b/scripts/lib/mediarasp.php @@ -58,11 +58,9 @@ function remoteCmd($cmd, $device) if ((($p === 'netflix' || $p === 'tv') && config('TVPLAYER') === 'shield') || config('VIDEOPLAYER') === 'shield') { return shieldRemoteCommand($cmd, $device); - } else if ($device == 'salon') { + } else if ($device == 'bureau') { switch (getCurrentHarmonyActivity()) { - case 'media': - return remoteCmdMedia($cmd, $device); - case 'musique-radio': + case 'musique': return remoteCmdSalonMusique($cmd); case 'tv': return remoteCmdSalonTV($cmd); @@ -319,15 +317,13 @@ function mediaRaspCommons($device) global $squeezeboxPlayers; if ($device == 'salon') { stopSqueezebox('Salon'); - harmonyActivity('tv'); } else if ($device == 'bureau') { execScene('bureau/media/play'); + harmonyActivity('tv'); stopSqueezebox($squeezeboxPlayers['Bureau']); if (!isAlive('bureau')) { sleep(60); } - irsend('bureau', 'Projector', 'PowerOn'); - sshRunCommand('/usr/local/bin/soundtohdmi', 'bureau', true, true); } else if ($device == 'sdb') { execScene('sdb/ampli/on'); } diff --git a/scripts/lib/off.php b/scripts/lib/off.php index 75168a8..dcc5956 100644 --- a/scripts/lib/off.php +++ b/scripts/lib/off.php @@ -25,14 +25,15 @@ function commonOff($device) function offSalon() { - stopHarmony(); shieldKillAll('salon'); shieldSleep('salon'); } function offBureau() { - execScene('bureau/media/stop'); + stopHarmony(); + shieldKillAll('bureau'); + shieldSleep('bureau'); } function offSdb() diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 3f12740..73a87fa 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -335,7 +335,7 @@ $scenes = [ ['type' => 'function', 'function' => 'synchroSoiree'], ], 'salon/on' => [ - ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO'], + ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO','repeat'=>2], //['type' => 'insteon', 'command' => '0?113=I=0=0'], ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1], ], @@ -352,16 +352,16 @@ $scenes = [ // ['type' => 'insteon', 'command' => '0?1111=I=0=0'], ], 'salon/cineclub' => [ - ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu'], + ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu','repeat'=>2], ['type' => 'scene', 'scene' => 'salon/cinemabase'], ], 'salon/cinema' => [ - ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'], + ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35','repeat'=>2], ['type' => 'scene', 'scene' => 'salon/cinemabase'], ], 'salon/tamise' => [ ['type' => 'ecomode', 'mode' => '0'], - ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU'], + ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU','repeat'=>2], // ['type' => 'insteon', 'command' => '0?1130=I=0=0'], ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]], ], @@ -377,7 +377,7 @@ $scenes = [ ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']], ], 'salon/media/play' => [ - ['type' => 'function', 'function' => 'harmonyActivity', 'args' => ['tv']], + ], 'salon/fan/on' => [ ['type' => 'domoticz', 'device' => '478', 'command' => true], @@ -526,7 +526,8 @@ $scenes = [ ['type' => 'scene', 'scene' => 'bureau/rideaux/close'], ['type' => 'scene', 'scene' => 'bureau/off'], ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]], - ['type' => 'ir', 'room' => 'bureausun', 'device' => 'Projector', 'command' => 'PowerOn'], + //['type' => 'ir', 'room' => 'bureausun', 'device' => 'Projector', 'command' => 'PowerOn'], + ['type' => 'function', 'function' => 'harmonyActivity', 'args' => ['tv']], ['type' => 'scene', 'scene' => 'bureau/sound/on'], ], 'bureau/media/stop' => [ @@ -590,7 +591,7 @@ $scenes = [ ['type' => 'hue', 'group' => 17, 'scene' => ['on' => false, 'brightness' => 0, 'effect' => 'none']], ], 'sdb/radio/sync/salon' => [ - ['type' => 'function', 'function' => 'harmonyActivity', 'args' => ["musique"]], + //['type' => 'function', 'function' => 'harmonyActivity', 'args' => ["musique"]], ['type' => 'function', 'function' => 'squeezeRequest', 'args' => ['sync ' . $squeezeboxPlayers['Salon'], $squeezeboxPlayers['Salle de bains']], 'wait' => 1], ['type' => 'function', 'function' => 'squeezeRequest', 'args' => ['power 1', $squeezeboxPlayers['Salon']]], ['type' => 'function', 'function' => 'squeezeRequest', 'args' => ['play', $squeezeboxPlayers['Salon']]] diff --git a/scripts/lib/shield.php b/scripts/lib/shield.php index 828a5e4..0587cd8 100644 --- a/scripts/lib/shield.php +++ b/scripts/lib/shield.php @@ -40,16 +40,13 @@ function shieldRunActivity($device = null) if ($device['id'] === 'salon') { stopPlayersIn('salon', true, false); - if ($onlySound) { - harmonyActivity('musique'); - } else { - harmonyActivity('tv'); - } + } else if ($device['id'] === 'bureau' || $device['id'] === 'bureausun') { stopPlayersIn('bureau', true, false); if ($onlySound) { - execScene('bureau/sound/on'); + harmonyActivity('musique'); } else { + harmonyActivity('tv'); execScene('bureau/media/play'); } } diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index 79b080f..84aa867 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -15,11 +15,13 @@ function stopSqueezeboxPlayer($player, $stopIfSync = true, $devices = true) if ($devices) { $room = getRoomBySqueezeboxPlayer($player); if ($room == 'salon') { - harmonyActivity('off'); + } else if ($room === 'sdb') { execScene('sdb/ampli/off'); } else if ($room === 'bureau') { - execScene('bureau/sound/off'); + if (getCurrentHarmonyActivity() === 'musique') { + harmonyActivity('off'); + } } else if ($room === 'chambre') { denon(false); } @@ -130,11 +132,11 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr if ($player == $squeezeboxPlayers['Salon']) { setState('maskShieldSalonWakeup', '1'); - harmonyActivity('musique'); + } else if ($player == $squeezeboxPlayers['Salle de bains']) { execScene('sdb/ampli/on'); } else if ($player == $squeezeboxPlayers['Bureau']) { - execScene('bureau/sound/on'); + harmonyActivity('musique'); setState('maskShieldBureauWakeup', '1'); } else if ($player == $squeezeboxPlayers['Chambre']) { denon(true); @@ -189,7 +191,6 @@ function isMacAddress($mac) function synchroSoiree() { harmonyActivity('musique'); - exec('bureau/sound/on'); $devices = ['WC', 'Chambre', 'Bureau', 'Cuisine']; $salon = _player('Salon'); diff --git a/scripts/pcgames.php b/scripts/pcgames.php index bc2418e..60673f9 100644 --- a/scripts/pcgames.php +++ b/scripts/pcgames.php @@ -1,7 +1,7 @@ function () use ($device) { - if ($device === 'salon') { + if ($device === 'bureau') { echo 'volume-down' . "\n"; volume('3', '-', 'harmony'); } }, 'WindowManager: handleComboKeys keyCode: 24, keyAction: 1' => function () use ($device) { - if ($device === 'salon') { + if ($device === 'bureau') { echo 'volume-up' . "\n"; volume('3', '+', 'harmony'); } -- 2.39.5