]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Fri, 10 Apr 2020 11:47:02 +0000 (13:47 +0200)
committerVincent <vincent@enhydra.fr>
Fri, 10 Apr 2020 11:47:02 +0000 (13:47 +0200)
.idea/workspace.xml
scripts/cron/cron.php
scripts/flowerpower.php
scripts/lib/flowerpower.php [new file with mode: 0644]
scripts/lib/lib.php
scripts/lib/tmdb.php

index 01ab3815fdafa74650442a3715a55e438782cd92..5fe25e4a91246f9eab3d6cba0a9b39299acb377d 100644 (file)
@@ -2,7 +2,11 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/lib/flowerpower.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/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/flowerpower.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/flowerpower.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/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1553247665857" />
     <property name="dumpAutoload T:/Drive/Works/home/composer.json" value="--no-interaction --ansi --verbose --optimize" />
     <property name="editor.config.ad.shown" value="true" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/tools/xplanet" />
+    <property name="last_opened_file_path" value="$USER_HOME$/Works/home2" />
     <property name="list.type.of.created.stylesheet" value="Less" />
     <property name="nodejs_package_manager_path" value="npm" />
     <property name="project.structure.last.edited" value="Problems" />
       <workItem from="1585434477042" duration="1802000" />
       <workItem from="1585667444927" duration="2130000" />
       <workItem from="1585852937701" duration="6000" />
-      <workItem from="1585852958281" duration="1865000" />
-    </task>
-    <task id="LOCAL-00270" summary=".">
-      <created>1578429849669</created>
-      <option name="number" value="00270" />
-      <option name="presentableId" value="LOCAL-00270" />
-      <option name="project" value="LOCAL" />
-      <updated>1578429849669</updated>
+      <workItem from="1585852958281" duration="1915000" />
+      <workItem from="1586006363270" duration="2364000" />
+      <workItem from="1586090290653" duration="248000" />
+      <workItem from="1586099772158" duration="2962000" />
+      <workItem from="1586418521676" duration="1255000" />
     </task>
     <task id="LOCAL-00271" summary=".">
       <created>1578472489576</created>
       <option name="project" value="LOCAL" />
       <updated>1585669021651</updated>
     </task>
-    <option name="localTasksCounter" value="319" />
+    <task id="LOCAL-00319" summary=".">
+      <created>1585899396649</created>
+      <option name="number" value="00319" />
+      <option name="presentableId" value="LOCAL-00319" />
+      <option name="project" value="LOCAL" />
+      <updated>1585899396650</updated>
+    </task>
+    <option name="localTasksCounter" value="320" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog" timestamp="1585852940968">
       <screen x="0" y="0" width="2560" height="1040" />
     </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="1585852940968" />
-    <state x="935" y="114" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1585668990500">
+    <state x="935" y="114" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1585899371621">
       <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" 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="1585668990500" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1585899371621" />
     <state x="92" y="92" width="2376" height="856" key="DiffContextDialog" timestamp="1580377344165">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="92" y="92" width="2376" height="856" key="DiffContextDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1580377344165" />
+    <state x="1060" y="275" key="FileChooserDialogImpl" timestamp="1586090325738">
+      <screen x="0" y="0" width="2560" height="1040" />
+    </state>
+    <state x="1060" y="275" key="FileChooserDialogImpl/0.0.2560.1040@0.0.2560.1040" timestamp="1586090325738" />
     <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1584290302981">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="836" y="443" key="NewPhpFileDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577363498855" />
     <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1584290302981" />
-    <state x="873" y="242" key="Vcs.Push.Dialog.v2" timestamp="1584350540478">
+    <state x="873" y="242" key="Vcs.Push.Dialog.v2" timestamp="1585899399605">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="873" y="242" key="Vcs.Push.Dialog.v2/0.0.2560.1040@0.0.2560.1040" timestamp="1584350540478" />
-    <state x="1456" y="240" key="com.intellij.ide.util.TipDialog" timestamp="1585852964408">
+    <state x="873" y="242" key="Vcs.Push.Dialog.v2/0.0.2560.1040@0.0.2560.1040" timestamp="1585899399605" />
+    <state x="1456" y="240" key="com.intellij.ide.util.TipDialog" timestamp="1586418523328">
       <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="1456" y="240" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1585852964408" />
+    <state x="1456" y="240" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1586418523328" />
     <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1584360859362">
       <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="1584360859362" />
     <state x="936" y="240" key="run.anything.popup" timestamp="1578386519646">
index c49c566740b73c30dbf62f824314c9e3cfc8c280..fa6509331ed34cc4c020d21d91f194b26ad51068 100644 (file)
@@ -91,19 +91,7 @@ function cronBackyard($cronmin)
 
 function cronFlowerPower($cronmin)
 {
-    $fp = explode("\n", trim(`sudo /usr/local/bin/flowerpower`));
-    $map = [2 => 1467, 0 => 1468];
-    foreach ($map as $k => $v) {
-        $newValue = $fp[$k];
-        if ($v === 1467) {
-            $newValue = (float)$newValue;
-            $currentValue = toNumber(getDomoticzDeviceStatus(1467), false);
-            if (abs($currentValue - $newValue) > 30 || $newValue == 0 || $newValue > 60 || $newValue < -50) {
-                return;
-            }
-        }
-        domoticzCmd(['param' => 'udevice', 'idx' => $v, 'nvalue' => 0, 'svalue' => $newValue]);
-    }
+    updateFlowerPower();
 }
 
 function cronMediaLibrary($cronmin)
@@ -163,19 +151,6 @@ function cronSqueezeFavorites($cronmin)
     }
 }
 
-function toNumber($val, $round = false)
-{
-    if ($val === false) {
-        return '--';
-    }
-    $val = preg_replace('/[^0-9-.]/', '', $val);
-    $val = floatval($val);
-    if ($round) {
-        $val = round($val, $round === true ? 0 : $round);
-    }
-    return $val;
-}
-
 function cronWeather($cronmin)
 {
     $place = 2608449;
index ed74171c16903ed4c0d850923552a5d9fe51e00b..bb74c8f65479b116672bf5eba28fe91b11f304d3 100644 (file)
@@ -1,20 +1,4 @@
 <?php
 require_once "import.php";
 
-if (isset($_POST['data'])) {
-       $json = json_decode($_POST['data'], true);
-       print_r($json);
-
-       $adapter = getDbAdapter();
-       $table = new \Zend\Db\TableGateway\TableGateway('flowerpower', $adapter);
-
-       foreach ($json as $device => $d) {
-               foreach ($d as $name => $value) {
-                       if ($name == 'calibratedAirTemperature') {
-                               setState('airtemperature', $value);
-                       }
-                       $insert = array('device' => $device, 'name' => $name, 'value' => $value);
-                       $table->insert($insert);
-               }
-       }
-}
\ No newline at end of file
+updateFlowerPower();
\ No newline at end of file
diff --git a/scripts/lib/flowerpower.php b/scripts/lib/flowerpower.php
new file mode 100644 (file)
index 0000000..59ee32c
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+function updateFlowerPower()
+{
+    $fp = explode("\n", trim(`sudo /usr/local/bin/flowerpower`));
+    print_r($fp);
+    $map = [2 => 1467, 0 => 1468];
+    foreach ($map as $k => $v) {
+        $newValue = $fp[$k];
+        if ($v === 1467) {
+            $newValue = (float)$newValue;
+            $currentValue = toNumber(getDomoticzDeviceStatus(1467), false);
+            if (abs($currentValue - $newValue) > 30 || $newValue == 0 || $newValue > 60 || $newValue < -50) {
+                echo 'Out of bounds';
+                return;
+            }
+        }
+        domoticzCmd(['param' => 'udevice', 'idx' => $v, 'nvalue' => 0, 'svalue' => $newValue]);
+    }
+}
\ No newline at end of file
index 60de2734b2c7a4f64d032ade112a107094c923d7..2eb3ef357ff9a542e6fc37bb3b736ce70231bb28 100644 (file)
@@ -41,6 +41,7 @@ require_once ROOT . '/scripts/lib/ssh.php';
 require_once ROOT . '/scripts/lib/cachemedia.php';
 require_once ROOT . '/scripts/lib/ifttt.php';
 require_once ROOT . '/scripts/lib/router.php';
+require_once ROOT . '/scripts/lib/flowerpower.php';
 
 
 profile('Loaded libraries', __FILE__, __LINE__);
@@ -525,4 +526,17 @@ function isProcessRunning($process)
         return false;
     }
     return true;
+}
+
+function toNumber($val, $round = false)
+{
+    if ($val === false) {
+        return '--';
+    }
+    $val = preg_replace('/[^0-9-.]/', '', $val);
+    $val = floatval($val);
+    if ($round) {
+        $val = round($val, $round === true ? 0 : $round);
+    }
+    return $val;
 }
\ No newline at end of file
index 14e167014f77e71559b77646ba3788d4d3f9da1c..471eff04ed4ea0824a54d5cc14ad3a7720218031 100644 (file)
@@ -288,8 +288,6 @@ class mediaLibrary
         if (file_exists($x264)) {
             $p = $x264;
         }
-
-
         return str_replace('/volume1/Share', '', $p);
     }