A module for reading and changing status of Verisure devices.
This software is not affiliated with Verisure Holding AB and the developers take no legal responsibility for the functionality or security of your alarms and devices.
$ npm install verisure --saveconstVerisure=require('verisure');constverisure=newVerisure('my@email.com','mysecretpassword');verisure.getToken().then(()=>verisure.getInstallations()).then((installations)=>installations[0].client({operationName: 'Broadband',query: `query Broadband($giid: String!) { installation(giid: $giid) { broadband { testDate isBroadbandConnected __typename } __typename } }`,})).then((broadband)=>{console.log('BROADBAND:',broadband);}).catch((error)=>{console.error(error);});For users with MFA enabled, you need to invoke getToken twice. First without arguments, second with the one-time code.
constverisure=newVerisure(email,password);awaitverisure.getToken();console.log('One-time code sent.');awaitverisure.getToken(code);console.log(verisure.cookies);Once you retrieve the cookies, these can be used to make authenticated requests.
constverisure=newVerisure('my@email.com',null,['vid=myTopSecretToken','vs-access=myAccessToken','vs-refresh=myRefreshToken']);constinstallations=awaitverisure.getInstallations();