Split registration and app

This commit is contained in:
simojenki
2021-05-14 15:08:22 +10:00
parent 73981c7aa2
commit 0258c6e5a9
4 changed files with 103 additions and 40 deletions

20
src/register.ts Normal file
View File

@@ -0,0 +1,20 @@
import config from "./config";
import logger from "./logger";
import sonos, { bonobService } from "./sonos";
const bonob = bonobService(
config.sonos.serviceName,
config.sonos.sid,
config.webAddress,
"AppLink"
);
const sonosSystem = sonos(config.sonos.deviceDiscovery, config.sonos.seedHost);
sonosSystem.register(bonob).then((success) => {
if (success) {
logger.info(
`Successfully registered ${bonob.name}(SID:${bonob.sid}) with sonos`
);
}
});