mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
fix mqtt auto
This commit is contained in:
parent
0993b52553
commit
8e38e8562f
1 changed files with 7 additions and 7 deletions
|
@ -60,7 +60,7 @@ static void publish_cell_voltages(void) {
|
|||
"\"object_id\": \"sensor_battery_voltage_cell%d\","
|
||||
"\"origin\": {"
|
||||
"\"name\": \"BatteryEmulator\","
|
||||
"\"sw\": \"5.1.0-mqtt\","
|
||||
"\"sw\": \"%s-mqtt\","
|
||||
"\"url\": \"https://github.com/dalathegreat/Battery-Emulator\""
|
||||
"},"
|
||||
"\"state_class\": \"measurement\","
|
||||
|
@ -70,7 +70,7 @@ static void publish_cell_voltages(void) {
|
|||
"\"unit_of_measurement\": \"V\","
|
||||
"\"value_template\": \"{{ value_json.cell_voltages[%d] }}\""
|
||||
"}",
|
||||
i + 1, i + 1, i + 1, i);
|
||||
i + 1, versionNumber, i + 1, i + 1, i);
|
||||
// End each discovery topic with cell number and '/config'
|
||||
String cell_topic = topic + String(i + 1) + "/config";
|
||||
mqtt_publish_retain(cell_topic.c_str());
|
||||
|
@ -134,18 +134,18 @@ static void publish_common_info(void) {
|
|||
"\"name\": \"%s\","
|
||||
"\"state_topic\": \"%s\","
|
||||
"\"unique_id\": \"battery-emulator_%s\","
|
||||
"\"object_id\": \"%s\","
|
||||
"\"object_id\": \"sensor_battery_%s\","
|
||||
"\"device\": {"
|
||||
"\"identifiers\": ["
|
||||
"\"battery-emulator\""
|
||||
"],"
|
||||
"\"manufacturer\": \"DalaTech\","
|
||||
"\"model\": \"BatteryEmulator\","
|
||||
"\"name\": \"BatteryEmulator\","
|
||||
"\"name\": \"BatteryEmulator\""
|
||||
"},"
|
||||
"\"origin\": {"
|
||||
"\"name\": \"BatteryEmulator\","
|
||||
"\"sw\": \"5.1.0-mqtt\","
|
||||
"\"sw\": \"%s-mqtt\","
|
||||
"\"url\": \"https://github.com/dalathegreat/Battery-Emulator\""
|
||||
"},"
|
||||
"\"value_template\": \"%s\","
|
||||
|
@ -154,7 +154,7 @@ static void publish_common_info(void) {
|
|||
"\"enabled_by_default\": true,"
|
||||
"\"state_class\": \"measurement\""
|
||||
"}",
|
||||
config.name, state_topic, config.object_id, config.object_id, config.value_template, config.unit, config.device_class);
|
||||
config.name, state_topic, config.object_id, config.object_id, versionNumber, config.value_template, config.unit, config.device_class);
|
||||
mqtt_publish_retain(config.topic);
|
||||
}
|
||||
} else {
|
||||
|
@ -167,7 +167,7 @@ static void publish_common_info(void) {
|
|||
" \"stat_batt_power\": %.3f,\n"
|
||||
" \"battery_current\": %.3f,\n"
|
||||
" \"cell_max_voltage\": %d,\n"
|
||||
" \"cell_min_voltage\": %d\n"
|
||||
" \"cell_min_voltage\": %d,\n"
|
||||
" \"battery_voltage\": %d\n"
|
||||
"}\n",
|
||||
((float)SOC) / 100.0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue