Google Home api Fix

This commit is contained in:
GamerClassN7 2021-01-24 19:56:53 +01:00
parent c17e3090a8
commit 1f49391b36
1 changed files with 396 additions and 378 deletions

View File

@ -1,6 +1,8 @@
<?php <?php
class GoogleHome { class GoogleHome
static function sync($requestId){ {
static function sync($requestId)
{
$devices = []; $devices = [];
$roomsData = RoomManager::getAllRooms(); $roomsData = RoomManager::getAllRooms();
foreach ($roomsData as $roomKey => $roomData) { foreach ($roomsData as $roomKey => $roomData) {
@ -25,8 +27,8 @@ class GoogleHome {
$attributes += $deviceAttributes; $attributes += $deviceAttributes;
} }
} }
if ($traids < 1){ if ($traids < 1) {
continue; continue;
} }
@ -53,428 +55,444 @@ class GoogleHome {
$response = [ $response = [
'requestId' => $requestId, 'requestId' => $requestId,
'payload' => [ 'payload' => [
'agentUserId'=>'651351531531', 'agentUserId' => '651351531531',
'devices' => array_values( $devices ), 'devices' => array_values($devices),
], ],
]; ];
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log'); $apiLogManager = new LogManager('../logs/google-home/' . date("Y-m-d") . '.log');
$apiLogManager->setLevel(LOGLEVEL); $apiLogManager->setLevel(LOGLEVEL);
$apiLogManager->write("[API][$requestId] request response\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordTypes::INFO); $apiLogManager->write("[API][$requestId] request response\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
echo json_encode($response); echo json_encode($response);
} }
static function query($requestId, $payload){ static function query($requestId, $payload)
{
$devices = []; $devices = [];
$num = 0; $num = 0;
foreach ($payload['devices'] as $deviceId) { foreach ($payload['devices'] as $deviceId) {
$subDevicesData = SubDeviceManager::getAllSubDevices($deviceId['id']);
$tempDevice[$deviceId['id']] = [ $tempDevice[$deviceId['id']] = [
'online' => false, 'online' => false,
'status' => 'OFFLINE', 'status' => 'OFFLINE',
]; ];
foreach ($subDevicesData as $key => $subDeviceData) {
$lastRecord = RecordManager::getLastRecord($subDeviceData['subdevice_id']); if ($subDevicesData = SubDeviceManager::getAllSubDevices($deviceId['id'])) {
if ($lastRecord['execuded'] == 1){ foreach ($subDevicesData as $key => $subDeviceData) {
$tempDevice[$deviceId['id']]['online'] = true; $lastRecord = RecordManager::getLastRecord($subDeviceData['subdevice_id']);
$tempDevice[$deviceId['id']]['status'] = "SUCCESS"; if ($lastRecord != false && $lastRecord['execuded'] == 1) {
} else { $tempDevice[$deviceId['id']]['online'] = true;
$executed = 0; $tempDevice[$deviceId['id']]['status'] = "SUCCESS";
$waiting = 0; } else {
foreach (RecordManager::getLastRecord($deviceId['id'], 6) as $key => $value) { $executed = 0;
if ($value['execuded'] == 1){ $waiting = 0;
$executed++; foreach (RecordManager::getLastRecord($deviceId['id'], 6) as $key => $value) {
} else { if ($value['execuded'] == 1) {
$waiting++; $executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed) {
$tempDevice[$deviceId['id']]['online'] = true;
} }
} }
if ($waiting < $executed){
$tempDevice[$deviceId['id']]['online'] = true; switch ($subDeviceData['type']) {
case 'temp_cont':
$tempDevice[$deviceId['id']]['thermostatMode'] = 'off';
if ($lastRecord['value'] != 0) {
$tempDevice[$deviceId['id']]['thermostatMode'] = 'heat';
}
$tempDevice[$deviceId['id']]['thermostatTemperatureAmbient'] = $lastRecord['value'];
$tempDevice[$deviceId['id']]['thermostatTemperatureSetpoint'] = $lastRecord['value'];
break;
case 'vol_cont':
$tempDevice[$deviceId['id']]['currentVolume'] = $lastRecord['value'];
break;
case 'media_apps':
$tempDevice[$deviceId['id']]['currentApplication'] = "kodi";
break;
case 'media_input':
$tempDevice[$deviceId['id']]['currentInput'] = "pc";
break;
case 'media_status':
$tempDevice[$deviceId['id']]['activityState'] = "ACTIVE";
$tempDevice[$deviceId['id']]['playbackState'] = "PLAYING";
break;
case 'on/off':
$tempDevice[$deviceId['id']]['on'] = ($lastRecord['value'] == 1 ? true : false);
break;
}
}
}
// $lastRecord = RecordManager::getLastRecord($deviceId['id']);
// //var_dump($lastRecord);
// if ($lastRecord['execuded'] == 1) {
// $online = true;
// $status = 'SUCCESS';
// } else {
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($deviceId['id'], 6) as $key => $value) {
if ($value['execuded'] == 1) {
$executed++;
} else {
$waiting++;
} }
} }
switch ($subDeviceData['type']) { if ($waiting < $executed) {
case 'temp_cont': $status = "PENDING";
$tempDevice[$deviceId['id']]['thermostatMode'] = 'off'; $online = true;
if ($lastRecord['value'] != 0) { }
$tempDevice[$deviceId['id']]['thermostatMode'] = 'heat'; // }
} $devices = $tempDevice;
$tempDevice[$deviceId['id']]['thermostatTemperatureAmbient'] = $lastRecord['value']; if (count($devices)> 1){
$tempDevice[$deviceId['id']]['thermostatTemperatureSetpoint'] = $lastRecord['value']; $devices[] = $tempDevice;
break; }
case 'vol_cont': }
$tempDevice[$deviceId['id']]['currentVolume'] = $lastRecord['value']; $response = [
break; 'requestId' => $requestId,
case 'media_apps': 'payload' => [
$tempDevice[$deviceId['id']]['currentApplication'] = "kodi"; 'devices' => $devices,
break; ],
case 'media_input': ];
$tempDevice[$deviceId['id']]['currentInput'] = "pc"; $apiLogManager = new LogManager('../logs/google-home/' . date("Y-m-d") . '.log');
break; $apiLogManager->write("[API][$requestId] request response\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
case 'media_status': $apiLogManager->setLevel(LOGLEVEL);
$tempDevice[$deviceId['id']]['activityState'] = "ACTIVE"; echo json_encode($response);
$tempDevice[$deviceId['id']]['playbackState'] = "PLAYING"; }
break;
case 'on/off': static function execute($requestId, $payload)
$tempDevice[$deviceId['id']]['on'] = ($lastRecord['value'] == 1 ? true : false); {
break; $commands = [];
foreach ($payload['commands'] as $key => $command) {
foreach ($command['devices'] as $key2 => $device) {
$executionCommand = $command['execution'][0];
if (isset($command['execution'][$key])) {
$executionCommand = $command['execution'][$key];
}
$deviceType = GoogleHomeDeviceTypes::getType($executionCommand['command']);
if ($subDeviceId = SubDeviceManager::getSubDeviceByMasterAndType($device['id'], $deviceType)) {
$subDeviceId = $subDeviceId['subdevice_id'];
switch ($executionCommand['command']) {
case 'action.devices.commands.OnOff':
$commands[] = self::executeSwitch($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.ThermostatTemperatureSetpoint':
$commands[] = self::executeTermostatValue($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.ThermostatSetMode':
$commands[] = self::executeTermostatMode($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.setVolume':
$commands[] = self::executeVolume($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.appSelect':
$commands[] = self::executeApp($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.SetInput':
$commands[] = self::executeInput($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaNext':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaPrevious':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaPause':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaResume':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaStop':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
}
}
}
}
$response = [
'requestId' => $requestId,
'payload' => [
'commands' => $commands,
],
];
$apiLogManager = new LogManager('../logs/google-home/' . date("Y-m-d") . '.log');
$apiLogManager->setLevel(LOGLEVEL);
$apiLogManager->write("[API][EXECUTE][$requestId]\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
echo json_encode($response);
}
static function executeSwitch($subDeviceId, $executionCommand)
{
$value = 0;
$status = 'OFFLINE';
$online = false;
if ($executionCommand['params']['on']) $value = 1;
RecordManager::createWithSubId($subDeviceId, $value);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1) {
$executed++;
} else {
$waiting++;
} }
} }
if ($lastRecord['execuded'] == 1){ if ($waiting < $executed) {
$status = "PENDING";
$online = true; $online = true;
$status = 'SUCCESS'; }
} else {
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'on' => $executionCommand['params']['on'],
'online' => $online,
],
];
return $commandTemp;
}
static function executeTermostatValue($subDeviceId, $executionCommand)
{
$value = 0;
$status = 'OFFLINE';
$online = false;
if (isset($executionCommand['params']['thermostatTemperatureSetpoint'])) {
$value = $executionCommand['params']['thermostatTemperatureSetpoint'];
}
RecordManager::createWithSubId($subDeviceId, $value);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $lastValue) {
if ($lastValue['execuded'] == 1) {
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed) {
$status = "PENDING";
$online = true;;
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'thermostatMode' => 'heat',
'thermostatTemperatureSetpoint' => $value,
'thermostatTemperatureAmbient' => $value,
'online' => $online,
//ambient z dalšího zenzoru v roomu
],
];
return $commandTemp;
}
static function executeTermostatMode($subDeviceId, $executionCommand)
{
$mode = "off";
$value = 0;
$status = 'OFFLINE';
$online = false;
if (isset($executionCommand['params']['thermostatMode']) && $executionCommand['params']['thermostatMode'] != 'off') {
$mode = $executionCommand['params']['thermostatMode'];
$value = RecordManager::getLastRecordNotNull($subDeviceId)['value'];
}
RecordManager::createWithSubId($subDeviceId, $value);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1) {
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed) {
$status = "PENDING";
$online = true;
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'thermostatMode' => $mode,
'online' => $online,
],
];
return $commandTemp;
}
static function executeVolume($subDeviceId, $executionCommand)
{
//echo $executionCommand['params']['volumeLevel'];
$status = 'OFFLINE';
$online = false;
$currentVolume = RecordManager::getLastRecord($subDeviceId)['value'];
if (isset($executionCommand['params']['volumeLevel'])) {
RecordManager::createWithSubId($subDeviceId, $executionCommand['params']['volumeLevel']);
$executed = 0; $executed = 0;
$waiting = 0; $waiting = 0;
foreach (RecordManager::getLastRecord($deviceId['id'], 6) as $key => $value) { foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1){ if ($value['execuded'] == 1) {
$executed++; $executed++;
} else { } else {
$waiting++; $waiting++;
} }
} }
if ($waiting < $executed){ if ($waiting < $executed) {
$status = "PENDING"; $status = "PENDING";
$online = true; $online = true;
$currentVolume = $executionCommand['params']['volumeLevel'];
} }
} }
$devices = $tempDevice;
/*if (count($devices)> 1){ $deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$devices[] = $tempDevice; $commandTemp = [
}*/ 'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'currentVolume' => $currentVolume,
'online' => $online,
],
];
return $commandTemp;
} }
$response = [
'requestId' => $requestId,
'payload' => [
'devices' => $devices,
],
];
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
$apiLogManager->write("[API][$requestId] request response\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
$apiLogManager->setLevel(LOGLEVEL);
echo json_encode($response);
}
static function execute($requestId, $payload){ static function executeApp($subDeviceId, $executionCommand)
$commands = []; {
foreach ($payload['commands'] as $key => $command) { //echo $executionCommand['params']['newApplication'];
foreach ($command['devices'] as $key2 => $device) { $status = 'OFFLINE';
$executionCommand = $command['execution'][0]; $online = false;
if (isset($command['execution'][$key])) {
$executionCommand = $command['execution'][$key]; $currentApplication = RecordManager::getLastRecord($subDeviceId)['value'];
if (isset($executionCommand['params']['newApplication'])) {
RecordManager::createWithSubId($subDeviceId, $executionCommand['params']['newApplication']);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1) {
$executed++;
} else {
$waiting++;
}
} }
if ($waiting < $executed) {
$deviceType = GoogleHomeDeviceTypes::getType($executionCommand['command']); $status = "PENDING";
$subDeviceId = SubDeviceManager::getSubDeviceByMasterAndType($device['id'], $deviceType)['subdevice_id']; $online = true;
switch ($executionCommand['command']) { $currentApplication = $executionCommand['params']['newApplication'];
case 'action.devices.commands.OnOff':
$commands[] = self::executeSwitch($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.ThermostatTemperatureSetpoint':
$commands[] = self::executeTermostatValue($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.ThermostatSetMode':
$commands[] = self::executeTermostatMode($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.setVolume':
$commands[] = self::executeVolume($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.appSelect':
$commands[] = self::executeApp($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.SetInput':
$commands[] = self::executeInput($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaNext':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaPrevious':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaPause':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaResume':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
case 'action.devices.commands.mediaStop':
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
break;
} }
} }
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'currentApplication' => $currentApplication,
'online' => $online,
],
];
return $commandTemp;
} }
$response = [
'requestId' => $requestId,
'payload' => [
'commands' => $commands,
],
];
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log'); static function executeInput($subDeviceId, $executionCommand)
$apiLogManager->setLevel(LOGLEVEL); {
$apiLogManager->write("[API][EXECUTE][$requestId]\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordTypes::INFO); //echo $executionCommand['params']['newInput'];
$status = 'OFFLINE';
$online = false;
echo json_encode($response); $currentInput = RecordManager::getLastRecord($subDeviceId)['value'];
}
static function executeSwitch($subDeviceId, $executionCommand){ if (isset($executionCommand['params']['newInput'])) {
$value = 0; RecordManager::createWithSubId($subDeviceId, $executionCommand['params']['newInput']);
$status = 'OFFLINE'; $executed = 0;
$online = false; $waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($executionCommand['params']['on']) $value = 1; if ($value['execuded'] == 1) {
$executed++;
RecordManager::createWithSubId($subDeviceId, $value); } else {
$waiting++;
$executed = 0; }
$waiting = 0; }
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) { if ($waiting < $executed) {
if ($value['execuded'] == 1){ $status = "PENDING";
$executed++; $online = true;
} else { $currentInput = $executionCommand['params']['newInput'];
$waiting++; }
} }
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'currentInput' => $currentInput,
'online' => $online,
],
];
return $commandTemp;
} }
if ($waiting < $executed){ static function executeMediaCont($subDeviceId, $executionCommand)
$status = "PENDING"; {
$status = 'SUCCESS';
$online = true; $online = true;
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id']; $deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [ $commandTemp = [
'ids' => [(string) $deviceId], 'ids' => [(string) $deviceId],
'status' => $status, 'status' => $status,
'states' => [ 'states' => [
'on' => $executionCommand['params']['on'], 'online' => $online,
'online' => $online, ],
], ];
];
return $commandTemp; return $commandTemp;
} }
static function executeTermostatValue($subDeviceId, $executionCommand){
$value = 0;
$status = 'OFFLINE';
$online = false;
if (isset($executionCommand['params']['thermostatTemperatureSetpoint'])) {
$value = $executionCommand['params']['thermostatTemperatureSetpoint'];
}
RecordManager::createWithSubId($subDeviceId, $value);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $lastValue) {
if ($lastValue['execuded'] == 1){
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed){
$status = "PENDING";
$online = true;;
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'thermostatMode' => 'heat',
'thermostatTemperatureSetpoint' => $value,
'thermostatTemperatureAmbient' => $value,
'online' => $online,
//ambient z dalšího zenzoru v roomu
],
];
return $commandTemp;
}
static function executeTermostatMode($subDeviceId, $executionCommand){
$mode = "off";
$value = 0;
$status = 'OFFLINE';
$online = false;
if (isset($executionCommand['params']['thermostatMode']) && $executionCommand['params']['thermostatMode'] != 'off') {
$mode = $executionCommand['params']['thermostatMode'];
$value = RecordManager::getLastRecordNotNull($subDeviceId)['value'];
}
RecordManager::createWithSubId($subDeviceId, $value);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1){
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed){
$status = "PENDING";
$online = true;
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'thermostatMode' => $mode,
'online' => $online,
],
];
return $commandTemp;
}
static function executeVolume($subDeviceId, $executionCommand){
//echo $executionCommand['params']['volumeLevel'];
$status = 'OFFLINE';
$online = false;
$currentVolume = RecordManager::getLastRecord($subDeviceId)['value'];
if (isset($executionCommand['params']['volumeLevel'])) {
RecordManager::createWithSubId($subDeviceId, $executionCommand['params']['volumeLevel']);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1){
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed){
$status = "PENDING";
$online = true;
$currentVolume = $executionCommand['params']['volumeLevel'];
}
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'currentVolume' => $currentVolume,
'online' => $online,
],
];
return $commandTemp;
}
static function executeApp($subDeviceId, $executionCommand){
//echo $executionCommand['params']['newApplication'];
$status = 'OFFLINE';
$online = false;
$currentApplication = RecordManager::getLastRecord($subDeviceId)['value'];
if (isset($executionCommand['params']['newApplication'])) {
RecordManager::createWithSubId($subDeviceId, $executionCommand['params']['newApplication']);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1){
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed){
$status = "PENDING";
$online = true;
$currentApplication = $executionCommand['params']['newApplication'];
}
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'currentApplication' => $currentApplication,
'online' => $online,
],
];
return $commandTemp;
}
static function executeInput($subDeviceId, $executionCommand){
//echo $executionCommand['params']['newInput'];
$status = 'OFFLINE';
$online = false;
$currentInput = RecordManager::getLastRecord($subDeviceId)['value'];
if (isset($executionCommand['params']['newInput'])) {
RecordManager::createWithSubId($subDeviceId, $executionCommand['params']['newInput']);
$executed = 0;
$waiting = 0;
foreach (RecordManager::getLastRecord($subDeviceId, 4) as $key => $value) {
if ($value['execuded'] == 1){
$executed++;
} else {
$waiting++;
}
}
if ($waiting < $executed){
$status = "PENDING";
$online = true;
$currentInput = $executionCommand['params']['newInput'];
}
}
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'currentInput' => $currentInput,
'online' => $online,
],
];
return $commandTemp;
}
static function executeMediaCont($subDeviceId, $executionCommand){
$status = 'SUCCESS';
$online = true;
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
$commandTemp = [
'ids' => [(string) $deviceId],
'status' => $status,
'states' => [
'online' => $online,
],
];
return $commandTemp;
}
} }