<project version="4">
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
- <change afterPath="$PROJECT_DIR$/config/water.php" afterDir="false" />
- <change afterPath="$PROJECT_DIR$/scripts/hotwater.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/config/cuisine.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/cuisine.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/config/sdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/sdb.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/profile.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/profile.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" />
- <change beforePath="$PROJECT_DIR$/scripts/lib/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<workItem from="1642240002240" duration="1108000" />
<workItem from="1642761590471" duration="1992000" />
<workItem from="1642848701157" duration="3435000" />
- <workItem from="1642856038290" duration="3025000" />
- </task>
- <task id="LOCAL-00458" summary=".">
- <created>1615883286918</created>
- <option name="number" value="00458" />
- <option name="presentableId" value="LOCAL-00458" />
- <option name="project" value="LOCAL" />
- <updated>1615883286918</updated>
+ <workItem from="1642856038290" duration="4553000" />
</task>
<task id="LOCAL-00459" summary=".">
<created>1616837743511</created>
<option name="project" value="LOCAL" />
<updated>1642854570967</updated>
</task>
- <option name="localTasksCounter" value="507" />
+ <task id="LOCAL-00507" summary=".">
+ <created>1642860905685</created>
+ <option name="number" value="00507" />
+ <option name="presentableId" value="LOCAL-00507" />
+ <option name="project" value="LOCAL" />
+ <updated>1642860905685</updated>
+ </task>
+ <option name="localTasksCounter" value="508" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<?php
function switchbot($device, $command = 'press')
{
- return sshCommand('/usr/bin/python3 /usr/local/python-host/switchbot_py3.py -d ' . $device . ' -c ' . $command, 'bureausun', true, true);
+ for ($i = 0; $i <= 2; $i++) {
+ $res = sshCommand('/usr/bin/python3 /usr/local/python-host/switchbot_py3.py -d ' . $device . ' -c ' . $command, 'bureausun', true, true);
+ if (stristr($res['output'], 'Command execution successful')) {
+ break;
+ }
+ sleep(1);
+ }
+
+ return $res;
}
function hotwater($newState)
$res = '';
for ($i = 0; $i < $clicks; $i++) {
$res .= ' one click - ';
- $res .= switchbot($device);
- sleep(5);
+ $res .= print_r(switchbot($device));
+ if ($i < $clicks - 1) {
+ sleep(2);
+ }
}
setState('hotwater', $newState);
setState('hotwater_change', '0');