test data with more - to _ replacements for sensor IDs

This commit is contained in:
proddy
2024-07-04 21:55:35 +02:00
parent cdac298d38
commit 6feae50ecd
2 changed files with 4 additions and 4 deletions

View File

@@ -625,7 +625,7 @@ bool TemperatureSensor::Sensor::apply_customization() {
#if defined(EMSESP_TEST)
void TemperatureSensor::test() {
// add 2 temperature sensors
// Sensor ID: 01-0203-0405-0607
// Sensor ID: 01_0203_0405_0607
uint8_t addr[ADDR_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
sensors_.emplace_back(addr);
sensors_.back().apply_customization();

View File

@@ -103,7 +103,7 @@ StateUpdateResult WebCustomization::update(JsonObject root, WebCustomization & c
sensor.name = ""; // no need to store id as name
}
std::replace(sensor.id.begin(), sensor.id.end(), '-', '_'); // change old ids to v3.7 style
customizations.sensorCustomizations.push_back(sensor); // add to list
customizations.sensorCustomizations.push_back(sensor); // add to list
}
}
@@ -377,13 +377,13 @@ void WebCustomizationService::test() {
// Temperature sensors
webCustomization.sensorCustomizations.clear();
auto sensor = SensorCustomization();
sensor.id = "01-0203-0405-0607";
sensor.id = "01_0203_0405_0607";
sensor.name = "test_sensor1";
sensor.offset = 0;
webCustomization.sensorCustomizations.push_back(sensor);
auto sensor2 = SensorCustomization();
sensor2.id = "0B-0C0D-0E0F-1011";
sensor2.id = "0B_0C0D_0E0F_1011";
sensor2.name = "test_sensor2";
sensor2.offset = 4;
webCustomization.sensorCustomizations.push_back(sensor2);