स्मार्ट होम कलरटेंपरेचर एट्रिब्यूट स्कीमा

action.devices.traits.ColorTemperature - यह trait ऐसे किसी भी डिवाइस का है जो कलर टेंपरेचर को सेट कर सकता है.

यह "वॉर्म्थ" बल्ब पर लागू होता है, जो केल्विन में कलर पॉइंट लेते हैं. यह आम तौर पर ColorSpectrum से अलग मोडलिटी है. साथ ही, हो सकता है कि टेंपरेचर के ज़रिए ऐसे व्हाइट पॉइंट उपलब्ध हों, जिन्हें स्पेक्ट्रम से न देखा जा सके. उपलब्ध विशेषताओं के आधार पर, Google अनुरोध और लाइट टाइप के आधार पर इस्तेमाल करने के लिए सही मोड चुन सकता है (उदाहरण के लिए, लिविंग रूम की लाइट सफ़ेद रंग की करें, कुछ बल्ब को तापमान के निर्देश और एलईडी स्ट्रिप को स्पेक्ट्रम के निर्देश भेज सकते हैं).

डिवाइस ATTRIBUTES

एट्रिब्यूट परिभाषा
temperatureMinK ज़रूरी नहीं. अगर temperatureMaxK सेट है, तो इसका इस्तेमाल करना ज़रूरी है. केल्विन में, रोशनी के साथ काम करने वाला कम से कम कलर टेंपरेचर.
temperatureMaxK ज़रूरी नहीं. अगर temperatureMinK सेट है, तो इसका इस्तेमाल करना ज़रूरी है. केल्विन में रोशनी के साथ काम करने वाला ज़्यादा से ज़्यादा रंग तापमान.

सिंक के अनुरोध और जवाब का नमूना

{
   
"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 पूर्णांक. केल्विन में रंग का तापमान.

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"
     
}
   
}
 
}
}

डिवाइस COMMANDS

आदेश पैरामीटर/परिभाषा
action.devices.commands.ColorAbsolute color ऑब्जेक्ट. ज़रूरी है. इसमें आरजीबी या टेंपरेचर शामिल होगा. चाहें, तो इसे कोई नाम भी दिया जा सकता है.
  • name स्ट्रिंग. रंग का नाम (अंग्रेज़ी में), जैसा कि उपयोगकर्ता के निर्देश में बताया गया है. हमेशा उपलब्ध नहीं होता (सापेक्ष निर्देशों के लिए).
  • temperature पूर्णांक. केल्विन में रंग का तापमान.

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
         
}
       
}
     
}
   
]
 
}
}