]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Mon, 16 Dec 2019 11:04:28 +0000 (12:04 +0100)
committerVincent <vincent@enhydra.fr>
Mon, 16 Dec 2019 11:04:28 +0000 (12:04 +0100)
.idea/workspace.xml
scripts/backyard.php [new file with mode: 0644]
scripts/lib/weatherstation.php

index 9d9c4a6d612f30ae589d954972c82c2b64d208d6..e07c80a8073480ec6539a9d016666ba2ec27d52b 100644 (file)
@@ -2,6 +2,7 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/backyard.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
     </list>
       <workItem from="1575646996012" duration="72000" />
       <workItem from="1575647085982" duration="668000" />
       <workItem from="1576479934693" duration="252000" />
-      <workItem from="1576480199671" duration="1812000" />
-    </task>
-    <task id="LOCAL-00203" summary=".">
-      <created>1565944175034</created>
-      <option name="number" value="00203" />
-      <option name="presentableId" value="LOCAL-00203" />
-      <option name="project" value="LOCAL" />
-      <updated>1565944175034</updated>
+      <workItem from="1576480199671" duration="2743000" />
     </task>
     <task id="LOCAL-00204" summary=".">
       <created>1566128716085</created>
       <option name="project" value="LOCAL" />
       <updated>1575647196441</updated>
     </task>
-    <option name="localTasksCounter" value="252" />
+    <task id="LOCAL-00252" summary=".">
+      <created>1576492913475</created>
+      <option name="number" value="00252" />
+      <option name="presentableId" value="LOCAL-00252" />
+      <option name="project" value="LOCAL" />
+      <updated>1576492913476</updated>
+    </task>
+    <option name="localTasksCounter" value="253" />
     <servers />
   </component>
   <component name="TodoView">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1576479992407" />
-    <state x="701" y="127" key="CommitChangelistDialog2" timestamp="1575647157027">
-      <screen x="0" y="0" width="1920" height="1160" />
+    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1576492902061">
+      <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="701" y="127" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1575647157027" />
-    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1575617704022" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1576492902061" />
+    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1576493932196">
+      <screen x="0" y="0" width="2560" height="1040" />
+    </state>
+    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1576493932196" />
     <state x="976" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1576480418011">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
diff --git a/scripts/backyard.php b/scripts/backyard.php
new file mode 100644 (file)
index 0000000..7879a0b
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+require_once "import.php";
+
+$day=isDay();
+domoticzSwitch(679, $day); // Projecteurs cour
\ No newline at end of file
index 2cdc2ed0bb77c0753781df5ac469f2a6752d7d1c..5ec37a01b590a843bef07bb377ee35f756ad499d 100644 (file)
@@ -105,15 +105,17 @@ function accuweatherIcon($icon)
 function isDay()
 {
     $time = new DateTime('now', new DateTimeZone('Europe/Paris'));
+    $timestamp = $time->getTimestamp();
+    $offset = $time->getOffset() / 3600;
 
-    $sunrise = date_sunrise($time->getTimestamp(), SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $time->getOffset() / 3600);
-    $sunset = date_sunset($time->getTimestamp(), SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $time->getOffset() / 3600);
+    $sunrise = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $offset);
+    $sunset = date_sunset($timestamp, SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $offset);
 
-    if ($time > $sunset && $sunrise < $sunset) {
+    if ($timestamp > $sunset && $sunrise < $sunset) {
         $sunrise += 3600 * 24;
     }
 
-    if ($time < $sunrise || $time > $sunset) {
+    if ($timestamp < $sunrise || $timestamp > $sunset) {
         return false;
     }
     return true;