几天来,我一直在做大量的研究和测试,我决定到这里来问,因为老实说,我完全不知道该怎么做。我已经能够编码很长一段时间了,但我决定尝试使用node.js连接到homey。我一直在关注教程,在不同的网站上,但我无法让它发挥作用。我的问题是试图连接到家。我的当前代码如下:
const AthomCloudAPI = require('homey-api/lib/AthomCloudAPI');
async function myhome(){
// Create a Cloud API instance
const cloudApi = new AthomCloudAPI({
clientId: 'MyId',
clientSecret: 'MySecret',
});
// Get the logged in user
const user = await cloudApi.getAuthenticatedUser();
// Get the first Homey of the logged in user
const homeyApi = await user.getFirstHomey();
// Create a session on this Homey
const homey = await homey.authenticate();
}
myhome();我得到的错误是:
APIError: The access token was not found我知道我需要验证,但这是我有问题的部分。我该怎么做?
发布于 2022-01-07 10:48:46
Homey文档包含一个可以在本地测试项目的示例和API凭据。https://api.developer.homey.app/
const AthomCloudAPI = require('homey-api/lib/AthomCloudAPI');
// Create a Cloud API instance
const cloudApi = new AthomCloudAPI({
clientId: '5a8d4ca6eb9f7a2c9d6ccf6d',
clientSecret: 'e3ace394af9f615857ceaa61b053f966ddcfb12a',
});如果你试着运行它能起作用吗?
https://stackoverflow.com/questions/70339664
复制相似问题