스마트 홈 작업을 개발하는 방법을 알아볼 수 있는 새로운 공간인 Google Home 개발자 센터에 오신 것을 환영합니다. 참고: Actions 콘솔에서 작업을 계속 만들 수 있습니다.
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
스마트 홈 ColorSpectrum 속성 스키마
action.devices.traits.ColorSpectrum
- 이 특성은 색상 스펙트럼을 설정할 수 있는 모든 기기에 속합니다. 이는 RGB 색상 범위를 사용하는 '전체' 색상 전구에 적용됩니다. 광원은 ColorSpectrum과 ColorTemperature의 조합을 포함할 수 있습니다. 악센트 조명과 LED 스트립에는 Spectrum이 있을 수 있지만 일부 독서용 전구에는 온도만 있습니다. 기본 전구나 스마트 플러그의 덤불 중 어느 것도 작동하지 않습니다.
기기 속성
속성 |
정의 |
colorModel |
선택사항. HSV (색조, 채도, 값) 색상 모델의 기기 환경설정을 나타내기 위해 문자열 hsv 로 설정할 수 있습니다. 기본값은 rgb 입니다. |
샘플 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.ColorSpectrum'
],
name: {
defaultNames: ['AAA bulb A19 color hyperglow'],
name: 'lamp1',
nicknames: ['reading lamp']
},
willReportState: true,
attributes: {
colorModel: 'rgb'
},
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.ColorSpectrum"
],
"name": {
"defaultNames": [
"AAA bulb A19 color hyperglow"
],
"name": "lamp1",
"nicknames": [
"reading lamp"
]
},
"willReportState": true,
"attributes": {
"colorModel": "rgb"
},
"deviceInfo": {
"manufacturer": "AAA",
"model": "hg11",
"hwVersion": "1.2",
"swVersion": "5.4"
},
"customData": {
"fooValue": 12,
"barValue": false,
"bazValue": "dancing alpaca"
}
}
]
}
}
기기 상태
상태 |
정의 |
color |
객체. 현재 색상 설정 지정된 광원이 스펙트럼 OR 온도 모드이므로 이 객체에는 관련 모드의 현재 색상 설정이 포함됩니다.
name 문자열입니다. 색상 포인트 (스펙트럼 또는 온도)가
파트너의 색상 목록에 있는 사전 설정된 이름과 일치하면 이름을 반환합니다.
spectrumRGB 정수입니다. RGB의 스펙트럼 값 (16진수 값은 정수)입니다.
|
기기 명령어
명령어 |
매개변수/정의 |
action.devices.commands.ColorAbsolute |
color 객체 필수 항목입니다. RGB 또는 온도, 이름은 선택사항입니다.
name 문자열입니다. 사용자 명령어에 제공된 색상 이름 (영문) 항상 사용할 수 있는 것은 아닙니다 (상대적 명령).
spectrumRGB 정수입니다. RGB의 스펙트럼 값 (16진수 값은 정수)입니다.
|
샘플 실행 요청 및 응답
조명을 빨간색으로 설정해 줘.
{
"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": "red",
"spectrumRGB": 16711680
}
}
}]
}]
}
}]
}
'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: 'red',
spectrumRGB: 12655639
}
}
}]
}
};
});
// ...
exports.smarthome = functions.https.onRequest(app);
{
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"commands": [
{
"ids": [
"123"
],
"status": "SUCCESS",
"states": {
"color": {
"name": "red",
"spectrumRGB": 12655639
}
}
}
]
}
}
다음은 다른 호출의 예입니다.
- 조명을 녹색으로 설정해 줘.
- 책상 램프를 빨간색으로 변경해 줘.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-02-03 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"필요한 정보가 없음"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"너무 복잡함/단계 수가 너무 많음"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"오래됨"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"번역 문제"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"샘플/코드 문제"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"기타"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"이해하기 쉬움"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"문제가 해결됨"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"기타"
}]