Publish availability of devices

This commit is contained in:
Thomas Lovén 2021-01-29 21:25:34 +01:00
parent 61d16fc07c
commit f3b8181107
2 changed files with 22 additions and 0 deletions

View file

@ -27,6 +27,12 @@ async function main() {
);
const client = new MqttClient(config.mqttBroker, config.mqttUsername, config.mqttPassword);
['SIGINT', 'SIGHUP', 'SIGTERM'].forEach(signal => {
process.on(signal, () => {
client.disconnect(() => process.exit(0));
});
});
plejdApi.login().then(() => {
// load all sites and find the one that we want (from config)
plejdApi.getSites().then((site) => {