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);
|
ldevice.updateState(`${message}`, instance);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
if (config.yandex != undefined) {
|
// if (config.yandex != undefined) {
|
||||||
const {skillId, token} = config.yandex;
|
// const {skillId, token} = config.yandex;
|
||||||
const noticeRequest = https.request({
|
// const noticeRequest = https.request({
|
||||||
hostname: 'dialogs.yandex.net',
|
// hostname: 'dialogs.yandex.net',
|
||||||
port: 443,
|
// port: 443,
|
||||||
path: `/api/v1/skills/${skillId}/callback/state`,
|
// path: `/api/v1/skills/${skillId}/callback/state`,
|
||||||
method: 'POST',
|
// method: 'POST',
|
||||||
headers: {
|
// headers: {
|
||||||
'Authorization': token,
|
// 'Authorization': token,
|
||||||
'Content-Type': 'application/json'
|
// 'Content-Type': 'application/json'
|
||||||
}
|
// }
|
||||||
}, res => {
|
// });
|
||||||
res.on('data', d => {
|
// const st = ldevice.getState();
|
||||||
console.log(d);
|
// noticeRequest.write(JSON.stringify({
|
||||||
});
|
// ts: Math.floor(Date.now() / 1000),
|
||||||
res.on('error', err => {
|
// payload: {
|
||||||
console.log(err);
|
// user_id: "1",
|
||||||
})
|
// devices: [{
|
||||||
});
|
// id: deviceId,
|
||||||
const st = ldevice.getState();
|
// capabilities: st.capabilities,
|
||||||
noticeRequest.write(JSON.stringify({
|
// properties: st.properties
|
||||||
ts: Math.floor(Date.now() / 1000),
|
// }]
|
||||||
payload: {
|
// }
|
||||||
user_id: "1",
|
// }));
|
||||||
devices: [{
|
// noticeRequest.end();
|
||||||
id: deviceId,
|
// }
|
||||||
capabilities: st.capabilities,
|
|
||||||
properties: st.properties
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
noticeRequest.end();
|
|
||||||
}
|
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user