]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Tue, 31 Dec 2019 10:21:27 +0000 (11:21 +0100)
committerVincent <vincent@enhydra.fr>
Tue, 31 Dec 2019 10:21:27 +0000 (11:21 +0100)
.idea/workspace.xml
scripts/cron/cron.php
scripts/domoticz_status.php
scripts/lib/domoticz.php
scripts/lib/weatherstation.php

index b6983641e4b5e95761aa0483de2c7ed924cf0b6d..4834f427ff60d4cd8c0246ef6f29abd44757311c 100644 (file)
@@ -2,9 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/scripts/cronweather.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/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" 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_status.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_status.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/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1577358967357" duration="4847000" />
       <workItem from="1577378088885" duration="2201000" />
       <workItem from="1577380387468" duration="866000" />
-      <workItem from="1577785483253" duration="1010000" />
-    </task>
-    <task id="LOCAL-00211" summary=".">
-      <created>1566548210701</created>
-      <option name="number" value="00211" />
-      <option name="presentableId" value="LOCAL-00211" />
-      <option name="project" value="LOCAL" />
-      <updated>1566548210701</updated>
+      <workItem from="1577785483253" duration="2153000" />
     </task>
     <task id="LOCAL-00212" summary=".">
       <created>1566551436129</created>
       <option name="project" value="LOCAL" />
       <updated>1577381108669</updated>
     </task>
-    <option name="localTasksCounter" value="260" />
+    <task id="LOCAL-00260" summary=".">
+      <created>1577786536734</created>
+      <option name="number" value="00260" />
+      <option name="presentableId" value="LOCAL-00260" />
+      <option name="project" value="LOCAL" />
+      <updated>1577786536735</updated>
+    </task>
+    <option name="localTasksCounter" value="261" />
     <servers />
   </component>
   <component name="TodoView">
     </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="1576479992407" />
-    <state x="701" y="114" key="CommitChangelistDialog2" timestamp="1577381105204">
-      <screen x="0" y="0" width="1920" height="1040" />
+    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1577786532749">
+      <screen x="0" y="0" width="2560" height="1040" />
     </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="1575647157027" />
-    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1576522977384" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1577786532749" />
     <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1577785958789">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index edefe84f39360c51bf11b6521322f868864b4c0e..766a6fde86c7f35e06ce7cfe4f584dabb8acd3c2 100644 (file)
@@ -143,6 +143,9 @@ function cronSqueezeFavorites($cronmin)
 
 function toNumber($val, $round = false)
 {
+    if ($val === false) {
+        return '--';
+    }
     $val = preg_replace('/[^0-9-.]/', '', $val);
     $val = floatval($val);
     if ($round) {
@@ -170,6 +173,7 @@ function cronWeather($cronmin)
     $res['outdoor_pressure'] = toNumber(getDomoticzDeviceStatus(1032), true);
     $res['backyard_temp'] = toNumber(getDomoticzDeviceStatus(1025), true);
     $res['backyard_humidity'] = toNumber(getDomoticzDeviceStatus(1026), true);
+    $res['backyard_pressure'] = toNumber(getDomoticzDeviceStatus(1027), true);
     $res['pressure'] = round($weather['Pressure']['Metric']['Value']);
     $res['pressureTendency'] = $weather['PressureTendency']['Code'];
     $res['precipitations24'] = round($weather['PrecipitationSummary']['Past24Hours']['Metric']['Value']);
index 97c6ff647644d9fecfab51552a5178f071ca7f31..222bc2a8548ad3b395b27561bee5564617dd85dc 100644 (file)
@@ -1,4 +1,4 @@
 <?php
 require_once "import.php";
 
-print_r(getDomoticzDeviceStatus($_GET['device'],$_GET['hardware']));
\ No newline at end of file
+print_r(getDomoticzDeviceStatus($_GET['device']));
\ No newline at end of file
index 21cb088020642ec20b634e94a22b3d84fd77b765..4266b3cf9d69f09f0bdd7ef152bfb9037ee15c29 100644 (file)
@@ -46,6 +46,13 @@ function getDomoticzDeviceStatus($device)
 {
     $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
     $res = json_decode($res->getBody(), true);
-
+    try {
+        $update = new DateTime($res['result'][0]['LastUpdate']);
+        $now = new DateTime();
+        if ($update->diff($now)->days > 0) {
+            return false;
+        }
+    } catch (Exception $e) {
+    }
     return $res['result'][0]['Data'];
 }
index 50df817868bb095025d67c3845addb998983a816..3482c0dad5a226fc9163bdd523f5ca4d37f13da0 100644 (file)
@@ -4,6 +4,7 @@ function weatherStationScreenSaver()
     $weather = json_decode(file_get_contents(ROOT . '/cache/weather.json'), true);
 
     $pressureTendency = $weather['pressureTendency'] == 'F' ? 'down' : 'up';
+    $pressure = $weather['outdoor_pressure'] == '--' ? $weather['backyard_pressure'] : $weather['outdoor_pressure'];
 
     $res = '<div id="weatherstation" class="screensaver">';
     $res .= '<div class="time"></div>';
@@ -19,7 +20,7 @@ function weatherStationScreenSaver()
     $res .= '<div class="temp-max">' . $weather['max'] . '°C</div>';
     $res .= '</div>';
     $res .= '<div class="pp">';
-    $res .= '<i class="fas fa-cloud-rain"></i> ' . $weather['precipitations24'] . ' mm | <i class="fas fa-tachometer-alt"></i> ' . $weather['backyard_pressure'] . ' hPa <i class="fa fa-arrow-circle-' . $pressureTendency . '"></i> | <i class="fa fa-tint"></i> ' . $weather['outdoor_humidity'] . '%<br>';
+    $res .= '<i class="fas fa-cloud-rain"></i> ' . $weather['precipitations24'] . ' mm | <i class="fas fa-tachometer-alt"></i> ' . $pressure . ' hPa <i class="fa fa-arrow-circle-' . $pressureTendency . '"></i> | <i class="fa fa-tint"></i> ' . $weather['outdoor_humidity'] . '%<br>';
     $res .= '<br><span style="color:#008048;"><i class="fas fa-leaf"></i> ' . $weather['backyard_temp'] . ' °C | <i class="fa fa-tint"></i> ' . $weather['backyard_humidity'] . '%</span>';
     $res .= '</div>';
     $res .= '</div>';