mirror of
https://github.com/lasthead0/yandex2mqtt.git
synced 2025-08-08 09:01:00 +03:00
test
This commit is contained in:
59
app.js
59
app.js
@@ -112,39 +112,32 @@ global.mqttClient = mqtt.connect(`mqtt://${config.mqtt.host}`, {
|
||||
ldevice.updateState(`${message}`, instance);
|
||||
|
||||
/* */
|
||||
if (config.yandex != undefined) {
|
||||
const {skillId, token} = config.yandex;
|
||||
const noticeRequest = https.request({
|
||||
hostname: 'dialogs.yandex.net',
|
||||
port: 443,
|
||||
path: `/api/v1/skills/${skillId}/callback/state`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': token,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}, res => {
|
||||
res.on('data', d => {
|
||||
console.log(d);
|
||||
});
|
||||
res.on('error', err => {
|
||||
console.log(err);
|
||||
})
|
||||
});
|
||||
const st = ldevice.getState();
|
||||
noticeRequest.write(JSON.stringify({
|
||||
ts: Math.floor(Date.now() / 1000),
|
||||
payload: {
|
||||
user_id: "1",
|
||||
devices: [{
|
||||
id: deviceId,
|
||||
capabilities: st.capabilities,
|
||||
properties: st.properties
|
||||
}]
|
||||
}
|
||||
}));
|
||||
noticeRequest.end();
|
||||
}
|
||||
// if (config.yandex != undefined) {
|
||||
// const {skillId, token} = config.yandex;
|
||||
// const noticeRequest = https.request({
|
||||
// hostname: 'dialogs.yandex.net',
|
||||
// port: 443,
|
||||
// path: `/api/v1/skills/${skillId}/callback/state`,
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Authorization': token,
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// });
|
||||
// const st = ldevice.getState();
|
||||
// noticeRequest.write(JSON.stringify({
|
||||
// ts: Math.floor(Date.now() / 1000),
|
||||
// payload: {
|
||||
// user_id: "1",
|
||||
// devices: [{
|
||||
// id: deviceId,
|
||||
// capabilities: st.capabilities,
|
||||
// properties: st.properties
|
||||
// }]
|
||||
// }
|
||||
// }));
|
||||
// noticeRequest.end();
|
||||
// }
|
||||
/* */
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user