blinker-iot / blinker-js Goto Github PK
View Code? Open in Web Editor NEWBlinker node.js library for hardware. Works with Raspberry Pi, Banana Pi, linux, windows, macos.
License: MIT License
Blinker node.js library for hardware. Works with Raspberry Pi, Banana Pi, linux, windows, macos.
License: MIT License
运行例子程序 example_miot_light.ts
用小爱控制 打开设备,小爱报错:要操作的设备好像出问题了,等一会再试吧。
日志:
#ts-node -i example/miot/example_miot_light.ts
{
detail: {
broker: 'blinker',
deviceName: 'C008B9391EK2D08KDKTY1HFZ',
host: 'mqtts://broker.diandeng.tech',
iotId: 'ARQNLBMswFFoNRyMA5V95rQXkE',
iotToken: 'Ro8TMzRLUp7vJMyLAJCFhKMoGLgWbyUR',
port: '1884',
productKey: 'blinker',
uuid: '41450bfca16d11edb9025254'
},
message: 1000
}
mqtt broker:blinker
mqtt blinker connected
{"fromDevice":"ServerSender","data":{"get":"state","from":"MIOT","messageId":"63db698437b86208"}}
MIOT>device {"get":"state","from":"MIOT","messageId":"63db698437b86208"}
ServerSender MIOT
{"fromDevice":"ServerSender","data":{"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"63db698537b8620a"}}
MIOT>device {"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"63db698537b8620a"}
ServerSender MIOT
在VoiceAssistant类中subTopic和pubTopic定义的topic和实际服务器发回来的topic不符,服务器发来信息后,本地会对topic进行校验,因为两个topic不符导致校验一直不通过,代码不会往下走
if (topic.indexOf(this.subTopic.substr(0, this.subTopic.length - 1)) > -1) {
实际topic
/device/XXXXXXXXX/r
定义的topic
/sys/blinker/XXXXXXXXX/rrpc/request/+
我照着nodejs的代码交互用golang实现了部分功能,反馈设备状态这部分的消息格式是否过时了?还是免费版的语音对接有问题?小爱总是说设备已经关闭,即使设备不在线也是这样回复。
接入小爱同学后,使用小爱同学操作设备,设备接收得到调用,但不会调用回调函数
接收到调用后 voice-assistant.ts 中使用以下代码判断是否进行处理
get subTopic() {
return `/sys/${this.device.config.productKey}/${this.device.config.deviceName}/rrpc/request/+`
}
if (topic.indexOf(this.subTopic.substr(0, this.subTopic.length - 1)) > -1) {
let data;
let fromDevice;
let messageId;
try {
let messageString = u8aToString(message)
let messageObject = JSON.parse(messageString)
fromDevice = messageObject.fromDevice
data = messageObject.data
this.targetDevice = fromDevice
messageId = topic.split('/')[6]
vaLog(data, `${this.vaName}>device`)
} catch (error) {
console.log(error);
}
if (fromDevice == this.vaName) {
this.processData(messageId, data);
}
}
实际上获取到的
subTopic=/sys/blinker/{productKey}/rrpc/request/+
topic=/device/{productKey}/r
无法进行正确处理
判断是否来自 MIOT 调用时使用 if (fromDevice == this.vaName)
进行判断,接收的 fromDevice
应为 MIOT
但实际接收为 ServerSender
无法正常调用回调函数
比如从开发到部署怎么搞,还有写组件的使用方法,对应有哪些API什么的,从现在的文档看有点一头雾水。。。
您好,我在尝试使用米家绑定点灯科技账号的时候,总是提示用户名或者密码错误,但是我已经经过多次核对,并且相同的用户名和密码可以绑定微信,我想知道这是为什么,以及我怎么才能绑定米家?
Line 8 in e6431ae
如果是编码错误希望及时修复
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.