Browse Source

ha: fix build with current String implementation

mcspr-patch-1
Maxim Prokhorov 3 years ago
parent
commit
0b43af8ed9
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      code/espurna/homeassistant.cpp

+ 9
- 1
code/espurna/homeassistant.cpp View File

@ -215,8 +215,16 @@ void _haSendDiscovery() {
#if SENSOR_SUPPORT #if SENSOR_SUPPORT
String _haMagnitudeName(unsigned char index) {
auto name = getSetting("hostname", getIdentifier());
name += " ";
name += magnitudeTopic(magnitudeType(index));
return _haFixName(std::move(name));
}
void _haSendMagnitude(unsigned char index, JsonObject& config) { void _haSendMagnitude(unsigned char index, JsonObject& config) {
config["name"] = _haFixName(getSetting("hostname", getIdentifier()) + String(" ") + magnitudeTopic(magnitudeType(index)));
config["name"] = _haMagnitudeName(index);
config["state_topic"] = mqttTopic(magnitudeTopicIndex(index).c_str(), false); config["state_topic"] = mqttTopic(magnitudeTopicIndex(index).c_str(), false);
config["unit_of_measurement"] = magnitudeUnits(index); config["unit_of_measurement"] = magnitudeUnits(index);
} }


Loading…
Cancel
Save