스마트 홈 ColorTemperature 트레잇 스키마

action.devices.traits.ColorTemperature - 이 특성은 색상 온도를 설정할 수 있는 모든 기기에 속합니다.

이는 켈빈 색상 포인트를 사용하는 '따뜻한' 전구에 적용됩니다. 이는 일반적으로 ColorSpectrum과는 별도의 모달리티이며, 온도를 통해 스펙트럼에서 도달할 수 없는 화이트 포인트가 있을 수 있습니다. 사용 가능한 특성에 따라 Google은 요청 및 조명 유형에 따라 사용할 적절한 모드를 선택할 수 있습니다. 예를 들어 거실 조명을 흰색으로 설정하면 일부 전구에 온도 명령어를 전송하고 LED 스트립으로 스펙트럼 명령어를 전송할 수 있습니다.

기기 ATTRIBUTES

속성 정의
temperatureMinK 선택사항입니다. temperatureMaxK 설정 시 필수입니다. 빛에 의해 지원되는 최소 색 온도(켈빈)입니다.
temperatureMaxK 선택사항입니다. temperatureMinK 설정 시 필수입니다. 조명에 의해 지원되는 최대 색상 온도이며 단위는 켈빈(K)입니다.

샘플 SYNC 요청 및 응답

{
   
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
   
"inputs": [{
     
"intent": "action.devices.SYNC"
   
}]
}
'use strict';

const {smarthome} = require('actions-on-google');
const functions = require('firebase-functions');

const app = smarthome();

app
.onSync((body, headers) => {
 
return {
    requestId
: body.requestId,
    payload
: {
      agentUserId
: '1836.15267389',
      devices
: [{
        id
: '123',
        type
: 'action.devices.types.LIGHT',
        traits
: [
         
'action.devices.traits.ColorTemperature'
       
],
        name
: {
          defaultNames
: ['AAA bulb A19 color hyperglow'],
          name
: 'lamp1',
          nicknames
: ['reading lamp']
       
},
        willReportState
: true,
        attributes
: {
          temperatureMinK
: 2000,
          temperatureMaxK
: 6500
       
},
        deviceInfo
: {
          manufacturer
: 'AAA',
          model
: 'hg11',
          hwVersion
: '1.2',
          swVersion
: '5.4'
       
},
        customData
: {
          fooValue
: 12,
          barValue
: false,
          bazValue
: 'dancing alpaca'
       
}
     
}]
   
}
 
};
});

// ...

exports
.smarthome = functions.https.onRequest(app);
{
 
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
 
"payload": {
   
"agentUserId": "1836.15267389",
   
"devices": [
     
{
       
"id": "123",
       
"type": "action.devices.types.LIGHT",
       
"traits": [
         
"action.devices.traits.ColorTemperature"
       
],
       
"name": {
         
"defaultNames": [
           
"AAA bulb A19 color hyperglow"
         
],
         
"name": "lamp1",
         
"nicknames": [
           
"reading lamp"
         
]
       
},
       
"willReportState": true,
       
"attributes": {
         
"temperatureMinK": 2000,
         
"temperatureMaxK": 6500
       
},
       
"deviceInfo": {
         
"manufacturer": "AAA",
         
"model": "hg11",
         
"hwVersion": "1.2",
         
"swVersion": "5.4"
       
},
       
"customData": {
         
"fooValue": 12,
         
"barValue": false,
         
"bazValue": "dancing alpaca"
       
}
     
}
   
]
 
}
}

기기 상태

상태 정의
color 객체. 현재 색상 설정입니다. 주어진 광원이 스펙트럼 또는 온도 모드에 있으므로 이 객체에는 관련 모드의 현재 색상 설정이 포함됩니다.
  • name 문자열. 색상 포인트 (스펙트럼 또는 온도)가 파트너의 색상 목록에 있는 미리 설정된 이름과 일치하면 이름을 반환합니다.
  • temperature 정수. 색상 온도이며 단위는 켈빈(K)입니다.

샘플 QUERY 요청 및 응답

현재 조명 색상 온도는 어떻게 되나요?
{
 
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
 
"inputs": [{
   
"intent": 'action.devices.QUERY',
   
"payload": {
     
"devices": [{
       
"id": "123",
       
"customData": {
         
"fooValue": 74,
         
"barValue": true,
         
"bazValue": "foo"
       
}
     
}]
   
}
 
}]
}
'use strict';

const {smarthome} = require('actions-on-google');
const functions = require('firebase-functions');

const app = smarthome();

app
.onQuery((body, headers) => {
 
return {
    requestId
: body.requestId,
    payload
: {
      devices
: {
       
123: {
          online
: true,
          color
: {
            name
: 'warm white',
            temperature
: 25000
         
},
          status
: 'SUCCESS'
       
}
     
}
   
}
 
};
});

// ...

exports
.smarthome = functions.https.onRequest(app);
{
 
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
 
"payload": {
   
"devices": {
     
"123": {
       
"online": true,
       
"color": {
         
"name": "warm white",
         
"temperature": 25000
       
},
       
"status": "SUCCESS"
     
}
   
}
 
}
}

기기 명령어

명령어 매개변수/정의
action.devices.commands.ColorAbsolute color 객체입니다. 필수 항목입니다. RGB 또는 온도와 선택적으로 이름을 포함합니다.
  • name 문자열. 사용자 명령어에 제공된 색상 이름 (영어) 항상 사용할 수 있는 것은 아닙니다 (상대적 명령의 경우).
  • temperature 정수. 색상 온도이며 단위는 켈빈(K)입니다.

샘플 EXECUTE 요청 및 응답

조명을 부드러운 흰색으로 조정해 줘.
{
 
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
 
"inputs": [{
   
"intent": "action.devices.EXECUTE",
   
"payload": {
     
"commands": [{
       
"devices": [{
         
"id": "123",
         
"customData": {
           
"fooValue": 74,
           
"barValue": true,
           
"bazValue": "sheepdip"
         
}
       
}],
       
"execution": [{
         
"command": "action.devices.commands.ColorAbsolute",
         
"params": {
             
"color": {
               
"name": "soft white",
               
"temperature": 2700
             
}
         
}
       
}]
     
}]
   
}
 
}]
}
'use strict';

const {smarthome} = require('actions-on-google');
const functions = require('firebase-functions');

const app = smarthome();

app
.onExecute((body, headers) => {
 
return {
    requestId
: body.requestId,
    payload
: {
      commands
: [{
        ids
: ['123'],
        status
: 'SUCCESS',
        states
: {
          color
: {
            name
: 'soft white',
            temperature
: 2700
         
}
       
}
     
}]
   
}
 
};
});

// ...

exports
.smarthome = functions.https.onRequest(app);
{
 
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
 
"payload": {
   
"commands": [
     
{
       
"ids": [
         
"123"
       
],
       
"status": "SUCCESS",
       
"states": {
         
"color": {
           
"name": "soft white",
           
"temperature": 2700
         
}
       
}
     
}
   
]
 
}
}