From: Vincent Date: Wed, 13 Jan 2021 09:07:13 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4376b611c7c138ae9ee3fd08710cc9ed1b5edffc;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 60f6c5a..b8c33b8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,10 @@ + + + diff --git a/config/chambre.php b/config/chambre.php index 6efb0e0..5204e6e 100644 --- a/config/chambre.php +++ b/config/chambre.php @@ -17,7 +17,7 @@ if (DISPLAYINTERFACE) { $c = chambre(); $shortcuts['lights'] = $c['all']; - $favoriteslights = $c['favorites']; + $favoriteslights = array_merge([['type' => 'light', 'scene' => 'chambre/reading/fireplace', 'label' => 'Au coin du feu'],], $c['favorites']); include "default.php"; $nav = ['home', 'lights', 'music', 'remote', 'coffee', 'switch', 'settings', 'alert', 'off']; diff --git a/config/global.php b/config/global.php index 2bc3162..2944470 100644 --- a/config/global.php +++ b/config/global.php @@ -28,6 +28,7 @@ $squeezeboxPlayers = array( 'Bureau' => '7e:23:f6:33:1d:3b', ); + $phones = array('vincent' => array( 'ip' => '192.168.13.31', 'key' => 'APA91bHeWfPc86eVpVzYDfQHdolELsdHdlNou2a2YoMWhBuAG9odAlfZLBjve9zDBq4U04e_zd2tA864El8Z2NfUh7XJktOHbU4F1mdmAVczklg5ZFRClvhX4f8fqfZ9YLG94NdBQbGn', diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index a30a2b0..492b53c 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -143,6 +143,10 @@ $scenes = [ ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]], ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], + 'chambre/reading/fireplace' => [ + ['type' => 'scene', 'scene' => 'chambre/chillout'], + ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Cheminée', $squeezeboxPlayers['Chambre']]], + ], 'chambre/reading' => [ ['type' => 'nightmode', 'mode' => '0'], ['type' => 'state', 'key' => 'chambre', 'value' => 1], @@ -1077,7 +1081,7 @@ function wcVMCOn() { setState('lastVMCOn', time()); // Start VMC - domoticzSwitch(2205,true,'light', true); + domoticzSwitch(2205, true, 'light', true); } function wcVMCOff($timeout = 'auto') diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index fb7b1f6..cb33273 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -7,9 +7,34 @@ function stopSqueezeboxPlayer($player, $stopIfSync = true) if (!$stopIfSync && getState('syncsoiree') == '1') { return; } + squeezeRequest('sync -', $player); squeezeRequest('stop', $player); squeezeRequest('power 0', $player); + + $room = getRoomBySqueezeboxPlayer($player); + if ($room == 'salon') { + + } else if ($room === 'sdb') { + execScene('sdb/ampli/off'); + } else if ($room === 'bureau') { + execScene('bureau/sound/off'); + } else if ($room === 'chambre') { + denon(false); + } +} + +function getRoomBySqueezeboxPlayer($player) +{ + global $squeezeboxPlayers, $squeezeboxPlayersByRoom; + $player = _player($player); + $p = array_search($player, $squeezeboxPlayers); + foreach ($squeezeboxPlayersByRoom as $room => $players) { + if (in_array($p, $players)) { + return $room; + } + } + return null; } function stopAllSqueezebox() @@ -34,12 +59,9 @@ function getSqueezePlayerStatus($player = '') return $res['result']['_mode'] == 'play' ? 1 : 0; } -function stopSqueezebox($player) +function stopSqueezebox($player, $stopIfSync = true) { - $commandes = ['stop', 'power 0', 'sync -']; - foreach ($commandes as $commande) { - squeezeRequest($commande, $player); - } + stopSqueezeboxPlayer($player, $stopIfSync); } function stopPlayersIn($room)