From: vincent Date: Sun, 9 Jan 2022 11:15:46 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a96d53c064991fbc689cb04f81dc086211a4966e;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f3c0c15..dba61a5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,12 +3,11 @@ - - - - - - + + + + + diff --git a/install.md b/install.md index dd8c816..aaf2cbf 100644 --- a/install.md +++ b/install.md @@ -1,6 +1,6 @@ `sudo add-apt-repository ppa:ondrej/php;sudo add-apt-repository ppa:ondrej/apache2;sudo apt-get update` -`apt update;apt install composer python3-certbot-apache wakeonlan adb lynx at redis php7.4-fpm php7.4-opcache php7.4-json php7.4-xml php7.4-curl php7.4-redis php7.4-igbinary php7.4-ssh2 php7.4-soap php7.4-sockets php7.4-mysql php7.4-gd php7.4-exif php7.4-imap php7.4-mbstring ` +`apt update;apt install composer python3-certbot-apache wakeonlan adb lynx at redis php7.4-fpm php7.4-opcache php7.4-json php7.4-xml php7.4-curl php7.4-redis php7.4-igbinary php7.4-ssh2 php7.4-soap php7.4-sockets php7.4-mysql php7.4-gd php7.4-exif php7.4-imap php7.4-mbstring xplanet` `useradd --gid www-data --shell /bin/bash tortugahome` `mkdir -p /var/log/tortugahome/profiles/;chown -R tortugahome:www-data /var/log/tortugahome` diff --git a/scripts/ecomode.php b/scripts/ecomode.php index ead63bf..7719e71 100644 --- a/scripts/ecomode.php +++ b/scripts/ecomode.php @@ -15,8 +15,6 @@ ob_end_clean(); $res = getEcoMode(); -if (!$res && in_array(config('DEVICE'), ['bureau', 'bureausun'])) { - $res = getDomoticzDeviceStatus(391) === 'Closed' ? '1' : '0'; -} + die($res); diff --git a/scripts/lib/ecomode.php b/scripts/lib/ecomode.php index a6fa483..cf914dc 100644 --- a/scripts/lib/ecomode.php +++ b/scripts/lib/ecomode.php @@ -10,7 +10,7 @@ function ecoMode($mode = null, $force = false) if (!$force && $mode == $currentMode) { return; } - echo 'switch eco mode :: force ('.$force.') :: (' . $mode . ') :: former (' . $currentMode . ')' . "\n"; + echo 'switch eco mode :: force (' . $force . ') :: (' . $mode . ') :: former (' . $currentMode . ')' . "\n"; setState('triggeredEcomode', $mode); $scenes = [0 => 'off', 1 => 'on', 2 => 'super']; @@ -32,18 +32,43 @@ function nightmode($mode) function getNightMode() { - if(config('DEVICE')==='sdb'){ - $h=date('G'); - if($h>6 && $h<21){ + $device = config('DEVICE'); + if ($device === 'sdb') { + $h = date('G'); + if ($h > 6 && $h < 21) { return false; } } + if ($device === 'salon') { + if (getState('salon') !== 'off') { + return false; + } + } + if ($device === 'bureau' || $device === 'bureausun') { + if (getDomoticzDeviceStatus(391) === 'Closed') { + return true; + } + if (getState('bureau_gradient') !== 'off') { + return false; + } + } + if ($device === 'entree' || $device === 'cuisine') { + $lights = [15, 18, 1, 58, 59, 57, 56, 55, 37]; + $hueLights = getHueInstance()->getLights(); + foreach ($lights as $l) { + $light = $hueLights[$l]; + if ($light->isReachable() && $light->isOn()) { + return false; + } + } + + } return getState('night') == '1'; } function getEcoMode() { - $res = getState('ecomode','0'); + $res = getState('ecomode', '0'); if ($res == '0' && getNightMode()) { $res = '1'; } diff --git a/tools/xplanet/xplanet-earth b/tools/xplanet/xplanet-earth index 6c39284..a731fb2 100644 --- a/tools/xplanet/xplanet-earth +++ b/tools/xplanet/xplanet-earth @@ -1,4 +1,4 @@ #!/bin/sh month=$(date +%m) -ln -sf "/var/www/home/tools/xplanet/world.topo.bathy.2004$month.3x5400x2700.png" "/var/www/home/tools/xplanet/earth.png" -xplanet -config /var/www/home/tools/xplanet/config -longitude 2.3343236 -latitude 36 -geometry 300x300 -num_times 1 -output /var/www/home/images/earth.png \ No newline at end of file +ln -sf "/home/tortugahome/www/tools/xplanet/world.topo.bathy.2004$month.3x5400x2700.png" "/home/tortugahome/www/tools/xplanet/earth.png" +xplanet -config /home/tortugahome/www/tools/xplanet/config -longitude 2.3343236 -latitude 36 -geometry 300x300 -num_times 1 -output /home/tortugahome/www/images/earth.png \ No newline at end of file diff --git a/tools/xplanet/xplanet-suncurve b/tools/xplanet/xplanet-suncurve index 2661e43..0241cb3 100644 --- a/tools/xplanet/xplanet-suncurve +++ b/tools/xplanet/xplanet-suncurve @@ -1,4 +1,4 @@ #!/bin/sh month=$(date +%m) -ln -sf "/var/www/home/tools/xplanet/world.topo.bathy.2004$month.3x5400x2700.png" "/var/www/home/tools/xplanet/earth.png" -xplanet -config /var/www/home/tools/xplanet/config -longitude 2.3343236 -geometry 1600x1200 -projection rectangular -num_times 1 -output /var/www/home/images/suncurve.png \ No newline at end of file +ln -sf "/home/tortugahome/www/tools/xplanet/world.topo.bathy.2004$month.3x5400x2700.png" "/home/tortugahome/www/tools/xplanet/earth.png" +xplanet -config /home/tortugahome/www/tools/xplanet/config -longitude 2.3343236 -geometry 1600x1200 -projection rectangular -num_times 1 -output /home/tortugahome/www/images/suncurve.png \ No newline at end of file