]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Thu, 27 Feb 2020 10:17:10 +0000 (11:17 +0100)
committerVincent <vincent@enhydra.fr>
Thu, 27 Feb 2020 10:17:10 +0000 (11:17 +0100)
.idea/workspace.xml
config/chambre.php
scripts/lib/lib.php
scripts/lib/scenes.php
scripts/lib/weatherstation.php

index c3387fa3da1ac4b5c10d9bda534d1bea1aad63a8..6912b86cac9e97cd08a62a35ae81acb7b9bc5776 100644 (file)
@@ -3,7 +3,10 @@
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/chambre.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/chambre.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/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1582013653504" duration="1339000" />
       <workItem from="1582100423273" duration="2523000" />
       <workItem from="1582130476569" duration="857000" />
-      <workItem from="1582201880333" duration="2436000" />
-    </task>
-    <task id="LOCAL-00257" summary=".">
-      <created>1577380217123</created>
-      <option name="number" value="00257" />
-      <option name="presentableId" value="LOCAL-00257" />
-      <option name="project" value="LOCAL" />
-      <updated>1577380217123</updated>
+      <workItem from="1582201880333" duration="3283000" />
+      <workItem from="1582660044500" duration="814000" />
+      <workItem from="1582796298540" duration="1959000" />
+      <workItem from="1582798438958" duration="112000" />
     </task>
     <task id="LOCAL-00258" summary=".">
       <created>1577380602449</created>
       <option name="project" value="LOCAL" />
       <updated>1582130758226</updated>
     </task>
-    <option name="localTasksCounter" value="306" />
+    <task id="LOCAL-00306" summary=".">
+      <created>1582220578115</created>
+      <option name="number" value="00306" />
+      <option name="presentableId" value="LOCAL-00306" />
+      <option name="project" value="LOCAL" />
+      <updated>1582220578115</updated>
+    </task>
+    <option name="localTasksCounter" value="307" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
     </state>
     <state x="720" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577298128269" />
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1580459136096" />
-    <state x="701" y="127" key="CommitChangelistDialog2" timestamp="1582130743400">
+    <state x="701" y="127" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1582220569877">
       <screen x="0" y="0" width="1920" height="1160" />
     </state>
     <state x="701" y="114" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1577381105204" />
-    <state x="701" y="127" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1582130743400" />
+    <state x="701" y="127" width="1170" height="972" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1582220569877" />
     <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1582104424372" />
     <state x="92" y="92" width="2376" height="856" key="DiffContextDialog" timestamp="1580377344165">
       <screen x="0" y="0" width="2560" height="1040" />
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="872" y="242" key="Vcs.Push.Dialog.v2/0.0.2560.1040@0.0.2560.1040" timestamp="1580377827629" />
-    <state x="732" y="383" key="com.intellij.ide.util.TipDialog" timestamp="1582201881167">
-      <screen x="0" y="0" width="1920" height="1160" />
+    <state x="976" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1582798439144">
+      <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="732" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577380394903" />
     <state x="732" y="383" key="com.intellij.ide.util.TipDialog/0.0.1920.1160@0.0.1920.1160" timestamp="1582201881167" />
-    <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1582100425539" />
-    <state x="733" y="287" width="607" height="598" key="find.popup" timestamp="1582125776502">
-      <screen x="0" y="0" width="1920" height="1160" />
+    <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1582798439144" />
+    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1582796777847">
+      <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="732" y="257" width="607" height="536" key="find.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1577380471547" />
     <state x="733" y="287" width="607" height="598" key="find.popup/0.0.1920.1160@0.0.1920.1160" timestamp="1582125776502" />
-    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1581412193715" />
+    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1582796777847" />
     <state x="936" y="240" key="run.anything.popup" timestamp="1578386519646">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index 3a9c900d4c0b92852921c19a0dfa433baf440d83..541aef09d2deb85c89ddfa62900091947e5bcefe 100644 (file)
@@ -6,7 +6,7 @@ config('SLEEPSCREEN', 15);
 config('SCREENSAVER_BRIGHTNESS', 100);
 config('SLEEPTYPE', 'screensaver');
 config('SCREENSAVER','weatherstation');
-config('VOLUME_DEVICE', 'SqueezeboxPlayer');
+config('VOLUME_DEVICE', 'RaspberryPi:lit');
 config('HIDEMASK_TIMEOUT',250);
 
 if(DISPLAYINTERFACE) {
index 85cf08073fcea385f0f5a29d098a790c5f675f41..a68538e353518bfe198375e02d19823d73cf6821 100644 (file)
@@ -432,11 +432,18 @@ function volume($volume, $increase = '')
 
     echo $device . ' (' . $p . ') : ' . $d;
 
+    $e = explode(':', $d);
+    $rpiDevice = null;
+    if (isset($e[1])) {
+        $rpiDevice = $e[1];
+        $d = $e[0];
+    }
+
     switch ($d) {
         case 'Raspberry':
         case 'RaspberryPi':
             $cmd = 'amixer -c 0 -M -- sset PCM playback ' . round(max(0, min(100, $volume))) . '%' . $increase;
-            return sshCommand($cmd);
+            return sshCommand($cmd, $rpiDevice);
         case 'SqueezeboxPlayer':
             return squeezeVolume($volume, $increase, $player);
         case 'Harmony':
index cb51b4b2485940e2637282d460e0642b6271dc2f..eb011a813929574c5955151868c71f2a871cf3e8 100644 (file)
@@ -488,6 +488,10 @@ $scenes = [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'h82j28eNu6ZHVhM'],
         ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['FIP', $squeezeboxPlayers['WC'], 30, false]],
     ],
+    'wc/late' => [
+        ['type' => 'hue', 'group' => $wc, 'scene' => 'IGo4F5jRQXc1H95'],
+        ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['FIP', $squeezeboxPlayers['WC'], 30, false]],
+    ],
     'wc/night' => [
         ['type' => 'hue', 'group' => $wc, 'scene' => 'eJy09JTEzCiIL1P'],
     ],
@@ -689,8 +693,10 @@ function sdbToggle()
 function wcOn($vmc = true)
 {
     $hour = getHour();
-    if ($hour > 2.5 && $hour < 6.75) {
+    if (getNightMode()) {
         $period = 'night';
+    } else if ($hour > 0 && $hour < 6.75) {
+        $period = 'late';
     } else if ($hour >= 6.75 && $hour < 10) {
         $period = 'morning';
     } else if ($hour >= 10 && $hour < 20) {
index 49f73d2773f4cdc7495d91b6121a8ca710f4bc79..79fe5852251a44b2e21b3a50eee0aabc4be3228a 100644 (file)
@@ -113,11 +113,18 @@ function accuweatherIcon($icon)
 }
 
 function isDay()
+{
+    return getPeriodOfDay()['day'];
+}
+
+function getPeriodOfDay()
 {
     $time = new DateTime('now', new DateTimeZone('Europe/Paris'));
     $timestamp = $time->getTimestamp();
     $offset = $time->getOffset() / 3600;
 
+    $hours = intval(date('H'));
+
     $sunrise = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $offset);
     $sunset = date_sunset($timestamp, SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $offset);
 
@@ -125,8 +132,30 @@ function isDay()
         $sunrise += 3600 * 24;
     }
 
-    if ($timestamp < $sunrise || $timestamp > $sunset) {
-        return false;
+
+    $start_twilight = $sunset - 3600;
+    $end_twilight = $sunset + 3600;
+
+    $start_dawn = $sunrise - 3600;
+    $end_dawn = $sunrise + 3600;
+
+    $day = !($timestamp < $sunrise || $timestamp >= $sunset);
+
+    if ($timestamp >= $start_twilight && $timestamp < $end_twilight) {
+        $period = 'twilight';
+    } else if ($timestamp >= $start_dawn && $timestamp < $end_dawn) {
+        $period = 'dawn';
+    } else if ($day) {
+
+    } else {
+        $period = 'night';
     }
-    return true;
+
+    if ($day) {
+        $midday = ($sunset + $sunrise) / 2;
+    } else {
+
+    }
+
+    return ['day' => $day, 'period' => $period];
 }
\ No newline at end of file