From: Vincent Date: Fri, 22 Jan 2021 17:52:07 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ad943de78256b9cde51f28276507db2f6b2a1dd1;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d6351bc..d9a84aa 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,6 +3,10 @@ + + + + diff --git a/scripts/lib/hue.php b/scripts/lib/hue.php index 5d00583..1d12463 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) +function hueCommand($action, $transitionTime, $repeat = 2) { $redis = connectRedis(); $queue = $redis->igbget('hue_queue'); @@ -26,6 +26,7 @@ function hueCommand($action, $transitionTime) } $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/medialibrary.php b/scripts/lib/medialibrary.php index 6523ef3..38062c2 100644 --- a/scripts/lib/medialibrary.php +++ b/scripts/lib/medialibrary.php @@ -159,6 +159,7 @@ function getTranscodedPath(SplFileInfo $item) function transcodeOneVideo() { + return; if (getState('night') == '1' || getState('device_avion_awake') == '0') { return; } diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 492b53c..3f12740 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -307,9 +307,10 @@ $scenes = [ ['type' => 'domoticz', 'device' => '1756', 'command' => 'Group On', 'priority' => true], ], 'home/alert' => [ - ['type' => 'hue', 'group' => $alert, 'scene' => ['alert' => 'lselect']], - ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'], ['type' => 'domoticz', 'device' => '392', 'command' => true, 'priority' => true], + ['type' => 'hue', 'group' => $alert, 'scene' => ['alert' => 'select']], + ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'], + ['type' => 'hue', 'group' => $alert, 'delay' => 1, 'scene' => ['alert' => 'none']], ], 'home/aulit' => [ ['type' => 'scene', 'scene' => 'chambre/bed'], @@ -337,7 +338,6 @@ $scenes = [ ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO'], //['type' => 'insteon', 'command' => '0?113=I=0=0'], ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1], - ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO'], ], 'salon/off' => [ ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)], @@ -354,25 +354,21 @@ $scenes = [ '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' => [ ['type' => 'ecomode', 'mode' => '0'], ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU'], // ['type' => 'insteon', 'command' => '0?1130=I=0=0'], ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]], - ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU'], ], 'salon/lecturenocture' => [ ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'], // ['type' => 'insteon', 'command' => '0?1113=I=0=0'], ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.25]], - ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'], ], 'salon/cheminee' => [ ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 1]], diff --git a/servers/hue.php b/servers/hue.php index 0dcaba8..6e6c498 100644 --- a/servers/hue.php +++ b/servers/hue.php @@ -31,14 +31,20 @@ function handleHueQueue() break; } - $queue = array_unique($queue); - echo 'Handle Queue : current state ' . json_encode($queue) . "\n"; $command = array_shift($queue); + if (isset($command['repeat']) && $command['repeat'] > 0) { + $command['repeat']--; + array_push($queue, $command); + } $redis->igbset('hue_queue', $queue); echo 'Run command ' . json_encode($command) . "\n"; - _hueCommand($command); + try { + _hueCommand($command); + }catch (Exception $e){ + + } usleep(1000000 * 0.1); } echo 'End of handling queue' . "\n";