]> _ Git - tortuga-home.git/commitdiff
.
authorvincent <vincent@enhydra.fr>
Sat, 11 Dec 2021 06:51:07 +0000 (07:51 +0100)
committervincent <vincent@enhydra.fr>
Sat, 11 Dec 2021 06:51:07 +0000 (07:51 +0100)
59 files changed:
.idea/workspace.xml
config/bureau.php
config/cave.php
config/cuisine.php
config/global.php
config/salon.php
config/sdb.php
config/settings.php
config/wc.php
images/earth.png [new file with mode: 0644]
images/suncurve.png [new file with mode: 0644]
js/home.js
scripts/app_token
scripts/cron/cron.php
scripts/domoticz_device_event.php
scripts/domoticz_status.php
scripts/freeboxapi.php
scripts/gradient.php
scripts/import.php
scripts/lib/denon.php
scripts/lib/domoticz.php
scripts/lib/flowerpower.php
scripts/lib/freebox.php
scripts/lib/harmony.php
scripts/lib/http.php
scripts/lib/hue.php
scripts/lib/kodi.php
scripts/lib/lib.php
scripts/lib/mediarasp.php
scripts/lib/off.php
scripts/lib/pc.php
scripts/lib/proc.php
scripts/lib/profile.php
scripts/lib/remoteinfos.php
scripts/lib/router.php
scripts/lib/scenes.php
scripts/lib/shield.php
scripts/lib/squeezebox.php
scripts/lib/ssh.php
scripts/lib/tmdb.php
scripts/lib/weatherstation.php
scripts/mediarasp.php
scripts/shield.php
scripts/sleeppc.php
scripts/squeeze.php
scripts/squeezeplayerstatus.php
servers/_startdaemon.php
servers/domoticz.php
servers/hue.php
servers/logcat.php
servers/logcatb.php
servers/logcats.php
servers/squeezebox.php
servers/ssh.php
style/gradient.css
style/gradient.less
style/style.less
style/weatherstation.css
style/weatherstation.less

index 549288a129b9f4e3265b323965cacbf2233eaca6..406367f63a6837e34b3ccae3cc2aeac067bc9e49 100644 (file)
@@ -2,34 +2,65 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/install.md" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/lib/wol.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/wc.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/wol.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/home.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/home.iml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/images/earth.png" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/images/suncurve.png" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/bureau.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/bureau.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/cave.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/cave.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/cuisine.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/cuisine.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/tv.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/tv.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/images/rooms/medium/entree.jpg" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/images/rooms/originaux/entree.jpg" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/images/rooms/originaux/litjerome.jpg" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/images/rooms/originaux/litvincent.jpg" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/images/rooms/originaux/sdb.jpg" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/salon.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/salon.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/sdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/sdb.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/settings.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/settings.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/wc.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/wc.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/app_token" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/app_token" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/domoticz_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_device_event.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/domoticz_status.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_status.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/freeboxapi.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/freeboxapi.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/gradient.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/gradient.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/import.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/import.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/denon.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/domoticz.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/flowerpower.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/flowerpower.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/freebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/freebox.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/harmony.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/harmony.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/http.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/http.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/hue.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/hue.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/kodi.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/kodi.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/mediarasp.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/off.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/off.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/pc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/pc.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/proc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/proc.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/profile.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/profile.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/router.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/router.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/ssh.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/ssh.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/mediarasp.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/sleeppc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/sleeppc.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/squeeze.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/squeeze.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/squeezeplayerstatus.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/squeezeplayerstatus.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/_startdaemon.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/_startdaemon.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/domoticz.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/hue.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/hue.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/insteon.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/servers/logcat.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/logcatb.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcatb.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/logcats.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcats.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/squeezebox.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/servers/ssh.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/ssh.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/startdaemon" beforeDir="false" afterPath="$PROJECT_DIR$/servers/startdaemon" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/gradient.css" beforeDir="false" afterPath="$PROJECT_DIR$/style/gradient.css" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/gradient.less" beforeDir="false" afterPath="$PROJECT_DIR$/style/gradient.less" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/style.less" beforeDir="false" afterPath="$PROJECT_DIR$/style/style.less" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/weatherstation.css" beforeDir="false" afterPath="$PROJECT_DIR$/style/weatherstation.css" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/weatherstation.less" beforeDir="false" afterPath="$PROJECT_DIR$/style/weatherstation.less" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1622787397330" duration="3950000" />
       <workItem from="1638959846647" duration="5250000" />
       <workItem from="1638973361360" duration="1389000" />
-      <workItem from="1639125380760" duration="3516000" />
-    </task>
-    <task id="LOCAL-00442" summary=".">
-      <created>1611683302030</created>
-      <option name="number" value="00442" />
-      <option name="presentableId" value="LOCAL-00442" />
-      <option name="project" value="LOCAL" />
-      <updated>1611683302030</updated>
+      <workItem from="1639125380760" duration="5173000" />
     </task>
     <task id="LOCAL-00443" summary=".">
       <created>1611911651461</created>
       <option name="project" value="LOCAL" />
       <updated>1622706612280</updated>
     </task>
-    <option name="localTasksCounter" value="491" />
+    <task id="LOCAL-00491" summary=".">
+      <created>1639181242353</created>
+      <option name="number" value="00491" />
+      <option name="presentableId" value="LOCAL-00491" />
+      <option name="project" value="LOCAL" />
+      <updated>1639181242355</updated>
+    </task>
+    <option name="localTasksCounter" value="492" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 6bf34402847462114ebefbcf0c13e6bce94f516a..198881afbdf41723fb3747877b2aabc15a15ff1e 100644 (file)
@@ -4,7 +4,7 @@ config('ROOM', 'bureau');
 config('SQUEEZEBOX_PLAYER', 'Bureau');
 config('VIDEOPLAYER', 'mediarasp');
 config('VOLUME_DEVICE', 'harmony');
-config('VOLUME_STEP', 2);
+config('VOLUME_STEP', 3);
 config('SLEEPTYPE', 'screensaver');
 config('SCREENSAVER', 'suncurve');
 config('SLEEPSCREEN', 15);
@@ -20,8 +20,8 @@ if (DISPLAYINTERFACE) {
     $c = bureau();
     $shortcuts['lights'] = $c['all'];
     $favoriteslights = [
-        ['type' => 'volume', 'volume' => '3%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-        ['type' => 'volume', 'volume' => '3%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
     ];
     $favoriteslights = array_merge($favoriteslights, $c['favorites']);
 
index 1c8bf1babe450a6e05839bbac488b96b115b8aca..3d14f18dade3e17034a11895c9b255507ef45a13 100644 (file)
@@ -5,28 +5,28 @@ config('SQUEEZEBOX_PLAYER', 'Cave');
 config('SLEEPSCREEN', 30);
 config('SCREENSAVER_BRIGHTNESS', 100);
 config('SLEEPTYPE', 'screensaver');
-config('SCREENSAVER','weatherstation');
+config('SCREENSAVER', 'weatherstation');
 config('VIDEOPLAYER', 'mediarasp-small');
 config('TVPLAYER', 'mediarasp-small');
 config('VOLUME', 60);
 config('VOLUME_DEVICE', 'Squeezebox');
-config('VOLUME_STEP',5);
-config('HIDEMASK_TIMEOUT',250);
-config('THEME','#978270');
+config('VOLUME_STEP', 5);
+config('HIDEMASK_TIMEOUT', 250);
+config('THEME', '#978270');
 
 if (DISPLAYINTERFACE) {
     $c = cave();
     $shortcuts['lights'] = $c['all'];
-    $nav=['home','lights','music','media','remote','switch','settings','alert','off'];
+    $nav = ['home', 'lights', 'music', 'media', 'remote', 'switch', 'settings', 'alert', 'off'];
 
-       include_once ROOT . '/config/music.php';
+    include_once ROOT . '/config/music.php';
 
-       $favoriteslights = [
-               ['type' => 'volume', 'volume' => '5%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-               ['type' => 'volume', 'volume' => '5%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
-       ];
-       $favoriteslights[] = array_merge($allmusics['France Info'], array('volume' => 50));
+    $favoriteslights = [
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+    ];
+    $favoriteslights[] = array_merge($allmusics['France Info'], array('volume' => 50));
     $favoriteslights = array_merge($favoriteslights, $c['favorites']);
-       include "media.php";
-       include "default.php";
+    include "media.php";
+    include "default.php";
 }
\ No newline at end of file
index 101b699993ccda05f3472e9071622d4ae71a296f..4018be093d14964f7ece459e3285ec03b229c046 100644 (file)
@@ -15,8 +15,8 @@ if (DISPLAYINTERFACE) {
     $c = cuisine();
 
     $favoriteslights = [
-        ['type' => 'volume', 'volume' => '5%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-        ['type' => 'volume', 'volume' => '5%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP').'%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP').'%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
     ];
     $favoriteslights = array_merge($favoriteslights, $c['favorites']);
 
index 7ca4681a8eecba0444afb16012e6a537f8a6eb94..5346bdec20efa6efcb0b35ac811b05ca45055ddc 100644 (file)
@@ -18,6 +18,9 @@ define('HOMECONNECT_PASSWORD', 'YcR%vNmYnu%e$3dx2idM');
 define('LATITUDE', 48.8758392);
 define('LONGITUDE', 2.3422104);
 
+define('NAS_ROOT', 'smb://192.168.13.1/1.42.6-25556/');
+define('NAS_PWD_ROOT', 'smb://Share:RQpZHMDLtbc229FQV3@192.168.13.1/1.42.6-25556/');
+
 $squeezeboxPlayers = array(
     'Cave' => 'b8:27:eb:ab:b4:50',
     'Salle de bains' => '9f:e3:5d:6e:15:35',
@@ -35,7 +38,8 @@ $squeezeboxPlayers = array(
     'Lit Vincent' => 'b8:27:eb:40:0e:e9',
     'WC' => 'b8:27:eb:f6:1d:30',
     //'Bureau' => 'cc:cc:2d:2a:b5:35',
-    'Bureau' => '7e:23:f6:33:1d:3b',
+    //'Bureau' => 'd6:12:01:da:63:f9',
+    'Bureau' => '00:04:20:17:82:8b',
 );
 
 
@@ -47,17 +51,17 @@ $phones = [
     ],
     'cuisine' => [
         'ip' => '192.168.13.31',
-        'key' => 'dmGYolpN-k4:APA91bEcMcfkZ0jZViEvyqyVWoT71-vQko9DE0wwg-vzPkZ5-lHwiVJDH38dXfIoWrHWTrtEiMsv-6TrebFR-dNOLhVoVUb3rCsehmLi-Ew17lkP75Yqds3KsWEiyF_yx-i-9dc_4ewV',
+        'key' => 'f1rVkITIwwc:APA91bFMwnvK_H-SvFeAQb2i8jmZw2Vcv0xrt46ejSjwaOLhBo7OVS2CozF79HgxDf3qsTbHRxZ976VW8-9JtxCAjQTqOV6n6UkS7x6oFCLbwlnyQhm5JTGu9171Gt7k_Bi6WFVJ9cFd',
         'password' => '4pyA?Rnyeyc1$44M'
     ],
     'salon' => [
         'ip' => '192.168.13.30',
-        'key' => 'dmGYolpN-k4:APA91bEcMcfkZ0jZViEvyqyVWoT71-vQko9DE0wwg-vzPkZ5-lHwiVJDH38dXfIoWrHWTrtEiMsv-6TrebFR-dNOLhVoVUb3rCsehmLi-Ew17lkP75Yqds3KsWEiyF_yx-i-9dc_4ewV',
+        'key' => 'd9-9VKyjp9c:APA91bGjiqU5rE52O6GvkCSSENWSsTYI9uZPfWofwwDHIivks4dKZJNSa1ixCLXTSg99rtC5Ca5Yv9-J_DG3c8hdDUAa_W7cHCdjLPbKxDTEgvnVBWgm9NLWCKG5KGmd5evkHuA3ZLzO',
         'password' => '4pyA?Rnyeyc1$44M'
     ],
     'sdb' => [
         'ip' => '192.168.13.32',
-        'key' => 'dmGYolpN-k4:APA91bEcMcfkZ0jZViEvyqyVWoT71-vQko9DE0wwg-vzPkZ5-lHwiVJDH38dXfIoWrHWTrtEiMsv-6TrebFR-dNOLhVoVUb3rCsehmLi-Ew17lkP75Yqds3KsWEiyF_yx-i-9dc_4ewV',
+        'key' => 'dcJ4TswVcXA:APA91bETlTCSE4HXOU-KiR2Hr6RdT6VwqsOcYl4XOpA-vLIs_qWT7zu8bRD9w4LXWdBYzn2iVZyGvQlBaU2KReJ62xe-H7oGuT93LbsZN20Az1oUxCgbjgLbcQ4WygEKBtoLa_WuQM1l',
         'password' => '4pyA?Rnyeyc1$44M'
     ]
     //dOQilKX5CVQ:APA91bGOo1g2Hk2p7A4qYNg0wuKjvDeU3quKi6r73ae6rxVqSXmztMIDRn00DOZmXP1q1fBS0hLEd7xZo_Rr3LQMrRIHJpgy0FxnH7G_OV3kxFmGqWu1yOg5tBUEPlEybH_JkjlEgGof
@@ -88,7 +92,7 @@ $devices = [
     'bureausun' => ['id' => 'bureausun', 'host' => '192.168.13.70', 'shield' => '192.168.13.41', 'user' => 'pi', 'password' => 'atacama'],
     'lit' => ['id' => 'lit', 'host' => '192.168.13.69', 'user' => 'pi', 'password' => 'atacama'],
     'sdb' => ['id' => 'sdb', 'shield' => '192.168.13.32'],
-    'avion' => ['id' => 'avion', 'host' => '192.168.13.5', 'user' => 'Tortuga', 'password' => 's77vpo*wu', 'mac' => 'E0:D5:5E:68:67:B9'],
+    'avion' => ['id' => 'avion', 'host' => '192.168.13.5', 'user' => 'Tortuga', 'password' => '8nc4PuwzCScw&^Vi$Fh#&n', 'mac' => 'E0:D5:5E:68:67:B9'],
 ];
 
 // Browse media files on NAS
index 97a1816f45cf67918ad9e48e13511a3fa4fd9887..19a39cf8c97e0bbdd50683c71d65235fdba4996a 100644 (file)
@@ -5,21 +5,21 @@ config('SQUEEZEBOX_PLAYER', 'Salon');
 config('VIDEOPLAYER', 'shield');
 config('TVPLAYER', 'shield');
 config('VOLUME_DEVICE', 'DenonAVR');
-config('VOLUME_STEP',2);
+config('VOLUME_STEP', 2);
 config('VIDEOPLAYER_DEVICE', 'salon');
 config('HIDEMASK_TIMEOUT', 250);
-config('THEME','#d0a25b');
+config('THEME', '#d0a25b');
 config('SLEEPSCREEN', 150);
 config('SCREENSAVER_BRIGHTNESS', 100);
 config('SLEEPTYPE', 'screensaver');
-config('SCREENSAVER','weatherstation');
+config('SCREENSAVER', 'weatherstation');
 
 if (DISPLAYINTERFACE) {
     $c = salon();
     $shortcuts['lights'] = $c['all'];
     $favoriteslights = [
-        ['type' => 'volume', 'volume' => '3%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-        ['type' => 'volume', 'volume' => '3%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
     ];
     $favoriteslights = array_merge($favoriteslights, $c['favorites']);
 
@@ -27,5 +27,5 @@ if (DISPLAYINTERFACE) {
     include "default.php";
     include ROOT . "/config/media.php";
 
-    $nav=['home','lights','music','media','remote','switch','fan','settings','alert','off'];
+    $nav = ['home', 'lights', 'music', 'media', 'remote', 'switch', 'fan', 'settings', 'alert', 'off'];
 }
index 5215fbb5846356c29a73a55a4247ea15961ac1ed..2de3cce186334da6895fb1126196128d0ff31ffb 100644 (file)
@@ -5,28 +5,28 @@ config('SQUEEZEBOX_PLAYER', 'Salle de bains');
 config('SLEEPSCREEN', 30);
 config('SCREENSAVER_BRIGHTNESS', 100);
 config('SLEEPTYPE', 'screensaver');
-config('SCREENSAVER','weatherstation');
+config('SCREENSAVER', 'weatherstation');
 config('VIDEOPLAYER', 'mediarasp-small');
 config('TVPLAYER', 'mediarasp-small');
 config('VOLUME', 60);
 config('VOLUME_DEVICE', 'Squeezebox');
-config('VOLUME_STEP',5);
-config('HIDEMASK_TIMEOUT',250);
-config('THEME','#92475c');
+config('VOLUME_STEP', 3);
+config('HIDEMASK_TIMEOUT', 250);
+config('THEME', '#92475c');
 
 if (DISPLAYINTERFACE) {
     $c = sdb();
     $shortcuts['lights'] = $c['all'];
-    $nav=['home','lights','music','media','remote','switch','settings','alert','off'];
+    $nav = ['home', 'lights', 'music', 'media', 'remote', 'switch', 'settings', 'alert', 'off'];
 
-       include_once ROOT . '/config/music.php';
+    include_once ROOT . '/config/music.php';
 
-       $favoriteslights = [
-               ['type' => 'volume', 'volume' => '5%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-               ['type' => 'volume', 'volume' => '5%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
-       ];
-       $favoriteslights[] = array_merge($allmusics['France Info'], array('volume' => 50));
+    $favoriteslights = [
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+    ];
+    $favoriteslights[] = array_merge($allmusics['France Info'], array('volume' => 50));
     $favoriteslights = array_merge($favoriteslights, $c['favorites']);
-       include "media.php";
-       include "default.php";
+    include "media.php";
+    include "default.php";
 }
\ No newline at end of file
index cfd1046e4c7959474443b6f9f7653e828111e0dd..278403caa48dd800a58e3f2c8cf7bf30a8f1b64b 100644 (file)
@@ -13,8 +13,8 @@ $rebootdevices = ['entree' => 'Entrée',
     'sdb' => 'Salle de bains'];
 
 $shortcuts['settings'] = [
-    ['type' => 'volume', 'volume' => '10%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-    ['type' => 'volume', 'volume' => '10%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+    ['type' => 'volume', 'volume' => config('VOLUME_STEP').'%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+    ['type' => 'volume', 'volume' => config('VOLUME_STEP').'%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
     ['type' => 'action', 'action' => 'screen-off', 'label' => 'écran off'],
     ['type' => 'action', 'action' => 'sound-off', 'label' => 'sound off'],
     ['type' => 'action', 'action' => 'close', 'label' => 'Fermer'],
index 58bc543d30490ace6e124720d3e95ea0a80774c4..12340a02f8c1c3a630be2a2b42dfc0df093e2b95 100644 (file)
@@ -3,20 +3,20 @@ config('ROOM_NAME', 'WC');
 config('ROOM', 'wc');
 config('SQUEEZEBOX_PLAYER', 'WC');
 config('VOLUME', 60);
-config('VOLUME_STEP',5);
+config('VOLUME_STEP', 5);
 config('VOLUME_DEVICE', 'SqueezeboxPlayer');
-config('HIDEMASK_TIMEOUT',250);
+config('HIDEMASK_TIMEOUT', 250);
 
 if (DISPLAYINTERFACE) {
     $c = wc();
     $shortcuts['lights'] = $c['all'];
-    $nav=['home','lights','music','remote','switch','settings','alert','off'];
+    $nav = ['home', 'lights', 'music', 'remote', 'switch', 'settings', 'alert', 'off'];
 
     include_once ROOT . '/config/music.php';
 
     $favoriteslights = [
-        ['type' => 'volume', 'volume' => '5%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-        ['type' => 'volume', 'volume' => '5%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
     ];
     $favoriteslights = array_merge($favoriteslights, $c['favorites']);
     include "media.php";
diff --git a/images/earth.png b/images/earth.png
new file mode 100644 (file)
index 0000000..7f089f6
Binary files /dev/null and b/images/earth.png differ
diff --git a/images/suncurve.png b/images/suncurve.png
new file mode 100644 (file)
index 0000000..c188847
Binary files /dev/null and b/images/suncurve.png differ
index 330ababcc95af1c96f4e350c1347e3c3496377de..061d79c4057e04d1d50e65cb6545e992c32ad0ff 100644 (file)
@@ -527,7 +527,7 @@ function screenOff() {
     if (lastOffScreen < Date.now() - 30000) {
         lastOffScreen = Date.now();
         if (androidApp) {
-            phonetask('screenoff');
+            //phonetask('screenoff');
         } else {
             sshCommand('/usr/local/bin/screenoff');
         }
@@ -548,7 +548,7 @@ function screenOn(hidescreensaver) {
         hidescreensaver = true;
     }
     if (androidApp) {
-        phonetask('screenon');
+        //phonetask('screenon');
     } else {
         sshCommand('/usr/local/bin/screenon');
     }
index 69440af7b480daef5bf3cc153030eb232bb6a0b8..56f6a0a15314d864c361d7416fac492ae5d28f4d 100644 (file)
@@ -1 +1 @@
-4mC9Si6L2UFREW9CAyAgcrsH5stP8Qk/TEk6rCAIzzSrp2G2C872NKdz3RC5VWiA
\ No newline at end of file
+afcd7pJHR6fef3QNlBUysKWSpr5Axe1pTKa7+p9YGjYwGKYBP87xcnYE/hV+FYCb
\ No newline at end of file
index 239b97d4dfbde7466904053b92d5e52c9f673573..ac1ddd3127a6917bc346698b9d07d3f9041416cc 100644 (file)
@@ -11,6 +11,7 @@ function cronOneLoop($cronmin)
     cronRooms($cronmin);
     //cronInsteon($cronmin);
     cronWeather($cronmin);
+    cronMagnet($cronmin);
 
     if ($cronmin % 5 == 0) {
         cronTraffic($cronmin, false);
@@ -53,6 +54,12 @@ function cronOneLoop($cronmin)
     _logSection('End Loop (min:' . $cronmin . ')');
 }
 
+function cronMagnet($cronmin)
+{
+    _logSection('Magnet links');
+    file_get_contents("https://entree.home.tortuga.enhydra.fr/scripts/freeboxapi.php?action=magnets");
+}
+
 function cronXPlanet($cronmin)
 {
     _logSection('XPlanet');
@@ -119,16 +126,21 @@ function cronRooms($cronmin)
 {
     _logSection('Rooms');
     if (getState('bureauAutoMode') == '1') {
+        _logSection('Bureau');
         updateBureauAuto();
     }
     if (getState('chambreAutoMode') == '1') {
+        _logSection('Chambre');
         updateChambreAuto();
     }
     if (getState('courAutoMode') == '1') {
+        _logSection('Cour');
         updateCourAuto();
     }
+    _logSection('Planetarium');
     checkPlanetarium();
     if ($cronmin % 2) {
+        _logSection('WC VMC');
         checkWCVMC();
     }
 }
@@ -177,7 +189,7 @@ function cronPing($cronmin)
 {
     _logSection('Pings');
     global $devices;
-    setState('vincenthere', ping('192.168.13.31', 5) ? '1' : '0');
+    setState('vincenthere', ping('192.168.13.20', 5) ? '1' : '0');
     setState('hasnetwork', ping('1.1.1.1', 3, 443) ? '1' : '0');
     foreach ($devices as $name => $device) {
         $result = ping($device['host'], 3, 22) ? '1' : '0';
@@ -203,15 +215,6 @@ function cronSqueezeFavorites($cronmin)
 function cronSqueezeCheckPlayers($cronmin)
 {
     _logSection('Check squeezebox players');
-//    $players = ['Salon' => 'salon', 'Bureau' => 'bureau'];
-//    foreach ($players as $player => $device) {
-//        if (getSqueezePlayerStatus($player) === -1) {
-//            if (!shieldPlayingVideo($device)) {
-//                shieldRunAppAndBackHome('sbplayer', $device, 1, true);
-//                sleep(5);
-//            }
-//        }
-//    }
 }
 
 function cronWeather($cronmin)
@@ -249,6 +252,8 @@ function cronWeather($cronmin)
     $res['wc_humidity'] = toNumber(getDomoticzDeviceStatus(1502), true);
     $res['office_temp'] = toNumber(getDomoticzDeviceStatus(1496), 1);
     $res['office_humidity'] = toNumber(getDomoticzDeviceStatus(1497), true);
+    $res['cellar_humidity'] = toNumber(getDomoticzDeviceStatus(4818), true);
+    $res['cellar_temp'] = toNumber(getDomoticzDeviceStatus(4817), 1);
     $res['pressure'] = round($weather['Pressure']['Metric']['Value']);
     $res['pressureTendency'] = $weather['PressureTendency']['Code'];
     $res['precipitations24'] = round($weather['PrecipitationSummary']['Past24Hours']['Metric']['Value']);
index 8232b8123df65bd67eb3621d967ec91401ba154e..5324b71eb8f42ccf90b67cd0d8ed3e3a082f493f 100644 (file)
@@ -3,23 +3,24 @@
 define('TIMELIMIT', 1);
 $_GET['im'] = '5';
 
-$wcSwitch = 6448;
-
-if ($_GET['device'] == 1033 || $_GET['device'] == 1476 || $_GET['device'] == 1478) {
+if ($_GET['device'] == 4680 || $_GET['device'] == 1476 || $_GET['device'] == 1478 || $_GET['device'] == 4955) {
     $forceConfig = 'salon';
 }
-if ($_GET['device'] == $wcSwitch) {
+if ($_GET['device'] == 1695) {
     $forceConfig = 'wc';
 }
-if ($_GET['device'] == 1478) {
+if ($_GET['device'] == 4600) {
     $forceConfig = 'bureau';
 }
+if ($_GET['device'] == 4711) {
+    $forceConfig = 'sdb';
+}
 
 require_once "import.php";
 
 if ($_GET['device'] == 480) {
     chambreToggle();
-} else if ($_GET['device'] == 1033 || $_GET['device'] == 1476) {
+} else if ($_GET['device'] == 4680 || $_GET['device'] == 1476 || $_GET['device'] == 1478 || $_GET['device'] == 4955) {
     // Cube
     switch ($_GET['state']) {
         case 'Shake':
@@ -52,9 +53,9 @@ if ($_GET['device'] == 480) {
     }
 } else if ($_GET['device'] == 1451) {
     domoticzSwitch(1450);
-} else if ($_GET['device'] == $wcSwitch) {
+} else if ($_GET['device'] == 1695) {
     $forceConfig = 'wc';
-    switch (str_replace(' ', '_', $_GET['state'])) {
+    switch ($_GET['state']) {
         case 'Double_Click':
             execScene('wc/spa');
             setState('wc', 1);
@@ -67,7 +68,7 @@ if ($_GET['device'] == 480) {
             wcToggle();
             break;
     }
-} else if ($_GET['device'] == 1478) {
+} else if ($_GET['device'] == 4600) {
     // Cube bureau
     switch ($_GET['state']) {
         case 'Shake':
@@ -77,7 +78,7 @@ if ($_GET['device'] == 480) {
             execScene('bureau/rideaux/toggle');
             break;
         case 'Flip_180':
-            execScene('bureau/auto');
+            execScene('bureau/fan/toggle');
             break;
         case 'Free_Fall':
             execScene('bureau/off');
@@ -92,14 +93,49 @@ if ($_GET['device'] == 480) {
             }
             break;
         case 'Clock_Wise':
-            volume(config('VOLUME_STEP'), '+');
+            volume(config('VOLUME_STEP'), '+',);
             break;
         case 'Anti_Clock_Wise':
             volume(config('VOLUME_STEP'), '-');
             break;
         case 'Tap':
             harmonyActivity('musique');
-            squeezePlayByName('FIP', 'Bureau');
+            $lastTap = getState('bureau_squeeze_tap', 0);
+            $musics = ['FIP', 'Samba'];
+            $i = ($lastTap + 1) % count($musics);
+            setState('bureau_squeeze_tap', $i);
+            squeezePlayByName($musics[$i], 'Bureau');
+            break;
+        case 'Alert':
+        default:
+            break;
+    }
+} else if ($_GET['device'] == 4711) {
+    // Cube SDB
+    switch ($_GET['state']) {
+        case 'Shake':
+            execScene('home/alert');
+            break;
+        case 'Flip_90':
+            execScene('sdb/off');
+            break;
+        case 'Flip_180':
+            execScene('sdb/on');
+            break;
+        case 'Free_Fall':
+            off('sdb');
+            break;
+        case 'Move':
+            //_remoteCmd('pause', 'salon');
+            break;
+        case 'Clock_Wise':
+            volume(config('VOLUME_STEP'), '+');
+            break;
+        case 'Anti_Clock_Wise':
+            volume(config('VOLUME_STEP'), '-');
+            break;
+        case 'Tap':
+            squeezePlayByName('FIP', $squeezeboxPlayers['Salle de bains']);
             break;
         case 'Alert':
         default:
index 222bc2a8548ad3b395b27561bee5564617dd85dc..8e59944e19244c10953b2859b438e764b7d3bb22 100644 (file)
@@ -1,4 +1,5 @@
 <?php
 require_once "import.php";
 
-print_r(getDomoticzDeviceStatus($_GET['device']));
\ No newline at end of file
+ob_end_clean();
+echo ":::".getDomoticzDeviceStatus($_GET['device']);
\ No newline at end of file
index 2cc4c9dcc3cd7468c698048e1093d6b546f690db..baa2c3c11186181f0719c203e85af64087c9c7b3 100644 (file)
@@ -1,7 +1,10 @@
 <?php
 require_once "import.php";
-
 if ($_GET['action'] == 'resetWifi') {
     freeboxResetWifi();
     netgearWifiExtReboot();
+} else if ($_GET['action'] == 'auth') {
+    die(freeboxAuthorizeApp());
+} else if ($_GET['action'] === 'magnets') {
+    freeboxWatchMagnets();
 }
\ No newline at end of file
index 5775aaa3c2e6d878d96abb066d2188db86cd2724..e4dfcd97ff60dfad6ec849b79b979c6e0ea0b7d2 100644 (file)
@@ -91,7 +91,9 @@ if ($type == 'gradient' && (!is_array($res) || !count($res))) {
 if ($type == 'youtube') {
     $res['video_path'] = downloadYoutubeDL('https://www.youtube.com/watch?v=' . $res['videoid'], 0, false, 'webm');
 }
+
 header('Content-type: application/json');
-$r = ['type' => $type, 'data' => $res];
+$r = ['c' => $c, 'type' => $type, 'data' => $res];
+$r['paused'] = inWinsowsList('192.168.13.4', 'avion', 1);
 
 die(json_encode($r));
\ No newline at end of file
index d30b8ad4eab6d942f69b66a01aa45efdb1e19ec9..c3a4e6b9a0a3f419258ae612e4f68257dea433df 100644 (file)
@@ -8,6 +8,7 @@ if(defined('TIMELIMIT')){
 }
 
 if (isset($_GET['delay'])) {
+    ignore_user_abort(true);
        set_time_limit($_GET['delay'] + 30);
        sleep($_GET['delay']);
 }
index 9cd45e1d2260c7f31f36987ee80e44a79a69f150..e085c4050f6cec9c346c6316812f316f609ad84b 100644 (file)
@@ -14,6 +14,7 @@ function denon($on = false)
 function denonAVRVolume($volume, $increase = '')
 {
     $current = denonAVRGetVolume();
+    echo '::' . $current . '::';
     if ($increase === '+' || $increase === '-') {
         if ($increase === '+') {
             $volume += $current;
@@ -23,6 +24,9 @@ function denonAVRVolume($volume, $increase = '')
     }
     $volume = min(80, max(0, round($volume)));
     if ($volume !== $current) {
+        if ($volume < 10) {
+            $volume = '0' . $volume;
+        }
         echo _denonTelnet('MV' . $volume);
     }
     return $current . '->' . $volume;
@@ -74,6 +78,10 @@ function denonAVRInput($input, $setvolume = false)
 function denonAVRGetVolume()
 {
     $res = _denonTelnet('MV?');
+    if (stristr($res, 'MVMAX')) {
+        return denonAVRGetVolume();
+    }
+    echo '//' . $res . '//';
     $res = substr($res, 2);
     if ($res > 100) {
         $res /= 10;
@@ -125,30 +133,40 @@ function denonAVRGetPowerState()
 
 function _denonTelnet($cmd)
 {
+
     $client = getDenonTelnetClient();
+    profile('got denon telnet client for ' . $cmd);
+
     $res = $client->execute($cmd);
     if ($res->isError()) {
         return false;
     }
+    profile('Denon telnet ' . $cmd);
     return trim($res->getResponseText());
 }
 
 function denonAVROff()
 {
-    _denonTelnet('ZMOFF');
-    _denonTelnet('Z2OFF');
-    _denonTelnet('PWSTANDBY');
+    profile('Denon AVR OFF');
+
+    if (denonAVRGetPowerState()) {
+        _denonTelnet('ZMOFF');
+    }
+    //_denonTelnet('Z2OFF');
+    //_denonTelnet('PWSTANDBY');
 }
 
 function epson($on = true, $force = false)
 {
+    profile('Epson ' . $on);
+
     $currentState = getState('EpsonPowerState', '0') === '1';
     if (!$force && $currentState === $on) {
         return;
     }
     $cmd = $on ? 'PowerOn' : 'PowerOff';
     echo 'Epson ' . $cmd . "\n";
-    sshCommand('/usr/local/bin/ir Epson ' . $cmd, 'salon');
+    sshCommand('/usr/local/bin/ir Epson ' . $cmd, 'salon', false, true);
     setState('EpsonPowerState', $on ? '1' : '0');
     if ($currentState !== $on && $on) {
         sleep(30);
@@ -160,10 +178,10 @@ function epson($on = true, $force = false)
  */
 function getDenonTelnetClient()
 {
-    global $denonTelnetClient;
-    if (!isset($denonTelnetClient)) {
-        $denonTelnetClient = Graze\TelnetClient\TelnetClient::factory();
-        $denonTelnetClient->connect('192.168.13.42:23', '', '', "\r", 2);
-    }
+    /** @var Graze\TelnetClient\TelnetClient $denonTelnetClient */
+    $denonTelnetClient = Graze\TelnetClient\TelnetClient::factory();
+    $denonTelnetClient->connect('192.168.13.42:23', '', '', "\r", 2);
+    $denonTelnetClient->setReadTimeout(2);
+
     return $denonTelnetClient;
 }
\ No newline at end of file
index f8548ca2f5a0ba8c97a7406869eab0c926be0c33..5599e5279ccacba9438f120b6ca391d3c52c0338 100644 (file)
@@ -41,6 +41,7 @@ function domoticzGetLevel($device)
 
 function domoticzCmd($command, $priority = false)
 {
+
     $redis = connectRedis();
     $queue_name = 'domoticz_queue';
 
@@ -63,7 +64,6 @@ function getDomoticzDeviceStatus($device, $force = false, $key = 'Data')
     //echo ':)';
     $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
     $res = json_decode($res->getBody(), true);
-   // print_r($res);
     try {
         $update = new DateTime($res['result'][0]['LastUpdate']);
         $now = new DateTime();
index e13e8e18b2104db8bebf008b397f47ca10b67e75..2d671c3e27871b1c0bab092f8c3593db3f9152a4 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 function updateFlowerPower()
 {
-    $device = getState('device_bureausun_awake') ? 'bureausun' : 'cerveau';
+    $device = getState('device_salon_awake') ? 'salon' : 'bureausun';
     $res = sshRunCommand('timeout -k 10 1m /usr/local/bin/flowerpower', $device, true, true);
     $fp = explode("\n", $res['output']);
     $map = [1 => 1467, 0 => 1468];
index e99a28de430f1867cabe9aca27acd5165c7a5dd6..c088c11fd2ccc23d6fb0f0c2e3f9fe128ec66eaf 100644 (file)
@@ -1,50 +1,26 @@
 <?php
 
-function freeboxChannel($channel)
-{
-    if (config('DEVICE') === 'bureau') {
-        $currentActivity = getCurrentHarmonyActivity();
-        harmonyActivity('tv');
-    }
-    if ($channel === 'replay') {
-        $commands = ['right', 'ok', 'pause=5', 'down', 'down', 'down', 'down', 'down'];
-    } elseif ($channel === 'netflix') {
-        $commands = ['right', 'down', 'down', 'down', 'ok', 'pause=25', 'ok', 'pause=5', 'down'];
-    } else {
-        $commands = array_merge(['ok', 'pause=5'], str_split((string)$channel));
-    }
-    $keys = array_merge(array('home', 'pause=2', 'home', 'pause=1', 'home', 'left', 'right', 'home'), $commands);
+use alphayax\freebox\utils\rest\RestAuth;
 
-    if (config('DEVICE') === 'bureau') {
-        if ($currentActivity != 'tv') {
-            sleep(50);
-        }
-    }
-    print_r($keys);
-    freeboxKey($keys);
-}
+const FREEBOX_APP_ID = 'fr.enhydra.tortuga.home';
+const FREEBOX_APP_NAME = 'Tortuga Home';
+const FREEBOX_APP_VERSION = '0.0.2';
 
-function freeboxKey($keys, $long = false)
+function freeboxAuthorizeApp()
 {
-    foreach ($keys as $key) {
-        if (strpos($key, 'pause=') === 0) {
-            $e = explode('pause=', $key, 2);
-            $p = intval($e[1]);
-            echo 'wait ' . $p . 's' . '<br>';
-            sleep($p);
-            continue;
-        }
-        echo $key . "<br>";
-        httpRequest('http://192.168.13.2/pub/remote_control', 'GET', ['code' => '42472024', 'key' => $key]);
-    }
+    unlink('app_token');
+    $freeboxAPI = new \alphayax\freebox\utils\Application(FREEBOX_APP_ID, FREEBOX_APP_NAME, FREEBOX_APP_VERSION);
+    $freeboxAPI->authorize();
+    $freeboxAPI->openSession();
+    return $freeboxAPI->getAppToken();
 }
 
 function getFreeboxAPIInstance()
 {
     global $freeboxAPI;
     if (!isset($freeboxAPI)) {
-        $freeboxAPI = new \alphayax\freebox\utils\Application('tortuga.home', 'Tortuga home', '0.0.1');
-        $freeboxAPI->setAppToken('4mC9Si6L2UFREW9CAyAgcrsH5stP8Qk/TEk6rCAIzzSrp2G2C872NKdz3RC5VWiA');
+        $freeboxAPI = new \alphayax\freebox\utils\Application(FREEBOX_APP_ID, FREEBOX_APP_NAME, FREEBOX_APP_VERSION);
+        $freeboxAPI->setAppToken('afcd7pJHR6fef3QNlBUysKWSpr5Axe1pTKa7+p9YGjYwGKYBP87xcnYE/hV+FYCb');
         $freeboxAPI->openSession();
     }
     return $freeboxAPI;
@@ -59,4 +35,40 @@ function freeboxResetWifi()
 
     sleep(5);
     $wifi->setConfiguration(new \alphayax\freebox\api\v3\models\WiFi\GlobalConfig(['enabled' => true]));
+}
+
+function freeboxAddMagnet($url)
+{
+    echo $url;
+    $download = new alphayax\freebox\api\v3\services\download\Download(getFreeboxAPIInstance());
+    $download->addFromUrl($url);
+}
+
+function freeboxWOL($mac, $password = '')
+{
+    $freebox = getFreeboxAPIInstance();
+    $rest = new RestAuth($freebox->getFreeboxApiHost() . '/api/v4/lan/wol/pub/');
+    $rest->setSessionToken($freebox->getSessionToken());
+    $rest->POST(['mac' => $mac, 'password' => $password]);
+}
+
+function freeboxWatchMagnets()
+{
+    $dir = '/nas/Téléchargements/Watch';
+    $dr = opendir($dir);
+    while ($f = readdir($dr)) {
+        if ($f == '.' || $f == '..' || !stristr($f, '.magnet')) {
+            continue;
+        }
+        try {
+            $file = $dir . '/' . $f;
+            freeboxAddMagnet(file_get_contents($file));
+            unlink($file);
+        } catch (Exception $e) {
+            if (stristr($e->getMessage(), '(exists)')) {
+                unlink($file);
+            }
+            echo $e->getMessage();
+        }
+    }
 }
\ No newline at end of file
index 81b5eb953dbd78e431ea641319bcffa74fb5db57..66926c2e6eeba98e50fb21af57c701cd75b720b7 100644 (file)
@@ -5,8 +5,7 @@ function harmonyRequest($uri, $method = 'GET', $hub = 'bureau')
 {
     global $harmonyClient;
 
-    $ip = '192.168.13.7';
-
+    $ip = 'harmonyapi.home.tortuga.enhydra.fr';
     $uri = 'http://' . $ip . ':8282/hubs/' . $hub . '/' . ltrim($uri, '/');
 
     if (null == $harmonyClient) {
@@ -43,7 +42,7 @@ function harmonyActivity($activity)
     if ($activity !== 'off' && $activity !== 'poweroff') {
         ecoMode('0');
     }
-    if ($activity === 'musique' || $activity === 'tv') {
+    if ($activity === 'tv') {
         shieldWakeup('bureau');
     }
     $res = harmonyRequest('activities/' . $activity, 'POST');
index 9548190653a83280f6c822807435b2fd0a6c7472..6fb42c7fe6ae2a8c8a34312f3c44ccb5d61e07a4 100644 (file)
@@ -62,6 +62,5 @@ function httpRequest($url, $method = 'get', $data = [], $auth = null, $timeout =
     $options['headers'] = $headers;
     $res= $client->request($method, $url, $options);
 
-    print_r($res);
     return $res;
 }
\ No newline at end of file
index 5d005834c34cc691d3746365733c47c4be680e35..c20ac36bf753a9234f679e969c8d25e9ea209f14 100644 (file)
@@ -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 = null)
 {
     $redis = connectRedis();
     $queue = $redis->igbget('hue_queue');
index f211d52fe6faabb0ae74becf8cb537c3d2908fcf..4290178efd7f6252e79b4f41ca8e84a17cc2959f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 $kodiClients = [];
-$kodiIP = ['salon' => '192.168.13.40', 'bureau' => '192.168.13.41', 'avion' => '192.168.13.5', 'cuisine' => '192.168.13.32'];
+$kodiIP = ['salon' => '192.168.13.40', 'bureau' => '192.168.13.41', 'avion' => '192.168.13.5', 'cuisine' => '192.168.13.31', 'sdb' => '192.168.13.32'];
 $_tvshowallstatus = null;
 $_koditotmdb = null;
 
@@ -9,7 +9,7 @@ function getKodiDBConnection()
     return mysqli_connect('kodidb.home.tortuga.enhydra.fr', "kodi", "atacama", "MyVideos119");
 }
 
-function kodiGetAllKodiToTmdb($force=false)
+function kodiGetAllKodiToTmdb($force = false)
 {
     global $_koditotmdb;
     if ($force || null === $_koditotmdb) {
@@ -32,7 +32,7 @@ function kodiGetAllKodiToTmdb($force=false)
     return $_koditotmdb;
 }
 
-function kodiGetTVShowAllStatus($force=false)
+function kodiGetTVShowAllStatus($force = false)
 {
     global $_tvshowallstatus;
 
@@ -99,16 +99,30 @@ function kodiSyncPlayedStatus()
     $seen = connectRedis()->igbget('mediaseen');
     $seenChanged = false;
 
+    $useen = [];
+
+    foreach ($seen as $item => $true) {
+        $useen[_normalizeSeenFile($item)] = true;
+    }
+
+    connectRedis()->igbset('mediaseen', $useen);
+    $seen = $useen;
+
     $result = mysqli_query($con, 'SELECT * FROM path');
     $paths = [];
     while ($path = $result->fetch_assoc()) {
-        $paths[$path['idPath']] = str_replace('nfs://192.168.13.3/', '/', $path['strPath']);
+        $p = _normalizeSeenFile($path['strPath']);
+
+        $paths[$path['idPath']] = $p;
     }
 
     $result = mysqli_query($con, 'SELECT * FROM files');
     $files = [];
     $playCounts = [];
     while ($file = $result->fetch_assoc()) {
+        if (!isset($paths[$file['idPath']])) {
+            continue;
+        }
         $filename = $paths[$file['idPath']] . $file['strFilename'];
         $files[$filename] = $file['idFile'];
         $playCounts[$filename] = $file['playCount'];
@@ -142,6 +156,17 @@ function kodiSyncPlayedStatus()
     }
 }
 
+function _normalizeSeenFile($p)
+{
+    $p = str_replace('nfs://192.168.13.3/', '/', $p);
+    $p = str_replace(NAS_ROOT, '/volume1/Share/', $p);
+    $p = str_replace(NAS_PWD_ROOT, '/volume1/Share/', $p);
+    $p = str_replace('smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share//', '/volume1/Share/', $p);
+    $p = str_replace('smb://nas.home.tortuga.enhydra.fr/1.42.6-25556/', '/volume1/Share/', $p);
+    $p = str_replace('.x264.', '.', $p);
+    return $p;
+}
+
 function tmdbToKodiId($tmdbId, $type = 'tvshow')
 {
     $result = mysqli_query(getKodiDBConnection(), 'SELECT `media_id` FROM `uniqueid` WHERE `value`="' . $tmdbId . '" AND `type`="tmdb"');
index 0fd8a87fb7dc6c8f7b72633071bffeb2d6fa4c84..a529cbd80070e35fec5d1ffac86f1da3d724ce72 100644 (file)
@@ -48,6 +48,7 @@ require_once ROOT . '/scripts/lib/shield.php';
 require_once ROOT . '/scripts/lib/kodi.php';
 require_once ROOT . '/scripts/lib/climacell.php';
 require_once ROOT . '/scripts/lib/homeconnect.php';
+require_once ROOT . '/scripts/lib/wol.php';
 
 
 profile('Loaded libraries', __FILE__, __LINE__);
@@ -72,6 +73,9 @@ function shutdown()
 function getCurrentConfig()
 {
     global $forceConfig;
+
+    $ips = ['192.168.13.31' => 'cuisine', '192.168.13.30' => 'salon', '192.168.13.32' => 'sdb'];
+
     if (!isset($forceConfig) && isset($_SERVER['HTTP_HOST']) && stristr($_SERVER['HTTP_HOST'], '.home.tortuga.enhydra.fr')) {
         $e = explode('.', $_SERVER['HTTP_HOST']);
         $_GET['c'] = array_shift($e);
@@ -83,15 +87,23 @@ function getCurrentConfig()
 
     $expires = time() + 60 * 60 * 24 * 30;
     if (isset($_GET['c'])) {
-        setcookie('homeconfig', $_GET['c'], $expires, '/', 'enhydra.fr');
+        if (!headers_sent()) {
+            setcookie('homeconfig', $_GET['c'], $expires, '/', 'enhydra.fr');
+        }
         $_COOKIE['homeconfig'] = $_GET['c'];
     }
 
     if (!isset($_COOKIE['homeconfig'])) {
+
+        if (isset($ips[$_SERVER['REMOTE_ADDR']])) {
+            $c = $ips[$_SERVER['REMOTE_ADDR']];
+        } else {
+            $c = 'salon';
+        }
         if (!headers_sent()) {
-            setcookie('homeconfig', 'salon', $expires, '/', 'enhydra.fr');
+            setcookie('homeconfig', $c, $expires, '/', 'enhydra.fr');
         }
-        $_COOKIE['homeconfig'] = 'salon';
+        $_COOKIE['homeconfig'] = $c;
     }
     return $_COOKIE['homeconfig'];
 }
@@ -439,7 +451,7 @@ function ping($ip, $timeout = 5, $port = 1817)
 function volume($volume, $increase = '', $device = null)
 {
     $d = $device === null ? config('VOLUME_DEVICE') : $device;
-    echo $d.';'.$volume.';'.$increase;
+    echo $d . ';' . $volume . ';' . $increase;
 
     if ($increase == ' ') {
         $increase = '+';
@@ -469,7 +481,7 @@ function volume($volume, $increase = '', $device = null)
         case 'squeezebox':
             return squeezeVolume($volume, $increase, config('SQUEEZEBOX_PLAYER'));
         case 'harmony':
-            $lastHarmonyVolume = getState('last_harmony_volume', 0);
+            $lastHarmonyVolume = min(time(), getState('last_harmony_volume', 0));
             $limit = time() - 2;
             if ($lastHarmonyVolume > $limit) {
                 return;
@@ -486,11 +498,11 @@ function volume($volume, $increase = '', $device = null)
         case 'vlc':
             return VLCCmd(['command' => 'volume', 'val' => $increase . '20'], $device);
         case 'denonavr':
-            return denonAVRVolume($volume,$increase);
+            return denonAVRVolume($volume, $increase);
     }
 }
 
-function phoneTask($task, $phone, $encode = false)
+function phoneTask($task, $phone, $encode = true)
 {
     global $phones;
     $p = $phones[$phone];
@@ -595,7 +607,7 @@ function makeNav($nav)
         'music' => '<div data-menu="music"><i class="fa fa-music" aria-hidden="true"></i><span>Musique & Radio</span></div>',
         'media' => '<div data-menu="media"><i class="fa fa-tv-retro" aria-hidden="true"></i><span>Medias & TV</span></div>',
         'coffee' => '<div data-menu="coffee"><i class="fa fa-oven" aria-hidden="true"></i><span>Cuisine / Café</span></div>',
-        'fan' => '<a href="/scripts/light.php?scene='.config('ROOM').'/fan/toggle" class="ajax"><i class="fa fa-fan" aria-hidden="true"></i><span>Ventilateur</span></a>',
+        'fan' => '<a href="/scripts/light.php?scene=' . config('ROOM') . '/fan/toggle" class="ajax"><i class="fa fa-fan" aria-hidden="true"></i><span>Ventilateur</span></a>',
         'remote' => '<div data-menu="remote"><i class="fa fa-play" aria-hidden="true"></i><span>Télécommande</span></div>',
         'switch' => '<div data-menu="switch"><i class="far fa-portal-enter" aria-hidden="true"></i><span>Changer de pièce</span></div>',
         'clock' => '<div data-menu="clock"><i class="far fa-alarm-clock" aria-hidden="true"></i><span>Réveil</span></div>',
index 2b42cd6cd047b322ff3cf0899b4585324f6e5a0e..5913a8b59973b6dd482037e66ea7263df761dc86 100644 (file)
@@ -147,6 +147,8 @@ function remoteCmdMedia($cmd, $device = null, $playing = null)
         $device = config('DEVICE');
     }
 
+    profile('remote cmd ' . $cmd . ' on ' . $device);
+
     $map = ['play' => 'pl_pause',
         'pause' => 'pl_pause',
         'stop' => 'pl_stop',
@@ -251,9 +253,9 @@ function remoteCmdSalonMusique($cmd)
 
 function mediaRaspPlayMovie($movie, $device = null)
 {
-    stopPlayersIn($device);
     setPlaying('mediarasp:' . $movie, $device);
-    mediaRaspCommons($device);
+
+    profile('mediaRaspPlayMovie ' . $movie, __FILE__, __LINE__);
 
     $m = explode('.', $movie);
     $ext = array_pop($m);
@@ -263,25 +265,9 @@ function mediaRaspPlayMovie($movie, $device = null)
         $x264 = true;
     }
     $base = implode('.', $m);
-    $final = $base . '.srt';
-    $srt = [$final, $base . '.fr.srt', $base . '.en.srt'];
-
-    foreach ($srt as $srtfile) {
-        if (file_exists($srtfile)) {
-            $srtcontent = cleanUpSubtitle(file_get_contents($srtfile));
-
-            file_put_contents($final, $srtcontent);
-
-            if ($x264) {
-                copy($final, $base . '.x264.srt');
-            }
-            break;
-        }
-    }
 
     addSeen($movie);
     $res = VLCPlay($movie, $device);
-    mediaRaspPostPlay($device);
 
     setPlaying('mediarasp:' . $movie, $device);
     return $res;
@@ -330,20 +316,11 @@ function mediaRaspCommons($device)
     }
 }
 
-function mediaRaspPostPlay($device)
-{
-    $rasps = ['entree', 'bureausun', 'litvincent', 'litjerome', 'sdb'];
-    if (in_array($device, $rasps)) {
-
-    }
-}
-
 function mediaRaspPlayStream($url, $device = null)
 {
     setPlaying('mediarasp:' . $url, $device);
     mediaRaspCommons($device);
     $res = VLCPlay($url, $device);
-    mediaRaspPostPlay($device);
     setPlaying('mediarasp:' . $url, $device);
     mediaRaspCommons($device);
     return $res;
@@ -367,7 +344,6 @@ function mediaRaspPlayCast($castURL, $device = null)
     $dest = downloadYoutubeDL($castURL, $height, true, 'mkv');
     getYoutubeDLMeta($castURL);
     $res = VLCPlay($dest, $device);
-    mediaRaspPostPlay($device);
     setPlaying('mediarasp:cast:' . $castURL);
     return $res;
 }
index 6fb734c925658f234ef111d5c86675b6f7d2245f..6a446153f93b669263c94ae35172f2b1d4d4b7f0 100644 (file)
@@ -5,6 +5,7 @@ function off($device = null)
     if (null === $device) {
         $device = config('DEVICE');
     }
+    profile('OFF ' . $device);
     commonOff($device);
     if ($device == 'bureau' || $device == 'bureausun') {
         offBureau();
index ce2a07ebc1110c441a922e48f1c42e31d6fef2c3..6fe04faa7fcc8887e52ecf69c2316d6c0d1c5d2c 100644 (file)
@@ -4,21 +4,25 @@ function wakeupPC($device)
     global $devices;
 
     $s = 'device_' . $device . '_awake';
-    $ip = $devices[$device]['host'];
-    $mac = $devices[$device]['mac'];
-    `wakeonlan -i $ip $mac`;
 
-    if (getState($s) === '1') {
-        return;
+    wol($device);
+
+    if (getState($s) == '0') {
+        sleep(10);
     }
 
     setState($s, '1');
-    sleep(10);
-    sshCommand('"C:\Program Files\Scripts\wakeup.bat"', $device, false);
+    sshCommand('"C:\Program Files\Scripts\wakeup.bat"', $device, false, false);
     setState($s, '1');
 }
 
-function sleepPC($device,$force=false)
+function shutdownPC($device, $force = false, $blocking = false)
+{
+    return sleepPC($device, $force, $blocking, 'shutdown');
+}
+
+
+function sleepPC($device, $force = false, $blocking = false, $action = 'sleep')
 {
     $s = 'device_' . $device . '_awake';
     if (!$force && getState($s) == '0') {
@@ -26,12 +30,35 @@ function sleepPC($device,$force=false)
         return;
     }
     setState($s, '0');
-    $res = sshCommand('"C:\Program Files\Scripts\sleep.bat"', $device, true,true);
+    $cmd = "C:\\Program Files\\Scripts\\$action.bat";
+    $res = sshCommand('"' . $cmd . '"', $device, $blocking, false);
     setState($s, '0');
     return $res;
 }
 
 function pcScreensProfile($profile, $device)
 {
-    sshCommand('"C:\Program Files (x86)\DisplayFusion\DisplayFusionCommand.exe" -monitorloadprofile "' . $profile . '"', $device, false, true);
+    sshCommand('"C:\Program Files (x86)\DisplayFusion\DisplayFusionCommand.exe" -monitorloadprofile "' . $profile . '"', $device, false, false);
+}
+
+function listWindows($device, $tries = 1)
+{
+    $file = '/nas/Cache/Avion/windowslist.csv';
+    for ($i = 0; $i < $tries; $i++) {
+        if (file_exists($file)) {
+            $r = @file_get_contents($file);
+            if ($r) {
+                setState('listwindows_avion', $r);
+                return $r;
+            }
+        }
+        sleep(3);
+    }
+    return getState('listwindows_avion');
+}
+
+function inWinsowsList($str, $device, $tries = 1)
+{
+    $list = listWindows($device, $tries);
+    return stristr($list, $str) !== false;
 }
\ No newline at end of file
index a0391935d69b81c7ff7c30da8e7279aba5d80d6f..e86e348345f3556206b6e2e53852f8a62e792784 100644 (file)
@@ -128,8 +128,7 @@ class proc
         $t = mktime($hour, $min, $sec, $month, $day, date('Y'));
         $c = time();
 
-
-        $res = $t < $c - 5 || $t > $c;
+        $res = $t < $c - 15 || $t > $c;
         if ($res) {
             echo $c - $t . "\n";
         }
index 9f468df8d52a2fdd09ed1b2a2bf8ffb18d6d941a..d1084dd7d886d3fb5ea9074c36b023cb15c6e4fe 100644 (file)
@@ -1,17 +1,21 @@
 <?php
 $u = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
 
-if (stristr($u, 'index.php') || !stristr($u, '.php')) {
-       $profileFp = fopen(__DIR__ . '/../../log/profile.log', 'a+b');
-       $profileStart = microtime(true);
-       fwrite($profileFp, "\r\n\r\n------------\r\n" . 'URL : ' . $u . "\r\nDate : " . date('Y-m-d H:i:s') . "\r\n");
-}
+$n = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '-';
+$n = str_replace('.php', '', $n);
+$n = str_replace('/home/tortugahome/www/', '', $n);
+$n = str_replace('/', '-', $n);
+$n = trim($n, '/ ');
 
-function profile($desc, $file, $line)
+$profileFp = fopen('/var/log/tortugahome/profiles/' . \Illuminate\Support\Str::slug($n) . '.log', 'a+b');
+$profileStart = microtime(true);
+fwrite($profileFp, "\r\n\r\n------------\r\n" . 'URL : ' . $u . "\r\nDate : " . date('Y-m-d H:i:s') . "\r\n" . print_r($_REQUEST, true) . "\r\n\r\n");
+
+function profile($desc, $file = 'unset', $line = 'unset')
 {
-       global $profileStart, $profileFp;
-       if (is_resource($profileFp)) {
-               $ms = round((microtime(true) - $profileStart) * 1000) . 'ms';
-               fwrite($profileFp, $ms . ';' . $desc . ';' . $file . ';' . $line . "\r\n");
-       }
+    global $profileStart, $profileFp;
+    if (is_resource($profileFp)) {
+        $ms = round((microtime(true) - $profileStart) * 1000) . 'ms';
+        fwrite($profileFp, $ms . ';' . $desc . ';' . $file . ';' . $line . "\r\n");
+    }
 }
\ No newline at end of file
index ac39839793f0f43aa2df45f9c1c9fb5e202bbd82..dc49ba129e363756a97e0cf2200a150a523741d4 100644 (file)
@@ -34,7 +34,7 @@ function remoteInfos()
                 $res['time'] = '';
                 $res['title'] = '';
                 $res['artwork'] = '';
-                $res['status'] = '';
+                $res['status'] = json_encode($p);
                 if (isset($p[0]['result'])) {
                     $r = $p[0]['result'];
                     $res['can_seek'] = $r['canseek'];
@@ -153,8 +153,11 @@ function getTitleAndArtwork($source)
     }
 
     $res = ['title' => '', 'artwork' => ''];
-    $file = str_replace('smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share/', '/volume1/Share', $source);
-    $file = str_replace('/nas', '/volume1/Share', $file);
+    $file = str_replace(NAS_ROOT, '/volume1/Share/', $source);
+    $file = str_replace(NAS_PWD_ROOT, '/volume1/Share/', $file);
+    $file = str_replace('/nas/', '/volume1/Share/', $file);
+    $res['title'] = $file;
+
     if (file_exists($file . '.tmdb.id')) {
         $id = file_get_contents($file . '.tmdb.id');
         if (intval($id) > 0) {
index eeb8445391d54134c03dd3c89a3349b57d00c122..41b50d8e681c352f84d8d6ca552bf16c7b8b895d 100644 (file)
@@ -2,17 +2,17 @@
 
 function routerDevicesList()
 {
-    try {
-        $res = httpRequest('http://192.168.13.1/status-devices.asp', 'get', ['_' => time()], ['admin', 'BDQw479qbJST4u']);
-    } catch (Exception $e) {
-        return [];
-    }
-    // echo $res->getBody();
-    if (preg_match('/dhcpd_lease = ([^;]+);/m', $res->getBody(), $dhcp)) {
-        if (preg_match_all('/192\.168\.13\.[0-9]{1,3}/', $dhcp[1], $matches)) {
-            return $matches[0];
-        }
-    }
+//    try {
+//        $res = httpRequest('http://192.168.13.1/status-devices.asp', 'get', ['_' => time()], ['admin', 'BDQw479qbJST4u']);
+//    } catch (Exception $e) {
+//        return [];
+//    }
+//    // echo $res->getBody();
+//    if (preg_match('/dhcpd_lease = ([^;]+);/m', $res->getBody(), $dhcp)) {
+//        if (preg_match_all('/192\.168\.13\.[0-9]{1,3}/', $dhcp[1], $matches)) {
+//            return $matches[0];
+//        }
+//    }
     return [];
 }
 
index ddd0537d150869d07a91eeb83bab0d52b4c35cce..e513067f2be4cee7f883f06b46fe97dd61bee9ad 100644 (file)
@@ -21,7 +21,7 @@ $bedlowscreenbrightness = 12;
 $home = 15;
 $alert = 16;
 
-$chambrefan = 2724;
+$chambrefan = 4616;
 
 $scenes = [
     'chambre/matin' => [
@@ -61,7 +61,7 @@ $scenes = [
         ['type' => 'nightmode', 'mode' => '1'],
         ['type' => 'ecomode', 'mode' => '1'],
         ['type' => 'state', 'key' => 'chambre', 'value' => 0],
-        ['type' => 'scene', 'scene' => 'chambre/rideaux/close'],
+        ['type' => 'function', 'function' => 'chambreRideaux', 'args' => [false]],
         //['type' => 'insteon', 'command' => '0?1131=I=0=0'],
         ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
         ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
@@ -82,6 +82,7 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
         ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
         ['type' => 'scene', 'scene' => 'chambre/cheminee/off'],
+        ['type' => 'scene', 'scene' => 'chambre/cheminee/off', 'delay' => 2],
     ],
     'chambre/sleep/off' => [
         ['type' => 'scene', 'scene' => 'chambre/bed/base'],
@@ -94,7 +95,7 @@ $scenes = [
         ['type' => 'state', 'key' => 'chambre', 'value' => 0],
         //['type' => 'insteon', 'command' => '0?1332=I=0=0'], // Lustre et tableau off
         ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
-        ['type' => 'scene', 'scene' => 'chambre/rideaux/close'],
+        ['type' => 'function', 'function' => 'chambreRideaux', 'args' => [false]],
         ['type' => 'scene', 'scene' => 'sdb/off'],
         ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
         ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
@@ -285,31 +286,22 @@ $scenes = [
         ['type' => 'hue', 'light' => $litvincent, 'scene' => array('on' => true, 'brightness' => 0, 'hue' => '46920', 'saturation' => 255, 'transitionTime' => 0)],
         ['type' => 'hue', 'light' => $litvincent, 'scene' => array('brightness' => 128, 'colorTemp' => 156, 'transitionTime' => 60 * 60)],
     ],
-//    'chambre/rideaux/west/open' => [
-//        ['type' => 'insteon', 'command' => '3?02622013CB0F11FF=I=3'],
-//    ],
-//    'chambre/rideaux/west/close' => [
-//        ['type' => 'insteon', 'command' => '3?02622013CB0F1300=I=3'],
-//    ],
-//    'chambre/rideaux/east/open' => [
-//        ['type' => 'insteon', 'command' => '3?02622014690F1300=I=3'],
-//    ],
-//    'chambre/rideaux/east/close' => [
-//        ['type' => 'insteon', 'command' =>  '3?02622014690F11FF=I=3'],
-//    ],
+
     'chambre/rideaux/open' => [
-        //['type' => 'domoticz', 'scene' => '3', 'command' => false, 'priority' => true],
-        ['type' => 'domoticz', 'device' => '1756', 'command' => 'Group Off', 'priority' => true],
+        ['type' => 'function', 'function' => 'chambreRideaux'],
     ],
     'chambre/rideaux/close' => [
-        //['type' => 'domoticz', 'scene' => '3', 'command' => true, 'priority' => true],
-        ['type' => 'domoticz', 'device' => '1756', 'command' => 'Group On', 'priority' => true],
+        ['type' => 'function', 'function' => 'chambreRideaux', 'args' => [false]],
     ],
     'home/alert' => [
+        ['type' => 'function', 'function' => 'alert',],
+    ],
+    'home/doalert' => [
         ['type' => 'domoticz', 'device' => '4207', 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $alert, 'scene' => ['alert' => 'lselect']],
-        ['type' => 'hue', 'group' => $alert, 'delay' =>3, 'scene' => ['alert' => 'none']],
+        ['type' => 'hue', 'group' => $alert, 'delay' => 3, 'scene' => ['alert' => 'none']],
         ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'],
+        ['type' => 'phonetask', 'phone' => 'sdb', 'task' => 'Tortuga Alerte'],
     ],
     'home/aulit' => [
         ['type' => 'scene', 'scene' => 'chambre/bed'],
@@ -370,7 +362,7 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'salon/fan/off'],
     ],
     'salon/cinemabase' => [
-       // ['type' => 'scene', 'scene' => 'cuisine/tamise'],
+        // ['type' => 'scene', 'scene' => 'cuisine/tamise'],
 //        ['type' => 'ecomode', 'mode' => '0'],
         // ['type' => 'insteon', 'command' => '0?1111=I=0=0'],
     ],
@@ -418,12 +410,15 @@ $scenes = [
     'salon/fan/toggle' => [
         ['type' => 'domoticz', 'device' => '478', 'command' => 'Toggle', 'priority' => true],
     ],
-    'bureau/wakeuppc' => [
+    'bureau/pc/wakeup' => [
         ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']],
     ],
-    'bureau/sleeppc' => [
+    'bureau/pc/sleep' => [
         ['type' => 'function', 'function' => 'sleepPC', 'args' => ['avion']],
     ],
+    'bureau/pc/shutdown' => [
+        ['type' => 'function', 'function' => 'shutdownPC', 'args' => ['avion']],
+    ],
     'bureau/screens/off' => [
         ['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Games', 'avion']]
     ],
@@ -437,21 +432,19 @@ $scenes = [
         ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
     ],
     'bureau/fan/toggle' => [
-        ['type' => 'domoticz', 'device' => '3529', 'command' => 'Toggle', 'priority' => true],
+        ['type' => 'function', 'function' => 'harmonyDeviceCommand', 'args' => ['klarstein-whisperwind', 'power-toggle']],
     ],
-
     'bureau/auto' => [
         ['type' => 'function', 'function' => 'bureauAuto', 'args' => [true]],
     ],
     'bureau/base/on' => [
         ['type' => 'ecomode', 'mode' => '0'],
-        ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']],
+        ['type' => 'scene', 'scene' => 'bureau/pc/wakeup'],
     ],
     'bureau/cinema' => [
         ['type' => 'scene', 'scene' => 'bureau/base/off'],
         ['type' => 'hue', 'group' => $bureau, 'scene' => '7mofVclWdtvpVyt'],
         ['type' => 'domoticz', 'scene' => 25, 'command' => true, 'priority' => true],
-
     ],
     'bureau/lumineux' => [
         ['type' => 'hue', 'group' => $bureau, 'scene' => 'SdXwtZu5PCDjK2h'],
@@ -583,15 +576,15 @@ $scenes = [
 
     ],
     'bureau/base/off' => [
+        ['type' => 'domoticz', 'scene' => 42, 'command' => false, 'priority' => true],
         ['type' => 'function', 'function' => 'bureauAuto', 'args' => [false]],
         ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'off'],
-        ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'off'],
-        ['type' => 'scene', 'scene' => 'bureau/sleeppc'],
+        ['type' => 'hue', 'group' => $bureau, 'scene' => array('on' => false, 'brightness' => 0)],
+        ['type' => 'hue', 'light' => 23, 'scene' => array('on' => false, 'brightness' => 0)],
     ],
     'bureau/off' => [
-        ['type' => 'hue', 'group' => $bureau, 'scene' => array('on' => false, 'brightness' => 0)],
-        ['type' => 'domoticz', 'scene' => 42, 'command' => false, 'priority' => true],
         ['type' => 'scene', 'scene' => 'bureau/base/off'],
+        ['type' => 'scene', 'scene' => 'bureau/pc/sleep'],
     ],
     'bureau/sound/on' => [
         ['type' => 'domoticz', 'device' => 24, 'switchtype' => 'scene', 'command' => true, 'priority' => true],
@@ -642,7 +635,7 @@ $scenes = [
         //['type' => 'scene', 'scene' => 'cuisine/off'],
         ['type' => 'scene', 'scene' => 'salon/off'],
         ['type' => 'scene', 'scene' => 'cour/off'],
-        ['type' => 'scene', 'scene' => 'bureau/off'],
+        ['type' => 'scene', 'scene' => 'bureau/base/off'],
         ['type' => 'scene', 'scene' => 'chambre/off'],
         ['type' => 'scene', 'scene' => 'sdb/off'],
         ['type' => 'scene', 'scene' => 'wc/off'],
@@ -653,6 +646,7 @@ $scenes = [
         ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Stop All Sounds'],
         ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
         ['type' => 'scene', 'scene' => 'cuisine/coffee/off'],
+        ['type' => 'scene', 'scene' => 'bureau/pc/shutdown'],
         ['type' => 'scene', 'scene' => 'home/hueoff'],
         ['type' => 'scene', 'scene' => 'salon/media/off'],
         ['type' => 'scene', 'scene' => 'salon/off', 'delay' => 2],
@@ -662,7 +656,6 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'salon/on'],
         ['type' => 'scene', 'scene' => 'bureau/auto'],
         ['type' => 'scene', 'scene' => 'chambre/auto'],
-        ['type' => 'scene', 'scene' => 'chambre/rideaux/open'],
         ['type' => 'scene', 'scene' => 'sdb/on'],
         ['type' => 'scene', 'scene' => 'cour/auto'],
         ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/on'],
@@ -676,19 +669,19 @@ $scenes = [
     ],
     'wc/morning' => [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'NC5ejamHGUNURj8'],
-        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['FIP', $squeezeboxPlayers['WC'], 70, false]],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [70]],
     ],
     'wc/day' => [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'qfuu8z5QaJ6J26W'],
-        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['FIP', $squeezeboxPlayers['WC'], 80, false]],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [80]],
     ],
     'wc/evening' => [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'h82j28eNu6ZHVhM'],
-        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['FIP', $squeezeboxPlayers['WC'], 80, false]],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [80]],
     ],
     'wc/late' => [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'IGo4F5jRQXc1H95'],
-        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['FIP', $squeezeboxPlayers['WC'], 70, false]],
+        ['type' => 'function', 'function' => 'wcMusic', 'args' => [70]],
     ],
     'wc/night' => [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'eJy09JTEzCiIL1P'],
@@ -717,10 +710,10 @@ $scenes = [
     ],
 
     'sdb/ampli/on' => [
-        ['type' => 'domoticz', 'device' => '1438', 'command' => true, 'priority' => true],
+        ['type' => 'domoticz', 'device' => '476', 'command' => true, 'priority' => true],
     ],
     'sdb/ampli/off' => [
-        ['type' => 'domoticz', 'device' => '1438', 'command' => false, 'priority' => true],
+        ['type' => 'domoticz', 'device' => '476', 'command' => false, 'priority' => true],
     ],
     'sdb/off' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 0],
@@ -728,6 +721,7 @@ $scenes = [
         ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['Salle de bains'], false]],
     ],
     'sdb/on' => [
+        ['type' => 'state', 'key' => 'sdb', 'value' => 1],
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
         ['type' => 'domoticz', 'scene' => 20, 'command' => true, 'priority' => true],
     ],
@@ -828,11 +822,30 @@ $scenes = [
 ];
 
 
+function chambreRideaux($ouvre = true)
+{
+    $device = 1756;
+    $priority = true;
+    // ['type' => 'domoticz', 'device' => '1756', 'command' => 'Group Off', 'priority' => 'sync'],
+    if ($ouvre && getDomoticzDeviceStatus($device) === 'Off') {
+        return;
+    }
+    $cmd = $ouvre ? 'Group Off' : 'Group On';
+    domoticzSwitch($device, $cmd, 'light', $priority);
+    if ($ouvre) {
+        usleep(1000000 * 4.7);
+        domoticzSwitch($device, $cmd, 'light', $priority);
+    }
+}
+
 function execScene($name, $fromUserAction = false, $transitionTime = null)
 {
     global $scenes;
+
     $scene = $scenes[$name];
 
+    profile('Exec scene ' . $name . '/' . $fromUserAction, __FILE__, __LINE__);
+
     $e = explode('/', $name);
 
     if ($fromUserAction && $e[1] !== 'auto' && count($e) == 2) {
@@ -900,7 +913,7 @@ function execScene($name, $fromUserAction = false, $transitionTime = null)
                 $action['device'] = $action['scene'];
                 $action['switchtype'] = 'scene';
             }
-            domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', isset($action['priority']) && $action['priority']);
+            domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', $action['priority'] ?? false);
         } else if ($action['type'] == 'ir') {
             irsend($action['room'], $action['device'], $action['command']);
         } else if ($action['type'] == 'ifttt') {
@@ -920,6 +933,17 @@ function chambreToggle()
     }
 }
 
+function wcMusic($volume)
+{
+    if (date('w') == '5') {
+        $music = 'Samba';
+        //$volume += 10;
+    } else {
+        $music = 'FIP';
+    }
+    squeezePlayByName($music, 'WC', $volume, false);
+}
+
 function wcToggle()
 {
     if (getState('wc') == 1) {
@@ -971,9 +995,13 @@ function planetarium($on)
 
 function checkPlanetarium($periodicOffCheck = true)
 {
-    $device = 1452;
+    $device = 4617;
 
     $on = getState('planetarium') == '1';
+    $h = date('G');
+    if ($h >= 2 && $h <= 20) {
+        $on = false;
+    }
     if ($on) {
         if ($periodicOffCheck) {
             $min = intval(date('i'));
@@ -1079,17 +1107,6 @@ function chambreAuto($on = true, $transitionTime = null)
         updateChambreAuto($transitionTime);
     } else if (getState('chambreAutoMode') === '1') {
         setState('chambreAutoMode', '0');
-        try {
-            if (isset($_SERVER['REQUEST_URI'])) {
-                $r = $_SERVER['REQUEST_URI'];
-            } else if (php_sapi_name() === 'cli') {
-                $r = 'cli ';
-            }
-            throw new Error('Setting chambre auto mode to false in ' . $r);
-        } catch (Error $e) {
-            $log = ROOT . '/log/chambreautooff.log';
-            file_put_contents($log, file_get_contents($log) . "\n\n" . date('Y-m-d H:i:s') . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString());
-        }
     }
 }
 
@@ -1214,4 +1231,54 @@ function delayScene($scene, $delay)
     $timeout = $delay + 30;
     $url = WEB_ROOT . 'scripts/light.php?delay=' . $delay . '&scene=' . $scene . '&sid=' . session_id();
     return delayHttpCall($url, $timeout);
+}
+
+function alert()
+{
+    if (getNightMode()) {
+        return;
+    }
+    
+    execScene('home/doalert');
+
+    $rep = 1 * 2;
+    $domoticzDevices = [4016, 4017, 4033, 4201, 4202, 4203, 4204, 4205, 4614, 4622];
+    $domoticzStates = [];
+
+    foreach ($domoticzDevices as $domoticzDevice) {
+        $domoticzStates[$domoticzDevice] = getDomoticzDeviceStatus($domoticzDevice);
+    }
+
+    for ($i = 0; $i < $rep; $i++) {
+        foreach ($domoticzDevices as $device) {
+            domoticzSwitch($device, 'Toggle', 'light', true);
+        }
+    }
+
+    $hue = getHueInstance();
+    $group = $hue->getGroups()[18];
+    $allLights = $hue->getLights();
+    $lights = [];
+
+    foreach ($group->getLightIds() as $lightId) {
+        $lights[$lightId] = $allLights[$lightId]->isOn();
+    }
+
+    for ($i = 0; $i < $rep; $i++) {
+        $reverse = $i % 2 === 0;
+        foreach ($lights as $light => $state) {
+            hueCommand(['light' => $light, 'scene' => ['on' => $reverse ? !$state : $state]]);
+        }
+    }
+
+    sleep(15);
+
+    foreach ($lights as $lightId => $state) {
+        hueCommand(['light' => $lightId, 'scene' => ['on' => $state]]);
+    }
+
+    foreach ($domoticzStates as $domoticzDevice => $domoticzState) {
+        domoticzSwitch($domoticzDevice, $domoticzState);
+    }
+
 }
\ No newline at end of file
index 94aeb3c89f0f01e9e15cea9f0424e754a42fa6f3..ae733bb3b6361f65dacfca2b16aa24a56c151319 100644 (file)
@@ -38,11 +38,13 @@ function shieldRunActivity($device = null, $force = false)
     $device = getDevice($device);
     $onlySound = in_array(shieldGetCurrentApp($device), ['spotify']);
 
+    profile('Run activity for shield ' . $device);
+
     if ($device['id'] === 'salon') {
         stopPlayersIn('salon', true, false);
         denonAVROn('Media Player', $force);
-        epson(true);
         execScene('salon/cinema');
+        epson(true);
     } else if ($device['id'] === 'bureau' || $device['id'] === 'bureausun') {
         stopPlayersIn('bureau', true, false);
         if ($onlySound) {
@@ -203,16 +205,18 @@ function shieldMyCanal($channel = false, $type = 'live', $device = null)
 
 function shieldKodi($file, $device = null)
 {
+    $url = shieldNormalizeURL($file);
+    profile('shield kodi ' . $file . '//' . $url, __FILE__, __LINE__);
     shieldRunActivity($device);
     shieldHome($device);
-    shieldCommand('shell am start', '-a android.intent.action.VIEW  -d \'"' . shieldNormalizeURL($file) . '"\' -n org.xbmc.kodi/.Splash', $device);
+    shieldCommand('shell am start', '-a android.intent.action.VIEW  -d \'"' . $url . '"\' -n org.xbmc.kodi/.Splash', $device);
 }
 
 function shieldNormalizeURL($input)
 {
     if (strpos($input, '/nas') === 0) {
         $input = str_replace('/nas/', '/', $input);
-        return 'smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share/' . $input;
+        return NAS_ROOT . $input;
     }
     return $input;
 }
@@ -267,6 +271,8 @@ function shieldGetApps()
         'sbplayer' => 'com.angrygoat.android.sbplayer',
         'spotify' => 'com.spotify.tv.android',
         'steamlink' => 'com.valvesoftware.steamlink',
+        'squeezeplayer' => 'de.bluegaspode.squeezeplayer',
+        'tortuga' => 'fr.enhydra.tortuga.home',
     ];
 }
 
@@ -280,9 +286,8 @@ function shieldRunAppAndBackHome($app, $device = null, $waitBeforeBack = 1, $bac
 {
     if (shieldIsAwake($device)) {
         $backToSleep = false;
-    } else {
-        shieldWakeup($device);
     }
+    shieldWakeup($device);
     if ($backToSleep) {
         $d = getDevice($device);
         $s = 'maskShield' . ucfirst($d['id']) . 'Wakeup';
@@ -328,9 +333,12 @@ function shieldShareIntent($content, $device = null)
 
 function shieldLogcat($cases = [], $device = null)
 {
+    $cmd = _adbcmd('logcat', '', $device);
+
+    `pkill -f "$cmd"`;
     shieldConnect(false, $device);
     $proc = new proc();
-    $cmd = _adbcmd('logcat', '', $device);
+
     echo $cmd . "\n";
     $proc->open($cmd);
     $proc->on($cases);
@@ -363,6 +371,7 @@ function _adb($command, $params = '', $device = null)
     return $output;
 }
 
+
 function _adbcmd($command, $params, $device = null)
 {
     $device = getDevice($device);
index cd0ca342ae1e20f3e5062cbad5437190356321da..b2a98a6348a5a4619fafe637c94b3849be9f9b10 100644 (file)
@@ -8,6 +8,7 @@ function stopSqueezeboxPlayer($player, $stopIfSync = true, $devices = true)
         return;
     }
 
+
     squeezeRequest('sync -', $player);
     squeezeRequest('stop', $player);
     squeezeRequest('power 0', $player);
@@ -15,7 +16,7 @@ function stopSqueezeboxPlayer($player, $stopIfSync = true, $devices = true)
     if ($devices) {
         $room = getRoomBySqueezeboxPlayer($player);
         if ($room == 'salon') {
-
+            denonAVROff();
         } else if ($room === 'sdb') {
             execScene('sdb/ampli/off');
         } else if ($room === 'bureau') {
@@ -26,6 +27,7 @@ function stopSqueezeboxPlayer($player, $stopIfSync = true, $devices = true)
             denon(false);
         }
     }
+    profile('stopped squeezebox player ' . $player);
 }
 
 function getRoomBySqueezeboxPlayer($player)
@@ -58,8 +60,9 @@ function getSqueezePlayerStatus($player = '')
         return -1;
     }
 
+    print_r($res);
     if (!isset($res['result']) || !isset($res['result']['_mode'])) {
-        return false;
+        return -2;
     }
     return $res['result']['_mode'] == 'play' ? 1 : 0;
 }
@@ -145,13 +148,21 @@ function squeezePlayerOn($player)
     global $squeezeboxPlayers;
     $player = _player($player);
     if ($player == $squeezeboxPlayers['Salon']) {
-        denonAVROn('HEOS Music');
+        $state=denonAVRGetPowerState();
+        denonAVROn('HEOS Music', false);
+        sleep(4);
+        if(!$state){
+            denonAVROff();
+            denonAVROn('HEOS Music', true);
+        }
     } else if ($player == $squeezeboxPlayers['Salle de bains']) {
         execScene('sdb/ampli/on');
+        if (getSqueezePlayerStatus($player) < 0) {
+            phoneTask('Tortuga', 'sdb');
+        }
+
     } else if ($player == $squeezeboxPlayers['Bureau']) {
-        setState('maskShieldBureauWakeup', time() + 15);
         harmonyActivity('musique');
-        shieldRunAppAndBackHome('sbplayer', 'bureau', 1, false);
     } else if ($player == $squeezeboxPlayers['Chambre']) {
         denon(true);
     }
index d0a7d6a048c0f00b83387fa4ed34a1e71dad2e0d..cd37c80156d4dcec541b3c4d7dc96f3134d56063 100644 (file)
@@ -55,7 +55,6 @@ function sshCommand($command, $device = null, $blocking = true, $sudo = false)
 function sshRunCommand($command, $device = null, $blocking = true, $sudo = false)
 {
     $ssh = getSSHInstance($device, $sudo);
-    print_r($ssh);
     if ($ssh) {
         $stream = @ssh2_exec($ssh, $command);
         if (!$stream) {
index 2fcf0fa09595a3057dcef603c68d620f499a96e9..83dc3bc6a24e6a07556bf76c8d20f76334a8d423 100644 (file)
@@ -493,27 +493,56 @@ class moviesLibrary extends mediaLibrary
     public function getAlphaShortcuts()
     {
         $letters = [];
+        foreach (str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ') as $l) {
+            $letters[$l] = [];
+        }
+
         foreach ($this->movies as $movie) {
-            $firstLetter = $this->_firstLetter($movie['data']['title']);
-            if (!isset($letters[$firstLetter])) {
-                $letters[$firstLetter] = [];
+            $firstLetters = $this->_firstLetters([$movie['data']['title'], $movie['data']['original_title']]);
+            foreach ($firstLetters as $firstLetter) {
+                if (!isset($letters[$firstLetter])) {
+                    continue;
+                }
+                $letters[$firstLetter][] = $movie;
             }
-            $letters[$firstLetter][] = $movie;
         }
-        ksort($letters);
-
         return $this->_makeSub($letters, 'movies-alpha-', 'Films par titre', 'poster');
     }
 
-    protected function _firstLetter($title)
+    protected function _firstLetters($titles)
     {
-        $res = $this->remove_accents($title);
-        $res = trim($res, '\'');
-        $res = mb_substr($res, 0, 1);
-        $res = mb_strtoupper($res);
-        $res = preg_replace('|\d|', '#', $res);
+        $res = [];
+        $allTitles = [];
+        foreach ($titles as $title) {
+            $title = mb_strtolower($title);
+            $title = $this->remove_accents($title);
+            $title = trim($title, '\' ');
+            $allTitles[] = $title;
+            $allTitles[] = $this->_removeMeanlessWords($title);
+        }
 
-        return $res;
+        $allTitles = array_unique($allTitles);
+        foreach ($allTitles as $title) {
+            $letter = mb_substr($title, 0, 1);
+            $letter = mb_strtoupper($letter);
+            $letter = preg_replace('|\d|', '#', $letter);
+            $res[] = $letter;
+        }
+
+        return array_unique($res);
+    }
+
+    protected function _removeMeanlessWords($title)
+    {
+        $remove = ['un', 'une', 'le', 'la', 'l', 'the', 'a', 'der', 'die', 'das', 'ein', 'el', 'una'];
+        $e = preg_split('/(\s|\')/', mb_strtolower($title));
+        $res = [];
+        foreach ($e as $item) {
+            if (!in_array($item, $remove)) {
+                $res[] = $item;
+            }
+        }
+        return implode(' ', $res);
     }
 
     protected function remove_accents($string)
index 10d8650d9d5f5197b93c99dae92d0a3ebecea769..b8ebd8eb5eba791a22ba17ee8b2911249a09f1e8 100644 (file)
@@ -29,8 +29,9 @@ function weatherStationScreenSaver()
     $res .= '<tr><td class="hicon livingroom"><i class="fa fa-cocktail"></i></td><td class="livingroom">' . $weather['livingroom_temp'] . ' °C</td><td class="hicon hum livingroom"><i class="fa fa-tint"></i></td><td class="hum livingroom">' . $weather['livingroom_humidity'] . '%</td>';
     $res .= '<td class="sep"></td><td class="hicon office"><i class="fa fa-plane"></i></td><td class="office">' . $weather['office_temp'] . ' °C</td><td class="hicon hum office"><i class="fa fa-tint"></i></td><td class="hum office">' . $weather['office_humidity'] . '%</td></tr>';
     $res .= '<tr><td class="hicon wc"><i class="fa fa-toilet"></i></td><td class="wc">' . $weather['wc_temp'] . ' °C</td><td class="hicon hum wc"><i class="fa fa-tint"></i></td><td class="hum wc">' . $weather['wc_humidity'] . '%</td>';
-    $res .= '<td class="sep"></td><td class="hicon bedroom"><i class="fa fa-bed"></i></td><td class="bedroom">' . $weather['bedroom_temp'] . ' °C</td><td class="hicon hum bedroom"><i class="fa fa-tint"></i></td><td class="hum bedroom">' . $weather['bedroom_humidity'] . '%</td></tr>';
-    $res .= '<tr><td class="hicon bathroom"><i class="fa fa-bath"></i></td><td class="bathroom">' . $weather['bathroom_temp'] . ' °C</td><td class="hicon hum bathroom"><i class="fa fa-tint"></i></td><td class="hum bathroom">' . $weather['bathroom_humidity'] . '%</td></tr>';
+    $res .= '<td class="sep"></td><td class="hicon bedroom"><i class="fa fa-bed"></i></td><td class="bedroom">' . $weather['bedroom_temp'] . ' °C</td><td class="hicon hum bedroom"><i class="fa fa-tint"></i></td><td class="hum bedroom">' . $weather['bedroom_humidity'] . '%</td>';
+    $res .= '<tr><td class="hicon bathroom"><i class="fa fa-bath"></i></td><td class="bathroom">' . $weather['bathroom_temp'] . ' °C</td><td class="hicon hum bathroom"><i class="fa fa-tint"></i></td><td class="hum bathroom">' . $weather['bathroom_humidity'] . '%</td>';
+    $res .= '<td class="sep"></td><td class="hicon cellar"><i class="fa fa-bat"></i></td><td class="cellar">' . $weather['cellar_temp'] . ' °C</td><td class="hicon hum cellar"><i class="fa fa-tint"></i></td><td class="hum cellar">' . $weather['cellar_humidity'] . '%</td></tr>';
     $res .= '</table>';
     $res .= '</div>';
     $res .= '<div class="forecasts">';
index d6d768730562efd514c210fc4e7bad14ac1495df..d5fecb3e2e911df07598d16d3cc649b3c43f74c9 100644 (file)
@@ -16,7 +16,7 @@ if ($_GET['action'] == 'play') {
     echo getPlaying($_GET['device']);
 }
 
-if ($_GET['small'] == 1) {
+if (isset($_GET['small']) && $_GET['small'] == 1) {
     sleep(3);
     moveVLC(false);
 }
\ No newline at end of file
index b5969d7e065ee391df7f1e668f95d2120f4bd7d3..7966ec5587a81d7998a36275c2f3809f8a112354 100644 (file)
@@ -1,38 +1,31 @@
 <?php
 
 require_once "import.php";
+$device = $_GET['device'] ?? null;
 
 echo '<pre>';
 if (isset($_GET['key'])) {
-    shieldKey($_GET['key']);
+    shieldKey($_GET['key'], $device);
 } else if (isset($_GET['netflix'])) {
-    shieldNetflix($_GET['netflix']);
+    shieldNetflix($_GET['netflix'], $device);
 } else if (isset($_GET['text'])) {
-    shieldText($_GET['text']);
+    shieldText($_GET['text'], $device);
 } else if (isset($_GET['action'])) {
     if ($_GET['action'] == 'apps') {
-        shieldListApps();
+        shieldListApps($device);
     } else if ($_GET['action'] == 'currentApp') {
-        shieldGetCurrentApp();
+        shieldGetCurrentApp($device);
     }
 } else if (isset($_GET['intents'])) {
-    shieldFindIntents($_GET['intents']);
-} elseif (isset($_GET['tv'])) {
-    shieldTv($_GET['tv']);
-} elseif (isset($_GET['live'])) {
-    shieldTv($_GET['live']);
-} else if (isset($_GET['replay'])) {
-    shieldTv($_GET['replay'], 'replay');
+    shieldFindIntents($_GET['intents'], $device);
 } else if (isset($_GET['vlc'])) {
-    shieldVLC($_GET['vlc']);
+    shieldVLC($_GET['vlc'], $device);
 } else if (isset($_GET['kodi'])) {
-    shieldKodi($_GET['kodi']);
+    shieldKodi($_GET['kodi'], $device);
 } else if (isset($_GET['mycanal'])) {
     $e = explode(':', $_GET['mycanal']);
-    shieldMyCanal($e[1], $e[0]);
+    shieldMyCanal($e[1], $e[0], $device);
 } else if (isset($_GET['runappback'])) {
-    shieldRunAppAndBackHome($_GET['runappback']);
-}else if(isset($_GET['netflix'])){
-    shieldNetflix();
+    shieldRunAppAndBackHome($_GET['runappback'], $device);
 }
 echo '</pre>';
\ No newline at end of file
index eb93ed252db13d681ab7caec99dd40d22c938ea7..8d2a2085bfaee765dd71ba9eaae7744c4eb5fa01 100644 (file)
@@ -1,3 +1,3 @@
 <?php
 require_once "import.php";
-print_r(sleepPC('avion', true));
\ No newline at end of file
+print_r(shutdownPC('avion', true, true));
\ No newline at end of file
index f42c34d4cbd54453744a6c947a9f085dabe44eb4..adb1eef9f97dd2106fbfa697cfcc802f17596eb4 100644 (file)
@@ -1,7 +1,9 @@
 <?php
 require_once "import.php";
 
-if(isset($_GET['name'])){
+set_time_limit(5);
+
+if (isset($_GET['name'])) {
     squeezePlayByName($_GET['name'], $_GET['player']);
     exit;
 }
@@ -11,31 +13,12 @@ if (isset($_GET['requests'])) {
     $requests = json_decode($_GET['requests']);
 }
 
-if (!in_array('stop', $requests) || isset($_GET['name'])) {
-    if ($_GET['player'] == 'Salon') {
-
-    } elseif ($_GET['player'] == 'Salle de bains') {
-        execScene('sdb/ampli/on');
-    } else if ($_GET['player'] === 'Bureau') {
-        setState('maskShieldBureauWakeup', time()+15);
-        print_r(harmonyActivity("musique"));
-    }
-    setPlaying('squeezebox');
-} else {
-    if ($_GET['player'] == 'Salle de bains') {
-        //execScene('sdb/ampli/off');
-    }
-    if (getPlaying() == 'squeezebox') {
-        setPlaying('');
-    }
-}
-
 if (isset($_GET['type']) && $_GET['type'] == 'squeeze_spotify') {
     checkSpottyLogin(true);
 }
 
 
-    $res = [];
-    foreach ($requests as $request) {
-        $res[] = squeezeRequest($request, $_GET['player']);
-    }
+$res = [];
+foreach ($requests as $request) {
+    squeezeRequest($request, $_GET['player']);
+}
index 4bfca77a296fcb66b97a2910378863e07431d1d7..a3c4ee72824c4c831fa818139819292afba883f7 100644 (file)
@@ -1,4 +1,4 @@
 <?php
 require_once "import.php";
 
-getSqueezePlayerStatus();
\ No newline at end of file
+echo _player() . ':' . getSqueezePlayerStatus();
\ No newline at end of file
index 11b652b15506b9881cf974e7b33c088957288d46..598fa0abe78b5d8135e38632dfc74ac186f7d387 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 
 <?php
 $n = $argv[1];
index 8474db97626076b68b1cd49fdff9019ddf668264..65b2b655a99a366ebc457d23909887c1858f43c9 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 
 <?php
 
index 5635f7566757381ff15ee74e6166e8d81be23a48..6e6c4980a6d4b68937d0ce366788b3be31ce8464 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 
 <?php
 require_once __DIR__ . "/../scripts/import.php";
index fca3814c2ccc0d76c1989596ebe3bc2db76fab0d..324ecdd2532006a437e2ec1b5f38a14c8e384c27 100644 (file)
@@ -1,10 +1,6 @@
 <?php
 require_once __DIR__ . "/../scripts/import.php";
 
-if (!isset($device)) {
-    $device = 'salon';
-}
-
 // Set time limit to indefinite execution
 set_time_limit(0);
 ignore_user_abort(true);
@@ -16,38 +12,19 @@ $cases = [
     },
     'Waking up from sleep' => function () use ($device) {
         echo 'wakeup ' . $device . "\n";
-        if ($device == 'salon') {
-            $state = 'maskShieldSalonWakeup';
-            $squeezePlayer = 'Salon';
-        } else if ($device === 'bureau') {
-            $state = 'maskShieldBureauWakeup';
-            $squeezePlayer = 'Bureau';
-        }
-        if (getState($state, '0') < time() && getSqueezePlayerStatus($squeezePlayer) <= 0) {
-            shieldRunActivity($device,true);
-        }
+        shieldRunActivity(null, true);
     },
     'WindowManager: handleComboKeys keyCode: 25, keyAction: 1' => function () use ($device) {
         echo 'volume-down ' . $device . "\n";
-        if ($device === 'bureau') {
-            volume('3', '-', 'harmony');
-        } else if ($device === 'salon') {
-            volume('2', '-', 'denonavr');
-        }
+        volume(config('VOLUME_STEP'), '-');
     },
     'WindowManager: handleComboKeys keyCode: 24, keyAction: 1' => function () use ($device) {
         echo 'volume-up ' . $device . "\n";
-        if ($device === 'bureau') {
-            volume('3', '+', 'harmony');
-        } else if ($device === 'salon') {
-            volume('2', '+', 'denonavr');
-        }
+        volume(config('VOLUME_STEP'), '+');
     }
 ];
 
 echo 'Run home server logcat ' . $device . "\n";
 
-while (true) {
-    shieldLogcat($cases, $device);
-    echo 'Logcat ended' . "\n----\n";
-}
+shieldLogcat($cases, $device);
+echo 'Logcat ended' . "\n----\n";
index 8b70ef8e306cb68a1bed0089984034ad9b507958..ae915cc4ff018bcada16b085b8acdc5dc8002f24 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 <?php
-$device = 'bureau';
+$forceConfig = $device = 'bureau';
 include_once "logcat.php";
\ No newline at end of file
index 4e3187503939a00fd36c2b3593cc4d7605fe8fe1..3c21e23821d5242a9bcb89494d05da7df3dc4246 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 <?php
-$device = 'salon';
+$forceConfig = $device = 'salon';
 include_once "logcat.php";
\ No newline at end of file
index 2f2fa77d35a990029224787fae69750cd61b3671..9e8b56b1a934047488676131061e42a119b46c47 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 
 <?php
 require_once __DIR__ . "/../scripts/import.php";
index 2d6186eaaa821f37fb4c82309d0ff6c727e4e558..4b4355576f76a01e8ec41e17252d8bcad3350175 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php7.4
+#!/usr/bin/php
 
 <?php
 require_once __DIR__ . "/../scripts/import.php";
index c9bc795a6dc72c82bfd495af09287e0f653d4f54..29fe6ab17561e050d7197965ee3c4c4ddf8ebd51 100644 (file)
@@ -17,7 +17,7 @@ body[data-type="gradient"] {
 }
 .video-background {
   background: #000;
-  position: fixed;
+  position: absolute;
   top: 0;
   right: 0;
   bottom: 0;
index eb32e410b0893a9b01e7ff42eaceb9618c809ebc..a9b356c56a0f535f3efb5aac904e1950470931dd 100644 (file)
@@ -8,6 +8,7 @@ html, body {
        height: 100%;
 }
 
+
 body {
        background-color: #000000;
        &[data-type="gradient"] {
@@ -19,7 +20,7 @@ body {
 
 .video-background {
        background: #000;
-       position: fixed;
+       position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
index d5904620272988bb5200d7de263b751343f6c4df..34e8090c08537ad57f20b4c7e5bd8e4c79277a7b 100644 (file)
@@ -56,7 +56,7 @@ body {
 
 #burger {
   @w: 14vh;
-  @o: unit(@w/2, vh);
+  @o: unit((@w/2), vh);
   position: fixed;
   right: @o;
   bottom: @o;
@@ -72,7 +72,7 @@ body {
     color: #fff;
     right: @f;
     bottom: @f;
-    font-size: unit(@f/45*55, vh);
+    font-size: unit((@f/45)*55, vh);
   }
 }
 
index bc3d22502ea038dd0e1522448f8d3be818b40d64..f1061606da67f7fffdb48ba48bd0498da512bc2a 100644 (file)
 #weatherstation .contents .house .office {
   color: #051234;
 }
+#weatherstation .contents .house .cellar {
+  color: #978270;
+}
 #weatherstation .contents .house td {
   vertical-align: bottom;
   text-align: left;
index 4d9cd61b7ddb58c9a1487ce99ff3827fd454b683..027852bdf2967796dd926b5303e78dbc5bda04eb 100644 (file)
@@ -11,6 +11,7 @@
   width: 100%;
   height: 100%;
 
+
   .contents {
     position: absolute;
     top: 0px;
@@ -65,7 +66,7 @@
       white-space: nowrap;
       position: absolute;
       left: 200px;
-      height:100%;
+      height: 100%;
 
       .icon {
         width: 200px;
       width: 100%;
       margin: 40px 20px 0;
       position: absolute;
-      bottom:20px;
+      bottom: 20px;
 
       .sep {
         min-width: 25px;
         color: #051234;
       }
 
+      .cellar {
+        color: #978270;
+      }
+
+
       td {
         vertical-align: bottom;
         text-align: left;
   }
 
   .curvemix(@width,@margin,@color) {
+
+    @halfw: (@width / 2);
+
     position: absolute;
-    width: unit(@width+@margin*2, px);
+    width: unit(@width + @margin * 2, px);
     height: unit(@width, px);
     .orbit {
       position: absolute;
     .horizon {
       position: absolute;
       left: 0px;
-      width: unit(@width+@margin*2, px);
-      top: unit(@width/2-1, px);
+      width: unit(@width + @margin * 2, px);
+      top: unit(@halfw - 1, px);
       border-top: 1px dashed @color;
       z-index: 1;
     }
         display: block;
         position: absolute;
         top: -17px;
-        left: unit(@width/-2-15, px);
+        left: unit((-1 * @halfw) - 15, px);
         z-index: 3;
       }
 
       position: absolute;
-      top: unit(@width/2, px);
-      left: unit(@width/2+@margin, px);
+      top: unit(@halfw, px);
+      left: unit(@halfw+@margin, px);
       z-index: 3;
       transform-origin: 0 0 0;
     }