From 572819410840c44ad8c19242be1c4581ee0df5e9 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sat, 13 Mar 2021 20:43:19 +0100 Subject: [PATCH] . --- .idea/workspace.xml | 45 ++++++++++++++++++--------------------- scripts/lib/climacell.php | 25 ++++++++++++++++++++++ scripts/lib/lib.php | 1 + scripts/lib/scenes.php | 2 +- 4 files changed, 48 insertions(+), 25 deletions(-) create mode 100644 scripts/lib/climacell.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d2b6a66..d3812fb 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,10 @@ - - + - - + + diff --git a/scripts/lib/climacell.php b/scripts/lib/climacell.php new file mode 100644 index 0000000..a45b67c --- /dev/null +++ b/scripts/lib/climacell.php @@ -0,0 +1,25 @@ +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 diff --git a/scripts/lib/lib.php b/scripts/lib/lib.php index 1ff58cc..55a55d0 100644 --- a/scripts/lib/lib.php +++ b/scripts/lib/lib.php @@ -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__); diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 3fe6b09..f009a5d 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -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], -- 2.39.5