From: Vincent Date: Wed, 21 Oct 2020 10:27:06 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2e2c2e9b70ae9e7718aaf3241ab16cad07c9f999;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9d8c73b..623af14 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,12 @@ + + + + + @@ -1268,11 +1274,11 @@ - + - + @@ -1285,6 +1291,10 @@ + + + + diff --git a/config/global.php b/config/global.php index 5c7ec38..7a6b7ee 100644 --- a/config/global.php +++ b/config/global.php @@ -30,6 +30,16 @@ $phones = array('vincent' => array( 'password' => '4pyA?Rnyeyc1$44M') ); +$squeezeboxPlayersByRoom = [ + 'bureau' => ['Bureau'], + 'bureausun' => ['Bureau'], + 'chambre' => ['Lit Vincent', 'Lit Jérôme', 'Chambre'], + 'salon' => ['Salon'], + 'cuisine' => ['Cuisine'], + 'sdb' => ['Salle de bains'], + 'wc' => ['WC'], +]; + $devices = [ 'cerveau' => ['id' => 'cerveau', 'host' => '192.168.13.60', 'user' => 'pi', 'password' => 'atacama'], 'litvincent' => ['id' => 'litvincent', 'host' => '192.168.13.61', 'user' => 'pi', 'password' => 'atacama'], @@ -54,7 +64,7 @@ $directories = array('Séries TV' => array('dir' => 'Series', 'context' => 'tvsh 'X' => array('dir' => 'Z/X', 'context' => 'movie', 'id' => 'x') ); -$videoExt = ['mkv', 'mp4', 'avi', 'ogv', 'ts', 'm2ts', 'mpg', 'm4v', 'flv', 'f4v', 'mov', 'mpg', 'mpeg','divx']; +$videoExt = ['mkv', 'mp4', 'avi', 'ogv', 'ts', 'm2ts', 'mpg', 'm4v', 'flv', 'f4v', 'mov', 'mpg', 'mpeg', 'divx']; profile('Set globals', __FILE__, __LINE__); diff --git a/config/rooms.php b/config/rooms.php index 4889999..979a359 100644 --- a/config/rooms.php +++ b/config/rooms.php @@ -60,6 +60,7 @@ function salon() ['type' => 'light', 'scene' => 'salon/on', 'label' => 'Allumer'], ['type' => 'light', 'scene' => 'salon/off', 'label' => 'éteindre'], ['type' => 'light', 'scene' => 'salon/cinema', 'label' => 'cinéma'], + ['type' => 'light', 'scene' => 'salon/cineclub', 'label' => 'cinéma de minuit'], ['type' => 'light', 'scene' => 'salon/tamise', 'label' => 'Tamisé'], ['type' => 'light', 'scene' => 'salon/lecturenocture', 'label' => 'Lecture nocturne'], ['type' => 'light', 'scene' => 'salon/cheminee', 'label' => 'Cheminée'], diff --git a/scripts/domoticz_device_event.php b/scripts/domoticz_device_event.php index 22149f3..8e9c083 100644 --- a/scripts/domoticz_device_event.php +++ b/scripts/domoticz_device_event.php @@ -9,12 +9,15 @@ if ($_GET['device'] == 1033 || $_GET['device'] == 1476 || $_GET['device'] == 147 if ($_GET['device'] == 1695) { $forceConfig = 'wc'; } +if ($_GET['device'] == 1478) { + $forceConfig = 'bureau'; +} require_once "import.php"; if ($_GET['device'] == 480) { chambreToggle(); -} else if ($_GET['device'] == 1033 || $_GET['device'] == 1476 || $_GET['device'] == 1478) { +} else if ($_GET['device'] == 1033 || $_GET['device'] == 1476) { // Cube switch ($_GET['state']) { case 'Shake': @@ -59,7 +62,7 @@ if ($_GET['device'] == 480) { } else if ($_GET['device'] == 1451) { domoticzSwitch(1450); } else if ($_GET['device'] == 1695) { - $forceConfig = 'salon'; + $forceConfig = 'wc'; switch ($_GET['state']) { case 'Double_Click': execScene('wc/spa'); @@ -73,5 +76,37 @@ if ($_GET['device'] == 480) { wcToggle(); break; } +} else if ($_GET['device'] == 1478) { + // Cube + switch ($_GET['state']) { + case 'Shake': + execScene('home/alert'); + break; + case 'Flip_90': + execScene('bureau/rideaux/toggle'); + break; + case 'Flip_180': + execScene('bureau/auto'); + break; + case 'Free_Fall': + execScene('bureau/off'); + off('bureau'); + break; + case 'Move': + off('bureau'); + break; + case 'Clock_Wise': + volume(5, '+'); + break; + case 'Anti_Clock_Wise': + volume(5, '-'); + break; + case 'Tap': + squeezePlayByName('Samba', $squeezeboxPlayers['Bureau']); + break; + case 'Alert': + default: + break; + } } echo '1'; \ No newline at end of file diff --git a/scripts/lib/off.php b/scripts/lib/off.php index e97c0f3..2e9f268 100644 --- a/scripts/lib/off.php +++ b/scripts/lib/off.php @@ -20,7 +20,7 @@ function off($device = null) function commonOff($device) { remoteCmdMedia('stop', $device); - squeezeRequest('stop'); + stopPlayersIn($device); } function offSalon() diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 0c09abe..1e4c8c2 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -323,11 +323,19 @@ $scenes = [ ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)], ['type' => 'scene', 'scene' => 'salon/fan/off'], ], - 'salon/cinema' => [ - ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'], + 'salon/cinemabase' => [ ['type' => 'scene', 'scene' => 'cuisine/tamise'], ['type' => 'ecomode', 'mode' => '0'], ['type' => 'insteon', 'command' => '0?1111=I=0=0'], + ], + 'salon/cineclub' => [ + ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu'], + ['type' => 'scene', 'scene' => 'salon/cinemabase'], + ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu'], + ], + 'salon/cinema' => [ + ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'], + ['type' => 'scene', 'scene' => 'salon/cinemabase'], ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'], ], 'salon/tamise' => [ @@ -375,7 +383,6 @@ $scenes = [ ['type' => 'ecomode', 'mode' => '0'], ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']], ], - 'bureau/l61/on' => [ ['type' => 'domoticz', 'device' => '2074', 'command' => true], ], @@ -504,6 +511,9 @@ $scenes = [ 'bureau/rideaux/open' => [ ['type' => 'domoticz', 'device' => '391', 'command' => true, 'priority' => true], ], + 'bureau/rideaux/toggle' => [ + ['type' => 'domoticz', 'device' => '391', 'command' => 'Toggle', 'priority' => true], + ], 'insteon/off' => [ ['type' => 'insteon', 'command' => '0?135=I=0=0'], ], diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index 7f12955..81a6561 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -29,6 +29,16 @@ function stopSqueezebox($player) } } +function stopPlayersIn($room) +{ + global $squeezeboxPlayers, $squeezeboxPlayersByRoom; + if (isset($squeezeboxPlayersByRoom[$room])) { + foreach ($squeezeboxPlayersByRoom[$room] as $player) { + stopSqueezebox($player); + } + } +} + function squeezeRequest($params, $player = '') { $redis = connectRedis();