From f6baebaa0f89c92610b9c0a9a962496271765c90 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 28 Feb 2024 11:40:31 +0100 Subject: [PATCH] . --- .docker/config/monit/conf.d/home | 6 ---- .docker/update | 1 - .idea/workspace.xml | 18 +++++++++--- bin/healthcheck | 2 +- bin/restart-logcat | 1 + bin/restarthome | 2 -- scripts/cron/cron.php | 6 +--- servers/domoticz.php | 41 -------------------------- servers/hue.php | 11 ++++--- servers/insteon.php | 49 -------------------------------- servers/squeezebox.php | 8 ++++-- 11 files changed, 30 insertions(+), 115 deletions(-) delete mode 100644 servers/domoticz.php delete mode 100644 servers/insteon.php diff --git a/.docker/config/monit/conf.d/home b/.docker/config/monit/conf.d/home index e3f92f5..f4a0cf2 100644 --- a/.docker/config/monit/conf.d/home +++ b/.docker/config/monit/conf.d/home @@ -4,12 +4,6 @@ check process home-hue start program = "/home/tortugahome/www/servers/startdaemon hue" stop program = "/home/tortugahome/www/servers/stopdaemon hue" -check process home-domoticz - with pidfile "/var/run/home-domoticz.pid" - group homeautomation - start program = "/home/tortugahome/www/servers/startdaemon domoticz" - stop program = "/home/tortugahome/www/servers/stopdaemon domoticz" - check process home-cron with pidfile "/var/run/home-cron.pid" group homeautomation diff --git a/.docker/update b/.docker/update index 006bc7f..dfd9159 100644 --- a/.docker/update +++ b/.docker/update @@ -8,5 +8,4 @@ docker-compose build --pull docker-compose pull docker-compose down docker-compose up -d -#docker exec -it tortugahome /application/bin/restarthome docker restart nginx-proxy diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1fe400e..48761f9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,9 +5,17 @@ - + + - + + + + + + + + diff --git a/bin/healthcheck b/bin/healthcheck index d5f1267..b7218ff 100644 --- a/bin/healthcheck +++ b/bin/healthcheck @@ -2,7 +2,7 @@ igbget($q); - if (!is_array($queue)) { - $queue = []; - $redis->igbset($q, $queue); - } - if (!count($queue)) { - echo 'End processing queue' . "\n"; - break; - } - - $command = array_shift($queue); - $redis->igbset($q, $queue); - echo 'Run command ' . json_encode($command) . "\n"; - runDomoticzCommand($command); - usleep(1000000 * 0.25); - } -} \ No newline at end of file diff --git a/servers/hue.php b/servers/hue.php index 23242fc..4928f54 100644 --- a/servers/hue.php +++ b/servers/hue.php @@ -10,11 +10,10 @@ ignore_user_abort(true); echo 'Run hue server hue' . "\n"; $redis = connectRedis(); -handleHueQueue(); - redisEventListener('hue_event', 'handleHueQueue'); +handleHueQueue(true); -function handleHueQueue() +function handleHueQueue($init = false) { global $redis; @@ -29,6 +28,10 @@ function handleHueQueue() if (!count($queue)) { echo 'Queue empty ' . "\n"; + if ($init) { + sleep(30); + continue; + } break; } @@ -43,7 +46,7 @@ function handleHueQueue() echo 'Run command ' . json_encode($command) . "\n"; try { _hueCommand($command); - }catch (Exception $e){ + } catch (Exception $e) { } usleep(1000000 * 0.1); diff --git a/servers/insteon.php b/servers/insteon.php deleted file mode 100644 index 6693af9..0000000 --- a/servers/insteon.php +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/php - -igbget('insteon_queue'); - if (!is_array($queue)) { - $queue = []; - $redis->igbset('insteon_queue', $queue); - } - - - if (!count($queue)) { - echo 'Queue empty ' . "\n"; - break; - } - - $queue = array_unique($queue); - - echo 'Handle Queue : current state ' . json_encode($queue) . "\n"; - - $command = array_shift($queue); - $redis->igbset('insteon_queue', $queue); - echo 'Run command ' . $command . "\n"; - if ($command == 'knock') { - insteonKnock(); - continue; - } - runInsteonCommand($command); - usleep(1000000 * 0.5); - } - echo 'End of handling queue' . "\n"; -} \ No newline at end of file diff --git a/servers/squeezebox.php b/servers/squeezebox.php index 60d11a3..84c6688 100644 --- a/servers/squeezebox.php +++ b/servers/squeezebox.php @@ -13,9 +13,9 @@ echo 'Run home server squeezebox' . "\n"; $redis = connectRedis(); redisEventListener('squeezebox_event', 'handleSqueezeboxQueue'); -handleSqueezeboxQueue(); +handleSqueezeboxQueue(true); -function handleSqueezeboxQueue() +function handleSqueezeboxQueue($init = false) { global $redis, $processingSqueezeboxQueue; @@ -37,6 +37,10 @@ function handleSqueezeboxQueue() } if (!count($queue)) { echo 'End processing queue :)' . "\n"; + if ($init) { + sleep(30); + continue; + } $processingSqueezeboxQueue = false; break; } -- 2.39.5