From d4785960b4f7c65720f5613bf3d7d93d449b893a Mon Sep 17 00:00:00 2001 From: Nicolas Dujardin Date: Sun, 24 Mar 2019 11:10:49 +0100 Subject: [PATCH] trying to avoid lib update for the moment --- harmonyBase.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/harmonyBase.js b/harmonyBase.js index a72c2a5..ae81ea7 100644 --- a/harmonyBase.js +++ b/harmonyBase.js @@ -160,6 +160,12 @@ HarmonyBase.prototype = { } }, + _onMessage(message) { + if (message.type === 'automation.state?notify') { + this.harmony.emit('automationState', message); + } + }, + configureAccessories: function(harmonyPlatform, callback) { harmonyPlatform.log('INFO - Loading activities...'); @@ -167,6 +173,10 @@ HarmonyBase.prototype = { this.harmony.on('open', () => { harmonyPlatform.log.debug('INFO - socket opened'); + //adding listener + this.harmony._client.onUnpackedMessage.addListener( + this._onMessage.bind(this) + ); }); this.harmony.on('close', () => {