<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/config/rooms.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/rooms.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/scripts/domoticz_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_device_event.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/config/water.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/water.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/hotwater.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/hotwater.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/redis.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/redis.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/lib/switchbot.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/switchbot.php" afterDir="false" />
</list>
<workItem from="1666880430659" duration="1177000" />
<workItem from="1667037570905" duration="1563000" />
<workItem from="1667739527547" duration="1293000" />
- <workItem from="1668006276656" duration="977000" />
- </task>
- <task id="LOCAL-00492" summary=".">
- <created>1639205467698</created>
- <option name="number" value="00492" />
- <option name="presentableId" value="LOCAL-00492" />
- <option name="project" value="LOCAL" />
- <updated>1639205467698</updated>
+ <workItem from="1668006276656" duration="1860000" />
+ <workItem from="1668260964528" duration="1497000" />
</task>
<task id="LOCAL-00493" summary=".">
<created>1639302540066</created>
<option name="project" value="LOCAL" />
<updated>1667752233866</updated>
</task>
- <option name="localTasksCounter" value="541" />
+ <task id="LOCAL-00541" summary=".">
+ <created>1668013144815</created>
+ <option name="number" value="00541" />
+ <option name="presentableId" value="LOCAL-00541" />
+ <option name="project" value="LOCAL" />
+ <updated>1668013144815</updated>
+ </task>
+ <option name="localTasksCounter" value="542" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<?php
$shortcuts['water'] = [
- ['type' => 'light', 'scene' => 'sdb/hotwater/auto', 'label' => 'Auto'],
+ ['type' => 'light', 'scene' => 'sdb/hotwater/auto/force', 'label' => 'Auto'],
['type' => 'light', 'scene' => 'sdb/hotwater/eco', 'label' => 'Eco'],
['type' => 'light', 'scene' => 'sdb/hotwater/max', 'label' => 'Max'],
['type' => 'light', 'scene' => 'sdb/hotwater/off', 'label' => 'Off'],
<?php
require_once "import.php";
echo "\n\n";
-hotwaterCheckMode();
+hotwaterCheckMode(true);
echo "\n\n";
echo getState('hotwater');
if (isset($_GET['on'])) {
* @param $closure Closure
* @return mixed
*/
-function remember($key, $ttl, $closure, $default = null)
+function remember($key, $ttl, $closure, $default = null, $force = false)
{
$rememberSaveKey = $key . '_save_remember';
$client = getRedisClient();
- if (!$client->exists($key)) {
+ if ($force || !$client->exists($key)) {
try {
$data = call_user_func($closure);
} catch (Exception $e) {
'sdb/hotwater/auto' => [
['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1']],
],
+ 'sdb/hotwater/auto/force' => [
+ ['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['1',true]],
+ ],
'sdb/hotwater/eco' => [
['type' => 'function', 'function' => 'hotwaterAutoMode', 'args' => ['0']],
['type' => 'function', 'function' => 'hotwater', 'args' => ['1']],
return $res;
}
-function hotwaterAutoMode($mode)
+function hotwaterAutoMode($mode, $force = false)
{
$mode = $mode ? '1' : '0';
setState('hotwater_auto_mode', $mode);
if ($mode) {
- hotwaterCheckMode();
+ hotwaterCheckMode($force);
}
}
-function hotwaterCheckMode()
+function hotwaterCheckMode($force = false)
{
if (getState('hotwater_auto_mode', '1') == '0') {
return;
}
+ $jerome = isJerome(true, $force);
+ $vincent = isVincent($force);
+
$h = date('G');
$d = date('N');
$isWeek = $d < 6;
- $maxLevel = isJerome() ? "2" : '1';
+ $maxLevel = $jerome ? "2" : '1';
$ecomode = (int)getState('ecomode', '0');
- if (!isVincent()) {
+ if (!isVincent($force)) {
$hot = '1';
} else {
if (getSqueezePlayerStatus('Salle de bains')) {
}
}
}
- echo "\n\n" . 'V:' . isVincent() . '/J:' . isJerome() . '/H:' . $h . '/D:' . $d . '/W:' . $hot . "\n\n";
+ echo "\n\n" . 'V:' . $vincent . '/J:' . $jerome . '/H:' . $h . '/D:' . $d . '/W:' . $hot . "\n\n";
hotwater($hot);
}
// 1 : ECO
// 2 : MAX
-
echo getState('hotwater_auto_mode', '1') . '::' . getState('hotwater_change', '0') . '::' . getState('hotwater', '1');
$changing = getState('hotwater_change', '0');
$limit = time() - 300;
return $res;
}
-function isVincent()
+function isVincent($force = false)
{
return remember('vincent_in_paris', 3600, function () {
return _isVincent();
- }, true);
+ }, true, $force);
}
function _isVincent()
return true;
}
-function isJerome($strict = true)
+function isJerome($strict = true, $force = false)
{
$key = 'jerome_in_paris' . ($strict ? '' : '_1');
return remember($key, 3600, function () use ($strict) {
return _isJerome($strict);
- }, true);
+ }, true, $force);
}
function _isJerome($strict = true)