<project version="4">
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+ <change afterPath="$PROJECT_DIR$/scripts/lib/switchbot.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/servers/logcat.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<workItem from="1642149121693" duration="376000" />
<workItem from="1642240002240" duration="1108000" />
<workItem from="1642761590471" duration="1992000" />
- </task>
- <task id="LOCAL-00456" summary=".">
- <created>1615664599666</created>
- <option name="number" value="00456" />
- <option name="presentableId" value="LOCAL-00456" />
- <option name="project" value="LOCAL" />
- <updated>1615664599667</updated>
+ <workItem from="1642848701157" duration="1843000" />
</task>
<task id="LOCAL-00457" summary=".">
<created>1615881926505</created>
<option name="project" value="LOCAL" />
<updated>1642149511288</updated>
</task>
- <option name="localTasksCounter" value="505" />
+ <task id="LOCAL-00505" summary=".">
+ <created>1642848715262</created>
+ <option name="number" value="00505" />
+ <option name="presentableId" value="LOCAL-00505" />
+ <option name="project" value="LOCAL" />
+ <updated>1642848715262</updated>
+ </task>
+ <option name="localTasksCounter" value="506" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
require_once ROOT . '/scripts/lib/climacell.php';
require_once ROOT . '/scripts/lib/homeconnect.php';
require_once ROOT . '/scripts/lib/wol.php';
+require_once ROOT . '/scripts/lib/switchbot.php';
profile('Loaded libraries', __FILE__, __LINE__);
--- /dev/null
+<?php
+function switchbot($device, $command = 'press')
+{
+ sshCommand('/usr/bin/python3 /usr/local/python-host/switchbot_py3.py -d ' . $device . ' -c ' . $command, 'bureausun', true, true);
+}
+
+function hotwater($on = true)
+{
+ $device = 'C1:F7:66:5E:A2:CF';
+ $state = getState('hotwater', '1');
+ $newState = $on ? '1' : '0';
+ if ($newState === $state) {
+ return;
+ }
+ if ($newState === '1') {
+ switchbot($device);
+ } else {
+ switchbot($device);
+ sleep(2);
+ switchbot($device);
+ }
+}
\ No newline at end of file