diff --git a/src/index.js b/src/index.js index 6126fed0..206812c6 100644 --- a/src/index.js +++ b/src/index.js @@ -612,7 +612,7 @@ logger.info('!-- Starting OnStar2MQTT Polling --!'); const sensorMessagePayload = mqttHA.createSensorMessageConfigPayload(sensor.name, sensor.component, sensor.icon); logger.debug('Sensor Message Payload:', sensorMessagePayload); client.publish(sensorMessagePayload.topic, JSON.stringify(sensorMessagePayload.payload), { retain: true }); - } + } logger.info(`Sensor Message Configs Published!`); buttonConfigsPublished = 'true'; } diff --git a/test/mqtt.spec.js b/test/mqtt.spec.js index 522ed1be..f7f5b427 100644 --- a/test/mqtt.spec.js +++ b/test/mqtt.spec.js @@ -1406,36 +1406,36 @@ describe('MQTT', () => { assert.deepStrictEqual(result, expected); }); - it('should create sensor message config payload when component is provided', () => { - const sensor = 'oil_life'; - const component = undefined; - const icon = 'testIcon'; - const expected = { - topic: 'testPrefix/sensor/testInstance/oil_life_message/config', - payload: { - device: { - identifiers: ['1234'], - manufacturer: 'TestMake', - model: '2022 TestModel', - name: 'TestVehicle', - suggested_area: 'TestVehicle', - }, - availability: { - topic: mqtt.getAvailabilityTopic(), - payload_available: 'true', - payload_not_available: 'false', - }, - unique_id: '1234_oil_life', - name: 'Oil Life Message', - state_topic: 'testPrefix/sensor/testInstance/oil_life/state', - value_template: '{{ value_json.oil_life_message }}', - icon: 'testIcon', - } - }; - const result = mqtt.createSensorMessageConfigPayload(sensor, component, icon); - assert.deepStrictEqual(result, expected); + it('should create sensor message config payload when component is provided', () => { + const sensor = 'oil_life'; + const component = undefined; + const icon = 'testIcon'; + const expected = { + topic: 'testPrefix/sensor/testInstance/oil_life_message/config', + payload: { + device: { + identifiers: ['1234'], + manufacturer: 'TestMake', + model: '2022 TestModel', + name: 'TestVehicle', + suggested_area: 'TestVehicle', + }, + availability: { + topic: mqtt.getAvailabilityTopic(), + payload_available: 'true', + payload_not_available: 'false', + }, + unique_id: '1234_oil_life', + name: 'Oil Life Message', + state_topic: 'testPrefix/sensor/testInstance/oil_life/state', + value_template: '{{ value_json.oil_life_message }}', + icon: 'testIcon', + } + }; + const result = mqtt.createSensorMessageConfigPayload(sensor, component, icon); + assert.deepStrictEqual(result, expected); + }); }); - }); }); });