Some tveeks

This commit is contained in:
JonatanRek 2020-06-29 22:00:00 +02:00
parent a1358c53fd
commit 3669fde596
2 changed files with 43 additions and 40 deletions

View File

@ -7,7 +7,7 @@ class GoogleHome {
$devicesData = DeviceManager::getAllDevicesInRoom($roomData['room_id']); $devicesData = DeviceManager::getAllDevicesInRoom($roomData['room_id']);
foreach ($devicesData as $deviceKey => $deviceData) { foreach ($devicesData as $deviceKey => $deviceData) {
$traids = []; $traids = [];
$attributes = null; $attributes = [];
//Google Compatibile Action Type //Google Compatibile Action Type
$actionType = GoogleHomeDeviceTypes::getAction($deviceData['type']); $actionType = GoogleHomeDeviceTypes::getAction($deviceData['type']);
@ -22,7 +22,7 @@ class GoogleHome {
$deviceAttributes = GoogleHomeDeviceTypes::getAttribute($subDeviceData['type']); $deviceAttributes = GoogleHomeDeviceTypes::getAttribute($subDeviceData['type']);
if ($deviceAttributes != "") { if ($deviceAttributes != "") {
$attributes = $deviceAttributes; $attributes += $deviceAttributes;
} }
} }

View File

@ -113,50 +113,53 @@ class GoogleHomeDeviceTypes {
], ],
], ],
'media_apps' => [ 'media_apps' => [
[ "availableApplications" => [
"key" => "kodi",
"names" => [
"name_synonym" => [
"Kodi",
],
"lang" => "en"
]
],
],
'media_inputs' => [
[ [
"key" => "pc", "key" => "kodi",
"names" => [ "names" => [
"name_synonym" => [ "name_synonym" => [
"PC", "Kodi",
], ],
"lang" => "en" "lang" => "en"
], ],
], ],
], ],
]; ],
'media_inputs' => [
"availableApplications" => [
"key" => "pc",
"names" => [
"name_synonym" => [
"PC",
],
"lang" => "en",
],
static function getAction($deviceType){ ],
if (!isset(self::$actionWordBook[$deviceType])) return; ],
return self::$actionWordBook[$deviceType]; ];
}
static function getTraid($subDeviceType){ static function getAction($deviceType){
if (!isset(self::$traidWordBook[$subDeviceType])) return; if (!isset(self::$actionWordBook[$deviceType])) return;
return self::$traidWordBook[$subDeviceType]; return self::$actionWordBook[$deviceType];
}
static function getType($subDeviceCommand){
if (!isset(self::$commandWordBook[$subDeviceCommand])) return;
return self::$commandWordBook[$subDeviceCommand];
}
static function getAttribute($subDeviceType){
if (!isset(self::$attributeWordBook[$subDeviceType])) return;
return self::$attributeWordBook[$subDeviceType];
}
static function getQueryJson($deviceType, $type){
return self::$wordBook[$type];
}
} }
static function getTraid($subDeviceType){
if (!isset(self::$traidWordBook[$subDeviceType])) return;
return self::$traidWordBook[$subDeviceType];
}
static function getType($subDeviceCommand){
if (!isset(self::$commandWordBook[$subDeviceCommand])) return;
return self::$commandWordBook[$subDeviceCommand];
}
static function getAttribute($subDeviceType){
if (!isset(self::$attributeWordBook[$subDeviceType])) return;
return self::$attributeWordBook[$subDeviceType];
}
static function getQueryJson($deviceType, $type){
return self::$wordBook[$type];
}
}