Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env node
const pkg = require('../package.json')
const log = require('yalm')
const config = require('./config.js')
const mqtt = require('mqtt')
const SonosManager = require('@svrooij/sonos').SonosManager
const SonosEvents = require('@svrooij/sonos').SonosEvents
let mqttClient
const devices = []
function start () {
log.setLevel(config.verbosity)
log.info(pkg.name + ' ' + pkg.version + ' starting')
// MQTT Stuff
log.info('Parsing url %s', config.mqtt)
const url = new URL(config.mqtt)
// Define the will message (is send on disconnect).
const mqttOptions = {
will: {
topic: config.name + '/connected',