Skip to content

Commit

Permalink
Fix polling refresh interval sensor not publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
BigThunderSR committed Apr 1, 2024
1 parent 1ebd57d commit fc2640e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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!`);
}

Expand Down

0 comments on commit fc2640e

Please sign in to comment.