sinricpro / nodejs-sdk

Nodejs library for https://sinric.pro
11 stars 7 forks source link

Keep Getting "Too many events!" #49

Closed mithil-shah closed 5 months ago

mithil-shah commented 5 months ago

Hi there! I am using the NodeJS SDK to set the state of my Sinric Pro lock. I am using the following code and receving a "Too many events!" error. I also confirmed that my appKey and secretKey are the same as the one selected for the lock. I am able to use API calls, but would prefer to use the SDK if possible instead. Could I please have some help resovling this? Thanks!

const { SinricPro, startSinricPro, eventNames, raiseEvent } = require('sinricpro');
require('dotenv').config();

const appKey = "<MY_APP_KEY>";
const secretKey = "<MY_SECRET_KEY>";
const deviceIds = ["<MY_LOCK_ID>"];

const setLockState = async (deviceid, data) => {
  console.log(deviceid, data);
  return true;
}

const onDisconnect = () => {
  console.log("Connection closed");
};

const callbacks = {
  setLockState,
  onDisconnect
};

const sinricpro = new SinricPro(appKey, deviceIds, secretKey, true);
startSinricPro(sinricpro, callbacks);
raiseEvent(sinricpro, eventNames.lock, deviceIds[0], { state: 'UNLOCKED' });