no need to have OilTank namespace since it has only one sensor

This commit is contained in:
Nicu Hodos 2025-06-07 11:13:44 +02:00
parent ff53fa9831
commit 7258ab9b56

View File

@ -15,7 +15,6 @@ unordered_map<string, Ha::Switch*> p1Switches;
auto gatewayDevice = &DeviceConfig::create(MAIN_DEVICE_ID).withName("RC Gateway").withManufacturer("Adafruit").withModel("Huzzah Esp8266"); auto gatewayDevice = &DeviceConfig::create(MAIN_DEVICE_ID).withName("RC Gateway").withManufacturer("Adafruit").withModel("Huzzah Esp8266");
namespace OilTank {
Sensor* buildRoomSensor(const char* id) { Sensor* buildRoomSensor(const char* id) {
DeviceConfig* device = &DeviceConfig::create(id) DeviceConfig* device = &DeviceConfig::create(id)
.withName("Servers room") .withName("Servers room")
@ -56,7 +55,6 @@ namespace OilTank {
.addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((value_json.sensor.diagnostic.voltage|float-4.8)|round(2)*100/1.6)|int }}"}) .addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((value_json.sensor.diagnostic.voltage|float-4.8)|round(2)*100/1.6)|int }}"})
.build(); .build();
} }
}
struct PollinSwitch : Switch { struct PollinSwitch : Switch {
constexpr static const char* man = "Pollin"; constexpr static const char* man = "Pollin";
@ -146,6 +144,6 @@ Command* commands[] = {
}; };
Sensor* sensors[] = { Sensor* sensors[] = {
OilTank::buildRoomSensor("4"), buildRoomSensor("4"),
OilTank::buildTankSensor("7") buildTankSensor("7")
}; };