Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const auth = require(__dirname + '/lib/google_auth');
// you have to require the utils module and call adapter function
const utils = require('@iobroker/adapter-core'); // Get common adapter utils
// for communication
const request = require('request');
const min_polling_interval = 30; // minimum polling interval in seconds
const trigger_poll_state = 'trigger_poll'; // state for triggering a poll
// you have to call the adapter function and pass a options object
// name has to be set and has to be equal to adapters folder name and main file name excluding extension
// adapter will be restarted automatically every time as the configuration changed, e.g system.adapter.google-sharedlocations.0
const adapter = new utils.adapter('google-sharedlocations');
let google_polling_interval_id = null;
let google_cookie_header = null;
// triggered when the adapter is installed
adapter.on('install', function () {
// create connection variable https://github.com/ioBroker/ioBroker/wiki/Adapter-Development-Documentation#infoconnection
});
// is called when the adapter shuts down - callback has to be called under any circumstances!
adapter.on('unload', function (callback) {
try {
// logout from google
auth.logout(function (err) {
if (err) {
adapter.log.error('Could not logout from google when unloading the adapter.');
* Adapter to communicate with a UniFi-Controller instance
* dealing with UniFi-WiFi-Devices
*
*/
/* jshint -W097 */// jshint strict:false
/*jslint node: true */
"use strict";
// you have to require the utils module and call adapter function
var utils = require('@iobroker/adapter-core'); // Get common adapter utils
// you have to call the adapter function and pass a options object
// name has to be set and has to be equal to adapters folder name and main file name excluding extension
// adapter will be restarted automatically every time as the configuration changed, e.g system.adapter.unifi.0
var adapter = utils.adapter('unifi');
// define a timeout variable so that
// we can check the controller in regular intervals
var queryTimeout;
// is called when adapter shuts down - callback has to be called under any circumstances!
adapter.on('unload', function (callback) {
try {
// clear the timeout
if(queryTimeout)
clearTimeout(queryTimeout);
adapter.log.info('cleaned everything up...');
callback();
} catch (e) {