<project version="4">
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
- <change afterPath="$PROJECT_DIR$/scripts/domoticz_status.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" 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/domoticz_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_device_event.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/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/lib/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="HIDDEN_KINDS">
<set />
</option>
- <expand />
+ <expand>
+ <path>
+ <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+ <item name="LFY(3).db" type="feb32156:DbDataSourceImpl" />
+ </path>
+ <path>
+ <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+ <item name="LFY(3).db" type="feb32156:DbDataSourceImpl" />
+ <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+ </path>
+ <path>
+ <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+ <item name="LFY(3).db" type="feb32156:DbDataSourceImpl" />
+ <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+ <item name="main: schema" type="981a47c2:SqliteImplModel$Schema" />
+ </path>
+ <path>
+ <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+ <item name="LFY_ZiGate.db" type="feb32156:DbDataSourceImpl" />
+ </path>
+ <path>
+ <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+ <item name="LFY_ZiGate.db" type="feb32156:DbDataSourceImpl" />
+ <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+ </path>
+ <path>
+ <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
+ <item name="LFY_ZiGate.db" type="feb32156:DbDataSourceImpl" />
+ <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
+ <item name="main: schema" type="981a47c2:SqliteImplModel$Schema" />
+ </path>
+ </expand>
<select />
</component>
<component name="DefaultGradleProjectSettings">
<option name="STATE" value="1" />
</component>
<component name="PropertiesComponent">
+ <property name="DatabaseDriversLRU" value="sqlite" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<method v="2" />
</configuration>
</component>
+ <component name="ServiceViewManager">
+ <option name="allServicesViewState">
+ <serviceView>
+ <treeState>
+ <expand>
+ <path>
+ <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
+ <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@56e2c52e" type="7427dc5b:ServiceModel$ServiceGroupNode" />
+ </path>
+ <path>
+ <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
+ <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@6b2d7142" type="7427dc5b:ServiceModel$ServiceGroupNode" />
+ </path>
+ <path>
+ <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
+ <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@6b2d7142" type="7427dc5b:ServiceModel$ServiceGroupNode" />
+ <item name="com.intellij.execution.services.ServiceModel$ServiceNode@3e99f178" type="9fbbdea:ServiceModel$ServiceNode" />
+ </path>
+ </expand>
+ <select />
+ </treeState>
+ </serviceView>
+ </option>
+ </component>
<component name="SvnConfiguration">
<configuration />
</component>
<workItem from="1573629043706" duration="29000" />
<workItem from="1573629088225" duration="3531000" />
<workItem from="1574065436563" duration="754000" />
- <workItem from="1574066213679" duration="7326000" />
- </task>
- <task id="LOCAL-00196" summary=".">
- <created>1562740088238</created>
- <option name="number" value="00196" />
- <option name="presentableId" value="LOCAL-00196" />
- <option name="project" value="LOCAL" />
- <updated>1562740088238</updated>
+ <workItem from="1574066213679" duration="8067000" />
+ <workItem from="1574273415760" duration="2973000" />
+ <workItem from="1574323616439" duration="6793000" />
</task>
<task id="LOCAL-00197" summary=".">
<created>1562743327335</created>
<option name="project" value="LOCAL" />
<updated>1574210671610</updated>
</task>
- <option name="localTasksCounter" value="245" />
+ <task id="LOCAL-00245" summary=".">
+ <created>1574242924581</created>
+ <option name="number" value="00245" />
+ <option name="presentableId" value="LOCAL-00245" />
+ <option name="project" value="LOCAL" />
+ <updated>1574242924581</updated>
+ </task>
+ <option name="localTasksCounter" value="246" />
<servers />
</component>
<component name="TodoView">
if ($cronmin % 5 != 0) {
return;
}
- if (getState('ecomode') == 0) {
- execScene('ecomode/off');
- }
+ $ecomode = (int)getState('ecomode');
+ $scenes = [0 => 'off', 1 => 'on', 2 => 'super'];
+ execScene('ecomode/' . $scenes[$ecomode]);
}
function cronTranscode($cronmin)
{
- httpRequest('https://home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
+ httpRequest('https://salon.home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
}
function cronRooms($cronmin)
$weather = json_decode(file_get_contents($cache), true);
$weather = $weather[0];
$res['temp'] = round(($weather['Temperature']['Metric']['Value']/* + getState('airtemperature')*/));
- $res['outdoor_temp'] = toNumber(getDomoticzDeviceStatus(12, 'zigate'),true);
- $res['outdoor_humidity'] = toNumber(getDomoticzDeviceStatus(13, 'zigate'),true);
- $res['outdoor_pressure'] = toNumber(getDomoticzDeviceStatus(14, 'zigate'),true);
- $res['backyard_temp'] = toNumber(getDomoticzDeviceStatus(5, 'zigate'),true);
- $res['backyard_humidity'] = toNumber(getDomoticzDeviceStatus(6, 'zigate'),true);
+ $res['outdoor_temp'] = toNumber(getDomoticzDeviceStatus(1012), true);
+ $res['outdoor_humidity'] = toNumber(getDomoticzDeviceStatus(1013), true);
+ $res['outdoor_pressure'] = toNumber(getDomoticzDeviceStatus(1014), true);
+ $res['backyard_temp'] = toNumber(getDomoticzDeviceStatus(1005), true);
+ $res['backyard_humidity'] = toNumber(getDomoticzDeviceStatus(1006), true);
$res['pressure'] = round($weather['Pressure']['Metric']['Value']);
$res['pressureTendency'] = $weather['PressureTendency']['Code'];
$res['precipitations24'] = round($weather['PrecipitationSummary']['Past24Hours']['Metric']['Value']);
require_once "import.php";
-if ($_GET['hardware'] == 'rflink' && $_GET['device'] == 480) {
+if ($_GET['device'] == 480) {
chambreToggle();
-}
-if ($_GET['hardware'] == 'zigate' && $_GET['device'] == 8) {
+} else if ($_GET['device'] == 1008) {
// Cube
switch ($_GET['state']) {
case 'Shake':
case 'Anti_Clock_Wise':
_remoteCmd('rewind', 'salon');
break;
- case 'Alert':
case 'Tap':
+ if (getCurrentHarmonyActivity() == 'poweroff') {
+ squeezePlayByName('FIP', $squeezeboxPlayers['Salon']);
+ } else if (getCurrentHarmonyActivity() == 'musique-radio') {
+ stopHarmony();
+ }
+ break;
+ case 'Alert':
+ default:
break;
}
}
\ No newline at end of file
<?php
-function runDomoticzCommand($params, $hardware = 'rflink')
+function runDomoticzCommand($params)
{
$default = ['type' => 'command', 'passcode' => ''];
$params = array_merge($default, $params);
- if ($params['hardware'] == 'rflink') {
- $ip = '192.168.13.60';
- } else if ($params['hardware'] == 'zigate') {
- $ip = '192.168.13.68';
- }
- unset($params['hardware']);
+ unset($params['delay']);
+ $ip = '192.168.13.68';
return httpRequest('http://' . $ip . ':8084/json.htm', 'GET', $params);
}
-function domoticzSwitch($device, $cmd, $type = 'light', $priority = false, $hardware = 'rflink')
+function domoticzGroup($group, $command)
+{
+ foreach ($group as $device => $delays) {
+ $delay = $command ? $delays[0] : $delays[1];
+ domoticzSwitch($device, $command, 'light', false, $delay);
+ }
+}
+
+function domoticzSwitch($device, $cmd, $type = 'light', $priority = false, $delay = 0)
{
- return domoticzCmd(['idx' => $device, 'switchcmd' => $cmd ? 'On' : 'Off', 'param' => 'switch' . $type, 'level' => '0', 'hardware' => $hardware], $priority);
+ return domoticzCmd(['idx' => $device, 'switchcmd' => $cmd ? 'On' : 'Off', 'param' => 'switch' . $type, 'level' => '0', 'delay' => $delay], $priority);
}
function domoticzCmd($command, $priority = false)
return true;
}
-function getDomoticzDeviceStatus($device, $hardware = 'rflink')
+function getDomoticzDeviceStatus($device)
{
- $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device, 'hardware' => $hardware]);
- $res = json_decode($res->getBody(),true);
+ $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
+ $res = json_decode($res->getBody(), true);
return $res['result'][0]['Data'];
}
$chambrebedgroup = $chambre;
+$ecoDevices = [
+ 393 => [0, 0], // Prises lit
+ 560 => [0, 50], // Raspberry SDB
+ 476 => [0, 0], // Raspberry Bureau Sun
+ 544 => [0, 0], //Téléphone Cuisine
+ 478 => [120, 0],
+];
+$superEcoDevices = [559 => [0, 0], 392 => [0, 0]];
+
$scenes = [
'chambre/matin' => [
['type' => 'nightmode', 'mode' => '0'],
['type' => 'insteon', 'command' => '0?1131=I=0=0'],
['type' => 'hue', 'group' => $chambrebedgroup, 'scene' => 'JNieZpDHu5fbMyf'],
['type' => 'scene', 'scene' => 'sdb/nuit'],
- ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
+ ['type' => 'function', 'function' => 'bedbrightness', 'args' => [$bedlowscreenbrightness]],
['type' => 'scene', 'scene' => 'chambre/cheminee'],
['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on
// ['type' => 'scene', 'scene' => 'chambre/deshumidificateur/off'],
],
'sdb/on' => [
['type' => 'state', 'key' => 'sdb', 'value' => 1],
- // ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'none']],
+ // ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'none']],
['type' => 'hue', 'group' => $sdb, 'scene' => '0L4cGh7y29uBBez'],
],
'sdb/morning' => [
['type' => 'scene', 'scene' => 'salon/freebox/off'],
['type' => 'scene', 'scene' => 'sdb/ampli/off'],
['type' => 'scene', 'scene' => 'chambre/raspberry/off'],
- ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => false],
+ ['type' => 'domoticz', 'group' => $ecoDevices, 'command' => false],
],
'ecomode/super' => [
['type' => 'scene', 'scene' => 'ecomode/basic'],
- ['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => false],
+ ['type' => 'domoticz', 'group' => $superEcoDevices, 'command' => false],
],
'ecomode/notsuper' => [
- ['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => true],
+ ['type' => 'domoticz', 'group' => $superEcoDevices, 'command' => true],
],
'ecomode/on' => [
['type' => 'scene', 'scene' => 'ecomode/basic'],
} else if ($action['type'] == 'ecomode') {
ecoMode($action['mode']);
} else if ($action['type'] == 'domoticz') {
- domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', isset($action['priority']) && $action['priority']);
+ if (isset($action['group'])) {
+ domoticzGroup($action['group'], $action['command']);
+ } else {
+ domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', isset($action['priority']) && $action['priority']);
+ }
+
} else if ($action['type'] == 'ir') {
irsend($action['room'], $action['device'], $action['command']);
} else if ($action['type'] == 'ifttt') {
return;
}
+ if($player == $squeezeboxPlayers['Salon']){
+ harmonyActivity('musique-radio');
+ }
if ($player == $squeezeboxPlayers['Salle de bains']) {
execScene('sdb/ampli/on');
}
$res .= '<div class="temp-max">' . $weather['max'] . '°C</div>';
$res .= '</div>';
$res .= '<div class="pp">';
- $res .= '<i class="fas fa-cloud-rain"></i> ' . $weather['precipitations24'] . ' mm | <i class="fas fa-tachometer-alt"></i> ' . $weather['outdoor_pressure'] . ' hPa <i class="fa fa-arrow-circle-' . $pressureTendency . '"></i> | <i class="fa fa-tint"></i> ' . $weather['outdoor_humidity'] . '%</br>';
- $res .= '<i class="fas fa-leaf"></i> ' . $weather['backyard_temp'] . ' °C | <i class="fa fa-tint"></i> ' . $weather['backyard_humidity'] . '%';
+ $res .= '<i class="fas fa-cloud-rain"></i> ' . $weather['precipitations24'] . ' mm | <i class="fas fa-tachometer-alt"></i> ' . $weather['outdoor_pressure'] . ' hPa <i class="fa fa-arrow-circle-' . $pressureTendency . '"></i> | <i class="fa fa-tint"></i> ' . $weather['outdoor_humidity'] . '%<br>';
+ $res .= '<br><span style="color:#008048;"><i class="fas fa-leaf"></i> ' . $weather['backyard_temp'] . ' °C | <i class="fa fa-tint"></i> ' . $weather['backyard_humidity'] . '%</span>';
$res .= '</div>';
$res .= '</div>';
$res .= '<div class="forecasts">';