<project version="4">
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+ <change afterPath="$PROJECT_DIR$/servers/cheminee.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/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/config/coffee.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/coffee.php" 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/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/domoticz.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" />
<option name="Make" enabled="true" />
</method>
</configuration>
+ <configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
+ <option name="arquillianRunConfiguration">
+ <value>
+ <option name="containerStateName" value="" />
+ </value>
+ </option>
+ <option name="TEST_OBJECT" value="class" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
<configuration default="true" type="ArquillianTestNG" factoryName="">
<option name="arquillianRunConfiguration">
<value>
<workItem from="1617794643348" duration="128000" />
<workItem from="1617794856868" duration="1126000" />
<workItem from="1617801536336" duration="4107000" />
- <workItem from="1618050897134" duration="2465000" />
- </task>
- <task id="LOCAL-00414" summary=".">
- <created>1606677800857</created>
- <option name="number" value="00414" />
- <option name="presentableId" value="LOCAL-00414" />
- <option name="project" value="LOCAL" />
- <updated>1606677800858</updated>
+ <workItem from="1618050897134" duration="4462000" />
+ <workItem from="1618158049208" duration="6569000" />
</task>
<task id="LOCAL-00415" summary=".">
<created>1606809331094</created>
<option name="project" value="LOCAL" />
<updated>1617871680635</updated>
</task>
- <option name="localTasksCounter" value="463" />
+ <task id="LOCAL-00463" summary=".">
+ <created>1618054953034</created>
+ <option name="number" value="00463" />
+ <option name="presentableId" value="LOCAL-00463" />
+ <option name="project" value="LOCAL" />
+ <updated>1618054953035</updated>
+ </task>
+ <option name="localTasksCounter" value="464" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<?php
$shortcuts['coffee'] = [
+ ['type' => 'light','scene'=>'cuisine/toaster/toggle', 'label' => 'Grille pain'],
+ ['type' => 'separator', 'label' => 'Machine à café'],
['type' => 'ifttt', 'event' => 'coffee_on', 'label' => 'Allumer'],
['type' => 'ifttt', 'event' => 'coffee_off', 'label' => 'éteindre'],
['type' => 'separator', 'label' => 'Cafés'],
cronVelib($cronmin);
cronGuest($cronmin);
cronShield($cronmin);
+
}
if ($cronmin % 10 == 0) {
cronSqueezeFavorites($cronmin);
}
if ($cronmin % 20 == 0) {
+ cronBackyard($cronmin);
cronSqueezeCheckPlayers($cronmin);
}
`$suncurve;$earth`;
}
+
+function cronBackyard($cronmin)
+{
+ $device = 679;
+ domoticzSwitch($device, getDomoticzDeviceStatus($device) === 'On');
+}
+
function cronShield($cronmin)
{
global $devices;
function getDomoticzDeviceStatus($device, $force = false, $key = 'Data')
{
- echo ':)';
+ //echo ':)';
$res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
$res = json_decode($res->getBody(), true);
- print_r($res);
+ // print_r($res);
try {
$update = new DateTime($res['result'][0]['LastUpdate']);
$now = new DateTime();
'lights' => '<div data-menu="lights"><i class="far fa-lightbulb" aria-hidden="true"></i><span>Lumières</span></div>',
'music' => '<div data-menu="music"><i class="fa fa-music" aria-hidden="true"></i><span>Musique & Radio</span></div>',
'media' => '<div data-menu="media"><i class="fa fa-tv-retro" aria-hidden="true"></i><span>Medias & TV</span></div>',
- 'coffee' => '<div data-menu="coffee"><i class="fa fa-coffee" aria-hidden="true"></i><span>Café</span></div>',
+ 'coffee' => '<div data-menu="coffee"><i class="fa fa-oven" aria-hidden="true"></i><span>Cuisine / Café</span></div>',
'fan' => '<a href="/scripts/light.php?scene='.config('ROOM').'/fan/toggle" class="ajax"><i class="fa fa-fan" aria-hidden="true"></i><span>Ventilateur</span></a>',
'remote' => '<div data-menu="remote"><i class="fa fa-play" aria-hidden="true"></i><span>Télécommande</span></div>',
'switch' => '<div data-menu="switch"><i class="far fa-portal-enter" aria-hidden="true"></i><span>Changer de pièce</span></div>',
'bureau/screens/on' => [
['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Tortuga', 'avion']]
],
- 'bureau/fan/on'=>[
- ['type' => 'domoticz', 'device' => '3529', 'command' => true,'priority'=>true],
+ 'bureau/fan/on' => [
+ ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
],
- 'bureau/fan/off'=>[
- ['type' => 'domoticz', 'device' => '3529', 'command' => true,'priority'=>true],
+ 'bureau/fan/off' => [
+ ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
],
'bureau/fan/toggle' => [
['type' => 'domoticz', 'device' => '3529', 'command' => 'Toggle', 'priority' => true],
'cuisine/off' => [
//['type' => 'hue', 'group' => $cuisine, 'scene' => array('on' => false, 'brightness' => 0)]
],
+ 'cuisine/toaster/toggle' => [
+ ['type' => 'domoticz', 'device' => '1453', 'command' => 'Toggle', 'priority' => true],
+ ],
+ 'cuisine/toaster/on' => [
+ ['type' => 'domoticz', 'device' => '1453', 'command' => true, 'priority' => true],
+ ],
+ 'cuisine/toaster/off' => [
+ ['type' => 'domoticz', 'device' => '1453', 'command' => false, 'priority' => true],
+ ],
'cour/auto' => [
['type' => 'domoticz', 'device' => '678', 'command' => true],
['type' => 'function', 'function' => 'courAuto', 'args' => [true]],
--- /dev/null
+<?php
+require_once __DIR__ . "/../scripts/import.php";
+
+if (!isset($room)) {
+ $room = 'salon';
+}
+
+// Set time limit to indefinite execution
+set_time_limit(0);
+ignore_user_abort(true);
+
+if ($room === 'chambre') {
+ $lights = [3866, 3867, 3868];
+} else {
+ $lights = [];
+}
+
+/*
+ * $start = time();
+ $hue = getHueInstance();
+ $speed = 2;
+ $brightness *= 100;
+ $brightnessAmplitude = $brightness * 0.75;
+
+ set_time_limit(0);
+
+ while (true) {
+ if ($program == 'fire') {
+ $time = rand(1 / $speed, 40 / $speed) / 10;
+ $color = rand(0, 10000);
+ } else if ($program == 'cold') {
+ $time = rand(20 / $speed, 40 / $speed) / 2;
+ $color = rand(25500, 46920);
+ }
+ if ($color < 0) {
+ $color += 65280;
+ }
+
+ $command = new \Phue\Command\SetLightState($lightId);
+ $command->on(true);
+ $command->hue($color);
+ $command->brightness(max(0, min(255, rand(0, $brightnessAmplitude) + $brightness - $brightnessAmplitude / 2)));
+ $command->saturation(max(0, min(255, 220 + rand(0, 36))));
+ $command->transitionTime($time);
+ $command->send($hue);
+ usleep($time * 1000000);
+ }
+ */
+
+$now = microtime(true);
+foreach ($lights as $light) {
+ $nextChange[$light] = $now;
+}
+
+while (true) {
+ $program = getState('cheminee_' . $room . '_program', 'off');
+ $now = microtime(true);
+ foreach ($nextChange as $light => $next) {
+ if ($next <= $now) {
+ $nextChange[$light] = change($light, $program);
+ }
+ }
+}
+
+function change($light, $program)
+{
+ $speed = 2;
+ $brightness = 100;
+ $brightnessAmplitude = $brightness * 0.75;
+
+ if ($program == 'fire') {
+ $duration = rand(1 / $speed, 40 / $speed) / 10;
+ $color = rand(0, 10000);
+ } else if ($program == 'cold') {
+ $duration = rand(20 / $speed, 40 / $speed) / 2;
+ $color = rand(25500, 46920);
+ }
+ if ($color < 0) {
+ $color += 65280;
+ }
+
+ hueCommand(
+ [
+ 'light' => $light,
+ 'on' => true,
+ 'hue' => $color,
+ 'brightness' => max(0, min(255, rand(0, $brightnessAmplitude) + $brightness - $brightnessAmplitude / 2)),
+ 'saturation' => max(0, min(255, 220 + rand(0, 36)))
+ ], $duration
+ );
+
+ return microtime(true) + $duration;
+}
\ No newline at end of file