try bool values instead of string for binary_sensor
This commit is contained in:
parent
c1efc71f54
commit
56e077d2e5
@ -149,8 +149,8 @@ class MQTT {
|
|||||||
availability_topic: this.getAvailabilityTopic(),
|
availability_topic: this.getAvailabilityTopic(),
|
||||||
payload_available: 'true',
|
payload_available: 'true',
|
||||||
payload_not_available: 'false',
|
payload_not_available: 'false',
|
||||||
payload_on: 'true',
|
payload_on: true,
|
||||||
payload_off: 'false',
|
payload_off: false,
|
||||||
state_topic: this.getStateTopic(diag),
|
state_topic: this.getStateTopic(diag),
|
||||||
unit_of_measurement: diagEl.unit,
|
unit_of_measurement: diagEl.unit,
|
||||||
value_template: `{{ value_json.${MQTT.convertName(diagEl.name)} }}`,
|
value_template: `{{ value_json.${MQTT.convertName(diagEl.name)} }}`,
|
||||||
|
@ -37,7 +37,7 @@ describe('MQTT', () => {
|
|||||||
assert.strictEqual(mqtt.getConfigTopic(d), 'homeassistant/sensor/XXX/ambient_air_temperature/config');
|
assert.strictEqual(mqtt.getConfigTopic(d), 'homeassistant/sensor/XXX/ambient_air_temperature/config');
|
||||||
});
|
});
|
||||||
it('should generate state topics', () => {
|
it('should generate state topics', () => {
|
||||||
assert.strictEqual(mqtt.getStateTopic(d, d.diagnosticElements[0]), 'homeassistant/sensor/XXX/ambient_air_temperature/state');
|
assert.strictEqual(mqtt.getStateTopic(d), 'homeassistant/sensor/XXX/ambient_air_temperature/state');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ describe('MQTT', () => {
|
|||||||
name: 'Ambient Air Temperature',
|
name: 'Ambient Air Temperature',
|
||||||
payload_available: 'true',
|
payload_available: 'true',
|
||||||
payload_not_available: 'false',
|
payload_not_available: 'false',
|
||||||
payload_off: 'false',
|
payload_off: false,
|
||||||
payload_on: 'true',
|
payload_on: true,
|
||||||
state_topic: 'homeassistant/sensor/XXX/ambient_air_temperature/state',
|
state_topic: 'homeassistant/sensor/XXX/ambient_air_temperature/state',
|
||||||
unit_of_measurement: '°C',
|
unit_of_measurement: '°C',
|
||||||
value_template: '{{ value_json.ambient_air_temperature }}'
|
value_template: '{{ value_json.ambient_air_temperature }}'
|
||||||
@ -104,8 +104,8 @@ describe('MQTT', () => {
|
|||||||
name: 'Priority Charge Indicator',
|
name: 'Priority Charge Indicator',
|
||||||
payload_available: 'true',
|
payload_available: 'true',
|
||||||
payload_not_available: 'false',
|
payload_not_available: 'false',
|
||||||
payload_off: 'false',
|
payload_off: false,
|
||||||
payload_on: 'true',
|
payload_on: true,
|
||||||
state_topic: 'homeassistant/binary_sensor/XXX/ev_charge_state/state',
|
state_topic: 'homeassistant/binary_sensor/XXX/ev_charge_state/state',
|
||||||
unit_of_measurement: undefined,
|
unit_of_measurement: undefined,
|
||||||
value_template: '{{ value_json.priority_charge_indicator }}'
|
value_template: '{{ value_json.priority_charge_indicator }}'
|
||||||
@ -138,8 +138,8 @@ describe('MQTT', () => {
|
|||||||
name: 'Tire Pressure: Left Front',
|
name: 'Tire Pressure: Left Front',
|
||||||
payload_available: 'true',
|
payload_available: 'true',
|
||||||
payload_not_available: 'false',
|
payload_not_available: 'false',
|
||||||
payload_off: 'false',
|
payload_off: false,
|
||||||
payload_on: 'true',
|
payload_on: true,
|
||||||
state_topic: 'homeassistant/sensor/XXX/tire_pressure/state',
|
state_topic: 'homeassistant/sensor/XXX/tire_pressure/state',
|
||||||
unit_of_measurement: 'kPa',
|
unit_of_measurement: 'kPa',
|
||||||
value_template: '{{ value_json.tire_pressure_lf }}'
|
value_template: '{{ value_json.tire_pressure_lf }}'
|
||||||
|
Loading…
Reference in New Issue
Block a user