我刚下载并运行
the sample from here
。它正在工作,但每当我连接到网站时(
https://something.ngrok.io/
)甚至刷新它都需要花费大量的时间和节点。js控制台显示它得到了很多“/bower\u组件”,甚至还以为我用同一个帐户(“rick/oldman”)登录过,以前添加的设备都不见了。
我想添加一个持久的简单虚拟光,所以我看到了数据存储。js,或者文档丢失了,或者我找不到它。我唯一能找到的就是评论。
/**
* Structure of Data
* {
* <uid>: {
* <device id>: {
* properties: {
* <property name>: <property value>,
* <property name>: <property value>
* },
* states: {
* <state name>: <state value>,
* <state name>: <state value>
* }
* },
* <device id>: {...}
* },
* <uid>: {
* <device id>: {...},
* <device id>: {...},
* <device id>: {...}
* },
* ...
* }
*/
没有样本,所以我根据日志推断(在网站上创建了一个设备),并创建了一个这样的设备,但这个设备没有显示出来。
const config = require('./config-provider');
const Data = {
"f9b2dc04-2518-11e8-b467-0ed5f89f718b":{
"light1":{
"states":{
"on": false,
"online":true
},
"properties":{
"type":"action.devices.types.LIGHT",
"traits":["action.devices.traits.OnOff"],
"attributes":{
"temperatureMinK":2000,
"temperatureMaxK":6500
},
"name":{
"defaultNames":[
"Fake Light"
],
"name":"Fake Light 1",
"nicknames":[
"fake lamp"
]
},
"willReportState":false,
"roomHint":"",
"deviceInfo":{
"manufacturer":"Fake Home Provider",
"model":"fake1234",
"swVersion":"1.0.0",
"hwVersion":"1.0"
},
"customData":{
"smartHomeProviderId":"thisisfakesuperfake"
}
}
}
}
};
我不确定数据是否正确;我找不到这方面的任何样品。我需要做什么才能拥有一个持久的虚拟设备并防止重新下载bower组件?