স্মার্ট হোম কালার টেম্পারেচার ট্রেইট স্কিমা

action.devices.traits.ColorTemperature - এই বৈশিষ্ট্যটি যে কোনও ডিভাইসের অন্তর্গত যা রঙের তাপমাত্রা সেট করতে সক্ষম।

এটি "উষ্ণতা" বাল্বের ক্ষেত্রে প্রযোজ্য যা কেলভিনে একটি রঙ বিন্দু নেয়। এটি সাধারণত ColorSpectrum থেকে একটি পৃথক পদ্ধতি, এবং তাপমাত্রার মাধ্যমে সাদা বিন্দু উপলব্ধ থাকতে পারে যা স্পেকট্রাম দ্বারা পৌঁছানো যায় না। উপলব্ধ বৈশিষ্ট্যের উপর ভিত্তি করে, Google অনুরোধ এবং আলোর প্রকারের উপর ভিত্তি করে ব্যবহার করার জন্য উপযুক্ত মোড বেছে নিতে পারে (উদাহরণস্বরূপ, বসার ঘরের আলো সাদা করুন কিছু বাল্বে তাপমাত্রা কমান্ড এবং LED স্ট্রিপে স্পেকট্রাম কমান্ড পাঠাতে পারে)।

ডিভাইস বৈশিষ্ট্য

বৈশিষ্ট্য সংজ্ঞা
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"
       
}
     
}
   
]
 
}
}

ডিভাইস STATES

অবস্থা সংজ্ঞা
color অবজেক্ট। বর্তমান রঙ সেটিং। যেহেতু একটি প্রদত্ত আলো বর্ণালী বা তাপমাত্রা মোডে থাকে, তাই এই বস্তুটি প্রাসঙ্গিক মোডে বর্তমান রঙের সেটিংস অন্তর্ভুক্ত করে।
  • name স্ট্রিং। যদি রঙের বিন্দু (স্পেকট্রাম বা তাপমাত্রা) অংশীদারের রঙের তালিকায় একটি পূর্বনির্ধারিত নামের সাথে মিলে যায়, তাহলে নামটি ফেরত দিন।
  • temperature পূর্ণসংখ্যা। কেলভিনে রঙের তাপমাত্রা।

নমুনা QUERY অনুরোধ এবং প্রতিক্রিয়া

আমার বর্তমান হালকা রঙের তাপমাত্রা কত?
অনুরোধNode.jsJSON
{
 
"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 পূর্ণসংখ্যা। কেলভিনে রঙের তাপমাত্রা।

নমুনা EXECUTE অনুরোধ এবং প্রতিক্রিয়া

নরম সাদা আমার আলো সামঞ্জস্য.
অনুরোধNode.jsJSON
{
 
"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
         
}
       
}
     
}
   
]
 
}
}