From fc2640e92c3bc71fd765d0b2420b9b70f81e28f2 Mon Sep 17 00:00:00 2001 From: BigThunderSR <17056173+BigThunderSR@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:48:32 -0500 Subject: [PATCH] Fix polling refresh interval sensor not publishing --- src/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 68760c2b..908fe39b 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,8 @@ const Commands = require('./commands'); const logger = require('./logger'); const fs = require('fs'); //const CircularJSON = require('circular-json'); -let buttonConfigsPublished = '' +let buttonConfigsPublished = ''; +let refreshIntervalConfigPublished = ''; const onstarConfig = { deviceId: process.env.ONSTAR_DEVICEID || uuidv4(), @@ -758,10 +759,11 @@ logger.info('!-- Starting OnStar2MQTT Polling --!'); logger.info(`refreshIntervalTopic: ${refreshIntervalTopic}`); logger.info(`refreshIntervalCurrentValTopic: ${refreshIntervalCurrentValTopic}`); - if (!buttonConfigsPublished) { + if (!refreshIntervalConfigPublished) { const pollingRefreshIntervalPayload = mqttHA.createPollingRefreshIntervalSensorConfigPayload(refreshIntervalCurrentValTopic, mqttConfig.listAllSensorsTogether); logger.debug("pollingRefreshIntervalSensorConfigPayload:", pollingRefreshIntervalPayload); - client.publish(pollingRefreshIntervalPayload.topic, pollingRefreshIntervalPayload.payload, { retain: true }); + client.publish(pollingRefreshIntervalPayload.topic, JSON.stringify(pollingRefreshIntervalPayload.payload), { retain: true }); + refreshIntervalConfigPublished = 'true'; logger.info(`Polling Refresh Interval Sensor Published!`); }