Git additional Updates

This commit is contained in:
JonatanRek 2020-05-15 19:48:53 +02:00
parent d7a5d35f54
commit 02ba4e5d6f
3 changed files with 11 additions and 10 deletions

View File

@ -19,7 +19,6 @@ class GoogleHomeApi {
//$apiLogManager->write("[Google Home] action.devices.QUERY", LogRecordType::INFO); //$apiLogManager->write("[Google Home] action.devices.QUERY", LogRecordType::INFO);
break; break;
case 'action.devices.EXECUTE': case 'action.devices.EXECUTE':
GoogleHome::execute($obj['requestId'], $obj['inputs'][0]['payload']); GoogleHome::execute($obj['requestId'], $obj['inputs'][0]['payload']);
$apiLogManager->write("[Google Home] action.devices.EXECUTE", LogRecordType::INFO); $apiLogManager->write("[Google Home] action.devices.EXECUTE", LogRecordType::INFO);
@ -36,7 +35,7 @@ class GoogleHomeApi {
$apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordType::INFO); $apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordType::INFO);
$get = [ $get = [
"access_token"=>"23165133", "access_token"=>"2222255888",
"token_type"=>"Bearer", "token_type"=>"Bearer",
"state"=>$_GET["state"], "state"=>$_GET["state"],
]; ];

View File

@ -12,6 +12,14 @@ class GoogleHome {
//Google Compatibile Action Type //Google Compatibile Action Type
$actionType = GoogleHomeDeviceTypes::getAction($subDeviceData['type']); $actionType = GoogleHomeDeviceTypes::getAction($subDeviceData['type']);
if (
strpos($deviceData['name'], 'Světlo') !== false ||
strpos($deviceData['name'], 'světlo') !== false
) {
$actionType = 'action.devices.types.LIGHT';
}
$tempDevice = [ $tempDevice = [
'id' => (string) $subDeviceData['subdevice_id'], 'id' => (string) $subDeviceData['subdevice_id'],
'type' => $actionType, 'type' => $actionType,

View File

@ -82,6 +82,7 @@ class GoogleHomeDeviceTypes {
static function getSyncObj($deviceBaseObj, $deviceType){ static function getSyncObj($deviceBaseObj, $deviceType){
switch ($deviceType) { switch ($deviceType) {
case 'action.devices.types.LIGHT':
case 'action.devices.types.OUTLET': case 'action.devices.types.OUTLET':
$deviceBaseObj['traits'] = [ $deviceBaseObj['traits'] = [
'action.devices.traits.OnOff' 'action.devices.traits.OnOff'
@ -92,15 +93,8 @@ class GoogleHomeDeviceTypes {
'action.devices.traits.TemperatureSetting', 'action.devices.traits.TemperatureSetting',
]; ];
$deviceBaseObj['attributes'] = [ $deviceBaseObj['attributes'] = [
"availableThermostatModes" => "off,heat,on", "availableThermostatModes" => "off,heat",
"thermostatTemperatureRange" => [
'minThresholdCelsius' => 5,
'maxThresholdCelsius' => 30,
],
"thermostatTemperatureUnit" => "C", "thermostatTemperatureUnit" => "C",
"commandOnlyTemperatureSetting" => true,
"queryOnlyTemperatureSetting" => true,
"bufferRangeCelsius" => 0,
]; ];
break; break;
} }