From 62db3ba4282f9ef7e2098b353f54af16f3039d93 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 27 Mar 2026 14:46:24 +0100 Subject: [PATCH] . --- .idea/workspace.xml | 17 +++-- config/bureau.php | 16 ++--- config/rooms.php | 115 ++++++++++++++------------------ config/salon.php | 4 -- scripts/cron/cron.php | 7 -- scripts/lib/climacell.php | 25 ------- scripts/lib/lib.php | 3 - scripts/lib/router.php | 23 ------- scripts/lib/simplemode.php | 6 -- scripts/router_devices_list.php | 5 -- 10 files changed, 70 insertions(+), 151 deletions(-) delete mode 100644 scripts/lib/climacell.php delete mode 100644 scripts/lib/router.php delete mode 100644 scripts/lib/simplemode.php delete mode 100644 scripts/router_devices_list.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b2ca7b9..735343d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,9 +5,16 @@ - - - + + + + + + + + + + diff --git a/config/bureau.php b/config/bureau.php index e113fac..5ff1410 100644 --- a/config/bureau.php +++ b/config/bureau.php @@ -18,15 +18,13 @@ config('THEME', '#051039'); if (DISPLAYINTERFACE) { $c = bureau(); $shortcuts['lights'] = $c['all']; - if (!isSimpleMode()) { - $favoriteslights = [ - ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => ''], - ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => ''], - ]; - $favoriteslights = array_merge($favoriteslights, $c['favorites']); - } else { - $favoriteslights = $c['favorites']; - } + + $favoriteslights = [ + ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => ''], + ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => ''], + ]; + $favoriteslights = array_merge($favoriteslights, $c['favorites']); + include "default.php"; include ROOT . "/config/media.php"; diff --git a/config/rooms.php b/config/rooms.php index 7e94afc..b14e3a3 100644 --- a/config/rooms.php +++ b/config/rooms.php @@ -4,24 +4,19 @@ $rooms = array('home' => 'Maison', 'salon' => 'Salon', 'chambre' => 'Chambre', ' function chambre($additionnalfavorites = array()) { - if (isSimpleMode()) { - $favorites = [ - ['type' => 'light', 'scene' => 'chambre/matin', 'label' => 'Matin ★'], - ['type' => 'light', 'scene' => 'chambre/bedoff', 'label' => 'Au lit ☽'], - ]; - } else { - $favorites = [ - ['type' => 'light', 'scene' => 'home/aulit', 'label' => 'Au lit ☽'], - ['type' => 'light', 'scene' => 'chambre/matin', 'label' => 'Matin ★'], - ['type' => 'light', 'scene' => 'home/aulitoff', 'label' => 'Eteindre ☽'], - ['type' => 'light', 'scene' => 'chambre/bed', 'label' => 'Au lit'], - ['type' => 'light', 'scene' => 'chambre/sleep', 'label' => 'Nuit'], - ['type' => 'light', 'scene' => 'chambre/moon', 'label' => 'Clair de lune'], - ['type' => 'light', 'scene' => 'chambre/full', 'label' => 'Plein feu'], - ['type' => 'light', 'scene' => 'chambre/reading', 'label' => 'Lecture'], - ['type' => 'light', 'scene' => 'chambre/off', 'label' => 'Off'], - ]; - } + + $favorites = [ + ['type' => 'light', 'scene' => 'home/aulit', 'label' => 'Au lit ☽'], + ['type' => 'light', 'scene' => 'chambre/matin', 'label' => 'Matin ★'], + ['type' => 'light', 'scene' => 'home/aulitoff', 'label' => 'Eteindre ☽'], + ['type' => 'light', 'scene' => 'chambre/bed', 'label' => 'Au lit'], + ['type' => 'light', 'scene' => 'chambre/sleep', 'label' => 'Nuit'], + ['type' => 'light', 'scene' => 'chambre/moon', 'label' => 'Clair de lune'], + ['type' => 'light', 'scene' => 'chambre/full', 'label' => 'Plein feu'], + ['type' => 'light', 'scene' => 'chambre/reading', 'label' => 'Lecture'], + ['type' => 'light', 'scene' => 'chambre/off', 'label' => 'Off'], + ]; + $all = array_merge($favorites, [ ['type' => 'light', 'scene' => 'chambre/boreal', 'label' => 'Matin boréal'], @@ -52,18 +47,12 @@ function lit($additionnalfavorites = array()) function home() { - if (isSimpleMode()) { - $favorites = [ - ['type' => 'light', 'scene' => 'home/welcome', 'label' => 'Bienvenue'], - ['type' => 'light', 'scene' => 'home/off', 'label' => 'éteindre'], - ]; - } else { - $favorites = [ - ['type' => 'light', 'scene' => 'home/welcome/eco', 'label' => 'Bienvenue ðŸŒ¿', 'confirm' => ['message' => 'Quelqu\'un dort peut-être. Veuillez confirmer votre action.', 'conditions' => ['night' => '1']]], - ['type' => 'light', 'scene' => 'home/off', 'label' => 'éteindre'], - ['type' => 'light', 'scene' => 'home/welcome', 'label' => 'Bienvenue â˜…', 'confirm' => ['message' => 'Quelqu\'un dort peut-être. Veuillez confirmer votre action.', 'conditions' => ['night' => '1']]], - ]; - } + $favorites = [ + ['type' => 'light', 'scene' => 'home/welcome/eco', 'label' => 'Bienvenue ðŸŒ¿', 'confirm' => ['message' => 'Quelqu\'un dort peut-être. Veuillez confirmer votre action.', 'conditions' => ['night' => '1']]], + ['type' => 'light', 'scene' => 'home/off', 'label' => 'éteindre'], + ['type' => 'light', 'scene' => 'home/welcome', 'label' => 'Bienvenue â˜…', 'confirm' => ['message' => 'Quelqu\'un dort peut-être. Veuillez confirmer votre action.', 'conditions' => ['night' => '1']]], + ]; + $favorites = [ ['type' => 'light', 'scene' => 'home/welcome/eco', 'label' => 'Bienvenue ðŸŒ¿', 'confirm' => ['message' => 'Quelqu\'un dort peut-être. Veuillez confirmer votre action.', 'conditions' => ['night' => '1']]], ['type' => 'light', 'scene' => 'home/off', 'label' => 'éteindre'], @@ -85,15 +74,15 @@ function salon() ['type' => 'light', 'scene' => 'salon/lumineux', 'label' => 'lumineux'], ]; - if (!isSimpleMode()) { - $favorites = array_merge($favorites, [['type' => 'light', 'scene' => 'salon/day', 'label' => 'journée'], - ['type' => 'light', 'scene' => 'salon/lumineux', 'label' => 'lumineux'], - ['type' => 'light', 'scene' => 'salon/cineclub', 'label' => 'cinéma de minuit'], - ['type' => 'light', 'scene' => 'salon/tamise', 'label' => 'Tamisé'], - ['type' => 'light', 'scene' => 'salon/lecturenocture', 'label' => 'Lecture nocturne'], - ['type' => 'light', 'scene' => 'salon/cheminee', 'label' => 'Cheminée'], - ['type' => 'light', 'scene' => 'salon/bar/toggle', 'label' => 'Bar']]); - } + + $favorites = array_merge($favorites, [['type' => 'light', 'scene' => 'salon/day', 'label' => 'journée'], + ['type' => 'light', 'scene' => 'salon/lumineux', 'label' => 'lumineux'], + ['type' => 'light', 'scene' => 'salon/cineclub', 'label' => 'cinéma de minuit'], + ['type' => 'light', 'scene' => 'salon/tamise', 'label' => 'Tamisé'], + ['type' => 'light', 'scene' => 'salon/lecturenocture', 'label' => 'Lecture nocturne'], + ['type' => 'light', 'scene' => 'salon/cheminee', 'label' => 'Cheminée'], + ['type' => 'light', 'scene' => 'salon/bar/toggle', 'label' => 'Bar']]); + $all = array_merge($favorites, [['type' => 'separator', 'label' => 'Projecteur'], ['type' => 'light', 'scene' => 'salon/projector/on', 'label' => 'Allumer'], @@ -110,12 +99,12 @@ function bureau() ['type' => 'light', 'scene' => 'bureau/teletravail', 'label' => 'Télétravail'], ]; - if (!isSimpleMode()) { - $favorites = array_merge($favorites, ['type' => 'light', 'scene' => 'bureau/lumineux', 'label' => 'Lumineux'], - ['type' => 'light', 'scene' => 'bureau/lounge', 'label' => 'Lounge'], - ['type' => 'light', 'scene' => 'bureau/tamise', 'label' => 'Tamise'], - ['type' => 'light', 'scene' => 'bureau/veilleuse', 'label' => 'Veilleuse']); - } + + $favorites = array_merge($favorites, ['type' => 'light', 'scene' => 'bureau/lumineux', 'label' => 'Lumineux'], + ['type' => 'light', 'scene' => 'bureau/lounge', 'label' => 'Lounge'], + ['type' => 'light', 'scene' => 'bureau/tamise', 'label' => 'Tamise'], + ['type' => 'light', 'scene' => 'bureau/veilleuse', 'label' => 'Veilleuse']); + $all = array_merge($favorites, [ ['type' => 'light', 'scene' => 'bureau/boreal', 'label' => 'Aurore boréale'], @@ -161,12 +150,12 @@ function sdb() $favorites = [ ]; - if (!isSimpleMode()) { - $favorites = array_merge($favorites, ['type' => 'light', 'scene' => 'sdb/on', 'label' => 'Allumer'], - ['type' => 'light', 'scene' => 'sdb/off', 'label' => 'éteindre'], - ['type' => 'light', 'scene' => 'sdb/spa', 'label' => 'spa'], - ['type' => 'light', 'scene' => 'sdb/nuit', 'label' => 'nuit'],); - } + + $favorites = array_merge($favorites, ['type' => 'light', 'scene' => 'sdb/on', 'label' => 'Allumer'], + ['type' => 'light', 'scene' => 'sdb/off', 'label' => 'éteindre'], + ['type' => 'light', 'scene' => 'sdb/spa', 'label' => 'spa'], + ['type' => 'light', 'scene' => 'sdb/nuit', 'label' => 'nuit'],); + $all = array_merge($favorites, [ ]); @@ -193,20 +182,18 @@ function wc() function cour() { $favorites = []; - if (!isSimpleMode()) { - $favorites = [ - ['type' => 'light', 'scene' => 'cour/auto', 'label' => 'Allumer'], - ['type' => 'light', 'scene' => 'cour/off', 'label' => 'éteindre'], - ['type' => 'light', 'scene' => 'cour/lumineux', 'label' => 'lumineux'], - ['type' => 'light', 'scene' => 'cour/daylight', 'label' => 'jour'], - ['type' => 'light', 'scene' => 'cour/grow', 'label' => 'croissance'], - ['type' => 'light', 'scene' => 'cour/tropical', 'label' => 'crépuscule tropical'], - ['type' => 'separator', 'label' => 'Projecteurs'], - ['type' => 'light', 'scene' => 'cour/projecteurs/on', 'label' => 'Allumer'], - ['type' => 'light', 'scene' => 'cour/projecteurs/off', 'label' => 'éteindre'], - ]; - } + $favorites = [ + ['type' => 'light', 'scene' => 'cour/auto', 'label' => 'Allumer'], + ['type' => 'light', 'scene' => 'cour/off', 'label' => 'éteindre'], + ['type' => 'light', 'scene' => 'cour/lumineux', 'label' => 'lumineux'], + ['type' => 'light', 'scene' => 'cour/daylight', 'label' => 'jour'], + ['type' => 'light', 'scene' => 'cour/grow', 'label' => 'croissance'], + ['type' => 'light', 'scene' => 'cour/tropical', 'label' => 'crépuscule tropical'], + ['type' => 'separator', 'label' => 'Projecteurs'], + ['type' => 'light', 'scene' => 'cour/projecteurs/on', 'label' => 'Allumer'], + ['type' => 'light', 'scene' => 'cour/projecteurs/off', 'label' => 'éteindre'], + ]; $all = array_merge($favorites, [ diff --git a/config/salon.php b/config/salon.php index 4a243ed..bc9a654 100644 --- a/config/salon.php +++ b/config/salon.php @@ -23,10 +23,6 @@ if (DISPLAYINTERFACE) { ]; $favoriteslights = array_merge($favoriteslights, $c['favorites']); - if (isSimpleMode()) { - $favoriteslights = $c['favorites']; - } - include "default.php"; include ROOT . "/config/media.php"; diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index bc15521..bb23035 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -17,7 +17,6 @@ function cronOneLoop($cronmin) } if ($cronmin % 5 == 0) { - cronGuest($cronmin); cronShield($cronmin); } @@ -43,12 +42,6 @@ function cronShield($cronmin) `/usr/local/bin/adb-connect`; } -function cronGuest($cronmin) -{ - - _logSection('Guest'); - setState('guest', hasGuest() ? '1' : '0'); -} function cronEcoMode($cronmin) { diff --git a/scripts/lib/climacell.php b/scripts/lib/climacell.php deleted file mode 100644 index a45b67c..0000000 --- a/scripts/lib/climacell.php +++ /dev/null @@ -1,25 +0,0 @@ -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 e6de39a..318189d 100644 --- a/scripts/lib/lib.php +++ b/scripts/lib/lib.php @@ -6,7 +6,6 @@ $endQueue = []; require_once ROOT . '/vendor/autoload.php'; require_once ROOT . "/config/global.php"; require_once ROOT . '/config/rooms.php'; -require_once ROOT . '/scripts/lib/simplemode.php'; require_once ROOT . '/scripts/lib/automodes.php'; require_once ROOT . '/scripts/lib/homeassistant.php'; require_once ROOT . '/scripts/lib/redis.php'; @@ -28,11 +27,9 @@ require_once ROOT . '/scripts/lib/weatherstation.php'; require_once ROOT . '/scripts/lib/heartbeats.php'; require_once ROOT . '/scripts/lib/ssh.php'; require_once ROOT . '/scripts/lib/cachemedia.php'; -require_once ROOT . '/scripts/lib/router.php'; 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/climacell.php'; require_once ROOT . '/scripts/lib/wol.php'; require_once ROOT . '/scripts/lib/windows.php'; diff --git a/scripts/lib/router.php b/scripts/lib/router.php deleted file mode 100644 index 41b50d8..0000000 --- a/scripts/lib/router.php +++ /dev/null @@ -1,23 +0,0 @@ - time()], ['admin', 'BDQw479qbJST4u']); -// } catch (Exception $e) { -// return []; -// } -// // echo $res->getBody(); -// if (preg_match('/dhcpd_lease = ([^;]+);/m', $res->getBody(), $dhcp)) { -// if (preg_match_all('/192\.168\.13\.[0-9]{1,3}/', $dhcp[1], $matches)) { -// return $matches[0]; -// } -// } - return []; -} - -function hasGuest() -{ - $guests = ['192.168.13.150', '192.168.13.151', '192.168.13.152', '192.168.13.153']; - return count(array_intersect(routerDevicesList(), $guests)) > 0; -} \ No newline at end of file diff --git a/scripts/lib/simplemode.php b/scripts/lib/simplemode.php deleted file mode 100644 index e97c524..0000000 --- a/scripts/lib/simplemode.php +++ /dev/null @@ -1,6 +0,0 @@ -