import Hass from '../src/homeassistant.js' import readYaml from 'load-yaml-file' ; (async () => { let opts = await readYaml(process.env.HA_OPTS_PATH || './examples/opts.yaml') // opts.ppmonitor = false // turn off automated ping/pong connection monitor for this example - on by default console.log(opts) const hass = new Hass(opts) hass.on('connection', msg => console.log(`connection: ${msg}`)) hass.once('connection', () => console.log('now try disconnecting/stopping home assistant')) await hass.connect() })().catch(err => { console.error('FATAL: UNABLE TO START SYSTEM!\n',err) process.kill(process.pid, 'SIGTERM') })