]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sat, 13 Mar 2021 19:43:19 +0000 (20:43 +0100)
committerVincent <vincent@enhydra.fr>
Sat, 13 Mar 2021 19:43:19 +0000 (20:43 +0100)
.idea/workspace.xml
scripts/lib/climacell.php [new file with mode: 0644]
scripts/lib/lib.php
scripts/lib/scenes.php

index d2b6a665fd4b013b2d25a6891a423110dbd303f7..d3812fba1809360e435e9514ce40c862161f0274 100644 (file)
@@ -2,11 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/images/switch.png" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/switch.php" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/scripts/lib/climacell.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/media.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/media.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/pcgames.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/pcgames.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" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <property name="editor.config.ad.shown" value="true" />
     <property name="last_opened_file_path" value="$PROJECT_DIR$/images" />
     <property name="list.type.of.created.stylesheet" value="Less" />
+    <property name="node.js.detected.package.eslint" value="true" />
+    <property name="node.js.detected.package.tslint" value="true" />
+    <property name="node.js.path.for.package.eslint" value="project" />
+    <property name="node.js.path.for.package.tslint" value="project" />
+    <property name="node.js.selected.package.eslint" value="(autodetect)" />
+    <property name="node.js.selected.package.tslint" value="(autodetect)" />
     <property name="nodejs_package_manager_path" value="npm" />
     <property name="project.structure.last.edited" value="Problems" />
     <property name="project.structure.proportion" value="0.15" />
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
-      <option name="arquillianRunConfiguration">
-        <value>
-          <option name="containerStateName" value="" />
-        </value>
-      </option>
-      <option name="TEST_OBJECT" value="class" />
-      <method v="2">
-        <option name="Make" enabled="true" />
-      </method>
-    </configuration>
     <configuration default="true" type="ArquillianTestNG" factoryName="">
       <option name="arquillianRunConfiguration">
         <value>
       <workItem from="1613594262179" duration="860000" />
       <workItem from="1613737644524" duration="2679000" />
       <workItem from="1613767930279" duration="780000" />
-      <workItem from="1613993901536" duration="33445000" />
-    </task>
-    <task id="LOCAL-00406" summary=".">
-      <created>1605973216961</created>
-      <option name="number" value="00406" />
-      <option name="presentableId" value="LOCAL-00406" />
-      <option name="project" value="LOCAL" />
-      <updated>1605973216962</updated>
+      <workItem from="1613993901536" duration="34042000" />
+      <workItem from="1615115966365" duration="657000" />
+      <workItem from="1615272627869" duration="1428000" />
+      <workItem from="1615664533256" duration="33000" />
     </task>
     <task id="LOCAL-00407" summary=".">
       <created>1605976064822</created>
       <option name="project" value="LOCAL" />
       <updated>1614370268864</updated>
     </task>
-    <option name="localTasksCounter" value="455" />
+    <task id="LOCAL-00455" summary=".">
+      <created>1614761270670</created>
+      <option name="number" value="00455" />
+      <option name="presentableId" value="LOCAL-00455" />
+      <option name="project" value="LOCAL" />
+      <updated>1614761270671</updated>
+    </task>
+    <option name="localTasksCounter" value="456" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
diff --git a/scripts/lib/climacell.php b/scripts/lib/climacell.php
new file mode 100644 (file)
index 0000000..a45b67c
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+function _climacell($params, $ttl = 300)
+{
+    $cacheKey = 'climacell_' . hash('sha256', $params);
+    $redis = getRedisClient();
+    if (!$redis->exists($cacheKey)) {
+        $res = file_get_contents('https://data.climacell.co/v4/timelines?units=metric&apikey=95AtuwRGIISYHPleGTyY2bGhcJw7Yv3p&location=6044b50271ef6b0008d0848f&fields=temperature,humidity,windSpeed&' . $params);
+        $redis->set($cacheKey, $res, null, $ttl);
+    } else {
+        $res = $redis->get($cacheKey);
+    }
+    return json_decode($res);
+
+}
+
+function climacellCurrent()
+{
+    return _climacell('timesteps=1h', 300);
+}
+
+function climacellForecasts()
+{
+    return _climacell('timesteps=1d', 7200);
+}
\ No newline at end of file
index 1ff58cc5a733be0946a25a0451f3acc87912ee99..55a55d0fbf8514a3075a035a6e85cebb77b246ec 100644 (file)
@@ -46,6 +46,7 @@ require_once ROOT . '/scripts/lib/denon.php';
 require_once ROOT . '/scripts/lib/proc.php';
 require_once ROOT . '/scripts/lib/shield.php';
 require_once ROOT . '/scripts/lib/kodi.php';
+require_once ROOT . '/scripts/lib/climacell.php';
 
 
 profile('Loaded libraries', __FILE__, __LINE__);
index 3fe6b095376bda138d109ba8f927226993b3188a..f009a5db392fd8a53565f166ff22a393ff4d1fac 100644 (file)
@@ -705,7 +705,7 @@ $scenes = [
         ['type' => 'hue', 'group' => $cuisine, 'scene' => '44yXoQdJErFPksE']
     ],
     'cuisine/off' => [
-        ['type' => 'hue', 'group' => $cuisine, 'scene' => array('on' => false, 'brightness' => 0)]
+        //['type' => 'hue', 'group' => $cuisine, 'scene' => array('on' => false, 'brightness' => 0)]
     ],
     'cour/auto' => [
         ['type' => 'domoticz', 'device' => '678', 'command' => true],