move temp sensors under dedicated device
This commit is contained in:
parent
5ea1d96ba4
commit
42d3b5dc4c
16
include/ha.h
16
include/ha.h
@ -31,14 +31,18 @@ namespace Ha {
|
||||
jsonDoc["unique_id"] = uniqueId;
|
||||
}
|
||||
|
||||
void buildDeviceConfig(JsonDocument& jsonDoc) {
|
||||
virtual void buildDeviceConfig(JsonDocument& jsonDoc) {
|
||||
JsonObject device = jsonDoc.createNestedObject("device");
|
||||
device["name"] = "ESP Clock";
|
||||
device["model"] = "Esp8266 D1 Mini";
|
||||
device["manufacturer"] = "Espressif";
|
||||
device["suggested_area"] = "Living room";
|
||||
JsonArray connections = device.createNestedArray("connections");
|
||||
JsonArray mac = connections.createNestedArray();
|
||||
mac.add("mac");
|
||||
mac.add(WiFi.macAddress());
|
||||
JsonArray identifiers = device.createNestedArray("identifiers");
|
||||
identifiers.add("esp-clock");
|
||||
}
|
||||
};
|
||||
|
||||
@ -126,6 +130,16 @@ namespace Ha {
|
||||
jsonDoc["state_topic"] = stateTopic;
|
||||
}
|
||||
|
||||
void buildDeviceConfig(JsonDocument& jsonDoc) override {
|
||||
JsonObject device = jsonDoc.createNestedObject("device");
|
||||
device["name"] = "Living room";
|
||||
device["model"] = "BPM280";
|
||||
device["suggested_area"] = "Living room";
|
||||
device["via_device"] = "esp-clock";
|
||||
JsonArray identifiers = device.createNestedArray("identifiers");
|
||||
identifiers.add("esp-clock-living-room");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct TemperatureSensor : Sensor {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user