<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$/scripts/lib/harmony.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/harmony.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$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/config/salon.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/salon.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/denon.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/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/denon.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/off.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/off.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/proc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/proc.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/servers/logcat.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<workItem from="1611911107099" duration="542000" />
<workItem from="1611951034456" duration="1202000" />
<workItem from="1612025389189" duration="578000" />
- <workItem from="1612099867183" duration="8220000" />
- </task>
- <task id="LOCAL-00397" summary=".">
- <created>1605433424911</created>
- <option name="number" value="00397" />
- <option name="presentableId" value="LOCAL-00397" />
- <option name="project" value="LOCAL" />
- <updated>1605433424911</updated>
+ <workItem from="1612099867183" duration="8228000" />
+ <workItem from="1612347206766" duration="685000" />
+ <workItem from="1612620373278" duration="26000" />
+ <workItem from="1612620424202" duration="11592000" />
</task>
<task id="LOCAL-00398" summary=".">
<created>1605436590375</created>
<option name="project" value="LOCAL" />
<updated>1612123146249</updated>
</task>
- <option name="localTasksCounter" value="446" />
+ <task id="LOCAL-00446" summary=".">
+ <created>1612199517377</created>
+ <option name="number" value="00446" />
+ <option name="presentableId" value="LOCAL-00446" />
+ <option name="project" value="LOCAL" />
+ <updated>1612199517377</updated>
+ </task>
+ <option name="localTasksCounter" value="447" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
'Salle de bains' => 'b8:27:eb:ab:b4:50',
//'Salon' => 'dc:a6:32:02:47:c1',
//'Salon' => 'cc:cc:2d:15:82:0e',
- 'Salon' => '5a:a1:4c:5c:e7:5e',
+ //'Salon' => '5a:a1:4c:5c:e7:5e',
+ 'Salon' => 'bb:bb:78:49:8f:a4s',
'Chambre' => 'b8:27:eb:31:e1:44',
//'WC' => '00:04:20:2a:05:2e',
//'WC' => 'b8:27:eb:78:f6:88',
config('SQUEEZEBOX_PLAYER', 'Salon');
config('VIDEOPLAYER', 'shield');
config('TVPLAYER', 'shield');
-config('VOLUME_DEVICE', 'harmony');
+config('VOLUME_DEVICE', 'DenonAVR');
config('VIDEOPLAYER_DEVICE', 'salon');
config('HIDEMASK_TIMEOUT', 250);
config('THEME','#7a6854');
<?php
require_once "import.php";
-setState('denon', '0');
\ No newline at end of file
+if(isset($_GET['avroff'])){
+ denonAVROff();
+}else if(isset($_GET['avron'])){
+ denonAVROn();
+}else {
+ setState('denon', '0');
+}
\ No newline at end of file
_remoteCmd('pause', 'salon');
break;
case 'Clock_Wise':
- volume(3, '+');
+ volume(2, '+');
break;
case 'Anti_Clock_Wise':
- volume(3, '-');
+ volume(2, '-');
break;
case 'Tap':
squeezePlayByName('FIP', $squeezeboxPlayers['Salon']);
off('bureau');
break;
case 'Move':
- if(getCurrentHarmonyActivity()==='tv'){
+ if (getCurrentHarmonyActivity() === 'tv') {
_remoteCmd('pause', 'bureau');
- }else{
+ } else {
stopPlayersIn('bureau');
stopHarmony();
}
}
sshCommand('/usr/local/bin/denon-toggle', 'lit', true, true);
setState('denon', $on ? '1' : '0');
+}
+
+function _denonAVR($command)
+{
+ $context = ['http' => ['method' => 'GET'], 'ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]];
+ $context = stream_context_create($context);
+ return file_get_contents('https://192.168.13.42:10443/ajax/globals/' . $command . '&_' . time(), false, $context);
+}
+
+function denonAVRVolume($volume, $increase = '')
+{
+ $device = 2894;
+ $current = domoticzGetLevel($device);
+ if ($increase === '+' || $increase === '-') {
+ if ($increase === '+') {
+ $volume += $current;
+ } else {
+ $volume = $current - $volume;
+ }
+ }
+ $volume = min(80, $volume);
+ domoticzSetLevel($device, $volume, true);
+ return $current . '->' . $volume;
+}
+
+function denonAVROn($input = 'Media Player')
+{
+ _denonAVR('set_config?type=4&data=' . rawurlencode('<MainZone><Power>1</Power></MainZone>'));
+ denonAVRInput($input);
+}
+
+function denonAVRInput($input)
+{
+ $map = ['Media Player' => 5, 'CD' => 9, 'HEOS Music' => 13];
+ $volumes = ['Media Player' => 40, 'HEOS Music' => 50, 'CD' => 30];
+ if (isset($map[$input])) {
+ _denonAVR('set_config?type=7&data=' . rawurlencode('<Source zone="1" index="' . $map[$input] . '"></Source>'));
+ sleep(1);
+ }
+ if (isset($volumes[$input])) {
+ denonAVRVolume($volumes[$input]);
+ sleep(1);
+ }
+}
+
+function denonAVROff()
+{
+ _denonAVR('set_config?type=4&data=' . rawurlencode('<MainZone><Power>3</Power></MainZone>'));
+}
+
+function epson($on = true)
+{
+ $cmd = $on ? 'PowerOn' : 'PowerOff';
+ sshCommand('/usr/local/bin/ir Epson ' . $cmd, 'salon');
}
\ No newline at end of file
if ($cmd === 'Toogle' || $cmd === 'toogle' || $cmd === 'Toggle' || $cmd === 'toggle') {
$cmd = 'Toggle';
}
- if(is_bool($cmd)) {
+ if (is_bool($cmd)) {
$cmd = $cmd ? 'On' : 'Off';
}
return domoticzCmd(['idx' => $device, 'switchcmd' => $cmd, 'param' => 'switch' . $type, 'level' => '0', 'delay' => $delay], $priority);
}
+function domoticzSetLevel($device, $level, $priority = false)
+{
+ return domoticzCmd(['idx' => $device, 'switchcmd' => 'Set Level', 'param' => 'switchlight', 'level' => max(0, min(100, $level))], $priority);
+}
+
+function domoticzGetLevel($device)
+{
+ return getDomoticzDeviceStatus($device, true, 'LevelInt');
+}
+
function domoticzCmd($command, $priority = false)
{
$redis = connectRedis();
return true;
}
-function getDomoticzDeviceStatus($device, $force = false)
+function getDomoticzDeviceStatus($device, $force = false, $key = 'Data')
{
+ echo ':)';
$res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
$res = json_decode($res->getBody(), true);
+ print_r($res);
try {
$update = new DateTime($res['result'][0]['LastUpdate']);
$now = new DateTime();
}
} catch (Exception $e) {
}
- return $res['result'][0]['Data'];
+ return $res['result'][0][$key];
}
function volume($volume, $increase = '', $device = null)
{
$d = $device === null ? config('VOLUME_DEVICE') : $device;
+ echo $d.';'.$volume.';'.$increase;
if ($increase == ' ') {
$increase = '+';
}
case 'vlc':
return VLCCmd(['command' => 'volume', 'val' => $increase . '20'], $device);
+ case 'denonavr':
+ return denonAVRVolume($volume,$increase);
}
}
function offSalon()
{
+ epson(false);
+ denonAVROff();
shieldKillAll('salon');
shieldSleep('salon');
}
protected function _parseLine($line)
{
- if ($this->tooLate($line)) {
- return;
- }
+
foreach ($this->_cases as $expected_text => $closure) {
if (strpos($line, $expected_text)) {
+ if ($this->tooLate($line)) {
+ echo 'too late ' . $line . "\n";
+ return;
+ }
$closure();
}
}
$t = mktime($hour, $min, $sec, $month, $day, date('Y'));
$c = time();
- return $t < $c - 5 || $t > $c;
+
+ $res = $t < $c - 5 || $t > $c;
+ if ($res) {
+ echo $c - $t . "\n";
+ }
+ return $res;
}
}
\ No newline at end of file
if ($device['id'] === 'salon') {
stopPlayersIn('salon', true, false);
-
+ epson(true);
+ denonAVROn();
} else if ($device['id'] === 'bureau' || $device['id'] === 'bureausun') {
stopPlayersIn('bureau', true, false);
if ($onlySound) {
shieldMyCanal($e[1], $e[0]);
} else if (isset($_GET['runappback'])) {
shieldRunAppAndBackHome($_GET['runappback']);
+}else if(isset($_GET['netflix'])){
+ shieldNetflix();
}
echo '</pre>';
\ No newline at end of file
}
},
'WindowManager: handleComboKeys keyCode: 25, keyAction: 1' => function () use ($device) {
+ echo 'volume-down' . "\n";
if ($device === 'bureau') {
- echo 'volume-down' . "\n";
volume('3', '-', 'harmony');
+ }else if($device==='salon'){
+ volume('2', '-', 'denonavr');
}
},
'WindowManager: handleComboKeys keyCode: 24, keyAction: 1' => function () use ($device) {
+ echo 'volume-up' . "\n";
if ($device === 'bureau') {
- echo 'volume-up' . "\n";
volume('3', '+', 'harmony');
+ }else if($device==='salon'){
+ volume('2', '+', 'denonavr');
}
}
];