Skip to content

Commit

Permalink
feature: JK BMS: HA auto-discovery for battery temperatures
Browse files Browse the repository at this point in the history
  • Loading branch information
ButterBetzi authored and schlimmchen committed May 30, 2024
1 parent 19c8866 commit 27f264e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MqttHandleBatteryHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void MqttHandleBatteryHassClass::loop()
publishSensor("Current", "mdi:current-dc", "BatteryCurrentMilliAmps", "current", "measurement", "mA");
publishSensor("BMS Temperature", "mdi:thermometer", "BmsTempCelsius", "temperature", "measurement", "°C");
publishSensor("Cell Voltage Diff", "mdi:battery-alert", "CellDiffMilliVolt", "voltage", "measurement", "mV");
publishSensor("Battery Temperature 1", "mdi:thermometer", "BatteryTempOneCelsius", "temperature", "measurement", "°C");
publishSensor("Battery Temperature 2", "mdi:thermometer", "BatteryTempTwoCelsius", "temperature", "measurement", "°C");
publishSensor("Charge Cycles", "mdi:counter", "BatteryCycles");
publishSensor("Cycle Capacity", "mdi:battery-sync", "BatteryCycleCapacity");

Expand Down Expand Up @@ -202,7 +204,7 @@ void MqttHandleBatteryHassClass::publishBinarySensor(const char* caption, const
statTopic.concat(subTopic);

JsonDocument root;

root["name"] = caption;
root["uniq_id"] = serial + "_" + sensorId;
root["stat_t"] = statTopic;
Expand Down

0 comments on commit 27f264e

Please sign in to comment.