Open grasgruenit opened 4 months ago
Anyone could give me a hint?
Are you using a specific module on node-red or something you came up with?
Just a function node with this code:
const crypto = global.get('crypto');
const https = global.get('https');
const token = "xxx";
const secret = "xxx";
const t = Date.now();
const nonce = "requestID";
const data = token + t + nonce;
const signTerm = crypto.createHmac('sha256', secret)
.update(Buffer.from(data, 'utf-8'))
.digest();
const sign = signTerm.toString("base64");
node.warn(sign);
const options = {
hostname: 'api.switch-bot.com',
port: 443,
path: `/v1.1/devices`,
method: 'GET',
headers: {
"Authorization": token,
"sign": sign,
"nonce": nonce,
"t": t,
'Content-Type': 'application/json'
}
};
const req = https.request(options, function (res) {
let responseData = '';
res.on('data', function (chunk) {
responseData += chunk;
});
res.on('end', function () {
msg.payload = responseData;
node.send(msg);
});
});
req.on('error', function (error) {
node.error(error);
});
req.end();
Have you tried with other modules like Homebridge to see if you get the same results?
No I have not as I have no Homekit / Homebridge running yet.
Probably will use an Zigbee IR Bridge for my project now. https://www.zigbee2mqtt.io/devices/ZS06.html
I would see if it is your function or the api by trying something else.
Have you tried this: https://github.com/tatuto017/node-red-contrib-switchbot-api
No, I am not sure how to install it. In the NR palette, I can only install the old 1.0 version.
/ Manuel Glojek | +436643256932 Zeit und Platz sparende Kurzsignatur. Ich bitte um Nachsicht für eventuell fehlende persönliche Anrede und Grüße.
Am Di., 30. Juli 2024 um 17:59 Uhr schrieb Donavan Becker < @.***>:
I would see if it is your function or the api by trying something else.
Have you tried this: https://github.com/tatuto017/node-red-contrib-switchbot-api
— Reply to this email directly, view it on GitHub https://github.com/OpenWonderLabs/SwitchBotAPI/issues/323#issuecomment-2258692197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ6K4JNWG42XCOEYJCZSBE3ZO6Z7JAVCNFSM6AAAAABKVXHIOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJYGY4TEMJZG4 . You are receiving this because you authored the thread.Message ID: @.***>
Current Situation
When I use the API to list my devices, I only get my AC which is connected to a Hub MIni, but I have a Lock on an other Hub Mini and an infrared-device on a third Hub Mini. How can I list all devices?
Logs
Configuration
Environment
Node-Red
Additional Context
No response