</component>
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
- <change afterPath="$PROJECT_DIR$/scripts/cron/traffic.php" afterDir="false" />
+ <change afterPath="$PROJECT_DIR$/scripts/automodes.php" afterDir="false" />
+ <change afterPath="$PROJECT_DIR$/scripts/lib/automodes.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/scripts/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/scripts/lib/traffic.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/traffic.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/scripts/lib/velib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/velib.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" />
<workItem from="1688808953960" duration="594000" />
<workItem from="1688849303515" duration="1558000" />
<workItem from="1688897001591" duration="22890000" />
- <workItem from="1689010387612" duration="1396000" />
+ <workItem from="1689010387612" duration="1878000" />
+ <workItem from="1689026578748" duration="401000" />
</task>
<task id="LOCAL-00502" summary=".">
<created>1641726946298</created>
<option name="project" value="LOCAL" />
<updated>1687259667913</updated>
</task>
- <option name="localTasksCounter" value="569" />
+ <option name="localTasksCounter" value="570" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<MESSAGE value="." />
<option name="LAST_COMMIT_MESSAGE" value="." />
</component>
- <component name="XDebuggerManager">
- <breakpoint-manager>
- <breakpoints>
- <line-breakpoint enabled="true" type="php">
- <url>file://$PROJECT_DIR$/scripts/lib/lib.php</url>
- <line>98</line>
- <option name="timeStamp" value="1" />
- </line-breakpoint>
- </breakpoints>
- </breakpoint-manager>
- </component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
--- /dev/null
+<?php
+require_once "import.php";
+if (isset($_GET['disable'])) {
+ disableAutoModes($_GET['disable']);
+}
+if (isset($_GET['enable'])) {
+ enableAutoModes();
+}
\ No newline at end of file
--- /dev/null
+<?php
+
+function disableAutoModes($duration) {
+ setState('disable_auto_modes', time() + $duration);
+}
+
+function enableAutoModes() {
+ setState('disable_auto_modes', 0);
+}
+
+function isAutoModeEnabled() {
+ return getState('disable_auto_modes', 0) < time();
+}
+
+
+function autoRooms() {
+ if (isAutoModeEnabled()) {
+ if (getState('bureauAutoMode') == '1') {
+ updateBureauAuto();
+ }
+ if (getState('chambreAutoMode') == '1') {
+ updateChambreAuto();
+ }
+ if (getState('courAutoMode') == '1') {
+ updateCourAuto();
+ }
+ if (getState('salonAutoMode') == '1') {
+ updateSalonAuto();
+ }
+ updateCuisine();
+ }
+ checkPlanetarium();
+ checkWCVMC();
+}
+
+function updateBureauAuto() {
+ if (getState('bureauOff') == '1') {
+ execScene('bureau/off');
+ return;
+ }
+ if (getState('bureauAutoMode') != '1') {
+ return;
+ }
+ $hours = intval(date('H'));
+ if ($hours <= 4) {
+ $scene = 'outrun';
+ } else if ($hours <= 9) {
+ $scene = 'boreal';
+ } else if ($hours <= 11) {
+ $scene = 'tonic';
+ } else if ($hours <= 14) {
+ $scene = 'flowers';
+ } else if ($hours <= 18) {
+ $scene = 'beach';
+ } else if ($hours <= 22) {
+ $scene = 'tropical';
+ } else {
+ $scene = 'outrun';
+ }
+ execScene('bureau/' . $scene);
+}
+
+function updateCuisine() {
+ $salon = getState('salon', 'off');
+ if ($salon === 'day' || $salon === 'on' || $salon === 'off' || $salon === 'tamise') {
+ execScene('cuisine/base/on');
+ } else if ($salon == 'cinema') {
+ execScene('cuisine/tamise');
+ }
+}
+
+function updateCourAuto() {
+ $h = date('H');
+ if ($h >= 7) {
+ execScene('cour/projecteurs/off');
+ } else {
+ execScene('cour/projecteurs/on');
+ }
+ if (getState('courOff') == '1') {
+ execScene('cour/off');
+ return;
+ }
+ if (getState('courAutoMode') != '1') {
+ return;
+ }
+ if (isDay()) {
+ $scene = 'daylight';
+ } else {
+ $scene = 'lumineux';
+ }
+ execScene('cour/' . $scene);
+}
+
+function salonAuto($on = true) {
+ if ($on) {
+ setState('salonOff', '0');
+ setState('salonAutoMode', '1');
+ updateSalonAuto();
+ } else if (getState('salonAutoMode') === '1') {
+ setState('salonAutoMode', '0');
+ }
+}
+
+function chambreAuto($on = true, $transitionTime = null) {
+ if ($on) {
+ ecoMode(0);
+ setState('chambreAutoMode', '1');
+ updateChambreAuto($transitionTime);
+ } else if (getState('chambreAutoMode') === '1') {
+ setState('chambreAutoMode', '0');
+ }
+}
+
+function bureauAuto($on = true) {
+ if ($on) {
+ setState('bureauAutoMode', '1');
+ updateBureauAuto();
+ } else {
+ setState('bureauAutoMode', '0');
+ }
+}
+
+function courAuto($on = true) {
+ if ($on) {
+ setState('courAutoMode', '1');
+ updateCourAuto();
+ } else {
+ setState('courAutoMode', '0');
+ }
+}
+
+function updateSalonAuto() {
+ if (getState('salonOff') == '1') {
+ execScene('salon/off');
+ return;
+ }
+ if (getState('salonAutoMode') != '1') {
+ return;
+ }
+ $d = date('w');
+ $hours = intval(date('H'));
+ if ($d < 5) {
+ if ($hours <= 9) {
+ $scene = 'tamise';
+ } else if ($hours <= 22) {
+ $scene = 'day';
+ } else {
+ $scene = 'tamise';
+ }
+ } else {
+ if ($hours <= 9) {
+ $scene = 'tamise';
+ } else {
+ $scene = 'day';
+ }
+ }
+ execScene('salon/' . $scene, false);
+}
+
+function updateChambreAuto($transitionTime = null) {
+ if (getState('chambreOff') == '1') {
+ execScene('chambre/off');
+ return;
+ }
+ if (getState('chambreAutoMode') != '1') {
+ return;
+ }
+ $hours = intval(date('H'));
+ if ($hours <= 4) {
+ $scene = 'party';
+ } else if ($hours <= 9) {
+ $scene = 'boreal';
+ } else if ($hours <= 11) {
+ $scene = 'tonic';
+ } else if ($hours <= 14) {
+ $scene = 'flowers';
+ } else if ($hours <= 18) {
+ $scene = 'beach';
+ } else if ($hours <= 22) {
+ $scene = 'tropical';
+ } else {
+ $scene = 'party';
+ }
+ execScene('chambre/' . $scene, false, $transitionTime);
+}
require_once ROOT . '/scripts/lib/profile.php';
require_once ROOT . "/config/global.php";
require_once ROOT . '/config/rooms.php';
+require_once ROOT . '/scripts/lib/automodes.php';
require_once ROOT . '/scripts/lib/homeassistant.php';
require_once ROOT . '/scripts/lib/redis.php';
require_once ROOT . '/scripts/lib/state.php';
sshCommand($cmd, 'litjerome');
}
-function salonAuto($on = true) {
- if ($on) {
- setState('salonOff', '0');
- setState('salonAutoMode', '1');
- updateSalonAuto();
- } else if (getState('salonAutoMode') === '1') {
- setState('salonAutoMode', '0');
- }
-}
-
-function chambreAuto($on = true, $transitionTime = null) {
- if ($on) {
- ecoMode(0);
- setState('chambreAutoMode', '1');
- updateChambreAuto($transitionTime);
- } else if (getState('chambreAutoMode') === '1') {
- setState('chambreAutoMode', '0');
- }
-}
-
-function bureauAuto($on = true) {
- if ($on) {
- setState('bureauAutoMode', '1');
- updateBureauAuto();
- } else {
- setState('bureauAutoMode', '0');
- }
-}
-
-function courAuto($on = true) {
- if ($on) {
- setState('courAutoMode', '1');
- updateCourAuto();
- } else {
- setState('courAutoMode', '0');
- }
-}
-function updateSalonAuto() {
- if (getState('salonOff') == '1') {
- execScene('salon/off');
- return;
- }
- if (getState('salonAutoMode') != '1') {
- return;
- }
- $d = date('w');
- $hours = intval(date('H'));
- if ($d < 5) {
- if ($hours <= 9) {
- $scene = 'tamise';
- } else if ($hours <= 22) {
- $scene = 'day';
- } else {
- $scene = 'tamise';
- }
- } else {
- if ($hours <= 9) {
- $scene = 'tamise';
- } else {
- $scene = 'day';
- }
- }
- execScene('salon/' . $scene, false);
-}
-
-function updateChambreAuto($transitionTime = null) {
- if (getState('chambreOff') == '1') {
- execScene('chambre/off');
- return;
- }
- if (getState('chambreAutoMode') != '1') {
- return;
- }
- $hours = intval(date('H'));
- if ($hours <= 4) {
- $scene = 'party';
- } else if ($hours <= 9) {
- $scene = 'boreal';
- } else if ($hours <= 11) {
- $scene = 'tonic';
- } else if ($hours <= 14) {
- $scene = 'flowers';
- } else if ($hours <= 18) {
- $scene = 'beach';
- } else if ($hours <= 22) {
- $scene = 'tropical';
- } else {
- $scene = 'party';
- }
- execScene('chambre/' . $scene, false, $transitionTime);
-}
-
-function updateBureauAuto() {
- if (getState('bureauOff') == '1') {
- execScene('bureau/off');
- return;
- }
- if (getState('bureauAutoMode') != '1') {
- return;
- }
- $hours = intval(date('H'));
- if ($hours <= 4) {
- $scene = 'outrun';
- } else if ($hours <= 9) {
- $scene = 'boreal';
- } else if ($hours <= 11) {
- $scene = 'tonic';
- } else if ($hours <= 14) {
- $scene = 'flowers';
- } else if ($hours <= 18) {
- $scene = 'beach';
- } else if ($hours <= 22) {
- $scene = 'tropical';
- } else {
- $scene = 'outrun';
- }
- execScene('bureau/' . $scene);
-}
-
-function updateCuisine() {
- $salon = getState('salon', 'off');
- if ($salon === 'day' || $salon === 'on' || $salon === 'off' || $salon === 'tamise') {
- execScene('cuisine/base/on');
- } else if ($salon == 'cinema') {
- execScene('cuisine/tamise');
- }
-}
-
-function updateCourAuto() {
- $h = date('H');
- if ($h >= 7) {
- execScene('cour/projecteurs/off');
- } else {
- execScene('cour/projecteurs/on');
- }
- if (getState('courOff') == '1') {
- execScene('cour/off');
- return;
- }
- if (getState('courAutoMode') != '1') {
- return;
- }
- if (isDay()) {
- $scene = 'daylight';
- } else {
- $scene = 'lumineux';
- }
- execScene('cour/' . $scene);
-}
function wcVMCOn() {
setState('lastVMCOn', time());
}
}
-
-function autoRooms() {
- if (getState('bureauAutoMode') == '1') {
- updateBureauAuto();
- }
- if (getState('chambreAutoMode') == '1') {
- updateChambreAuto();
- }
- if (getState('courAutoMode') == '1') {
- updateCourAuto();
- }
- if (getState('salonAutoMode') == '1') {
- updateSalonAuto();
- }
- updateCuisine();
- checkPlanetarium();
- checkWCVMC();
-}
\ No newline at end of file