Merge pull request #291 from iranl/update-sound-level-opener-ha
Make Opener Sound Level a configurable number in HA
This commit is contained in:
20
Network.cpp
20
Network.cpp
@@ -1100,7 +1100,7 @@ void Network::publishHASSConfigLedBrightness(char *deviceType, const char *baseT
|
||||
|
||||
void Network::publishHASSConfigSoundLevel(char *deviceType, const char *baseTopic, char *name, char *uidString)
|
||||
{
|
||||
publishHassTopic("sensor",
|
||||
publishHassTopic("number",
|
||||
"sound_level",
|
||||
uidString,
|
||||
"_sound_level",
|
||||
@@ -1111,11 +1111,13 @@ void Network::publishHASSConfigSoundLevel(char *deviceType, const char *baseTopi
|
||||
deviceType,
|
||||
"",
|
||||
"",
|
||||
"diagnostic",
|
||||
"config",
|
||||
mqtt_topic_config_sound_level,
|
||||
{ { "ic", "mdi:volume-source" },
|
||||
{ "min", "0" },
|
||||
{ "max", "255" }});
|
||||
{ "max", "255" },
|
||||
{ "mode", "slider" },
|
||||
{ "step", "25.5" }});
|
||||
}
|
||||
|
||||
|
||||
@@ -1366,6 +1368,18 @@ void Network::removeHASSConfig(char* uidString)
|
||||
path.concat("/battery_level/config");
|
||||
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, "");
|
||||
|
||||
path = discoveryTopic;
|
||||
path.concat("/sensor/");
|
||||
path.concat(uidString);
|
||||
path.concat("/sound_level/config");
|
||||
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, "");
|
||||
|
||||
path = discoveryTopic;
|
||||
path.concat("/number/");
|
||||
path.concat(uidString);
|
||||
path.concat("/sound_level/config");
|
||||
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, "");
|
||||
|
||||
path = discoveryTopic;
|
||||
path.concat("/binary_sensor/");
|
||||
path.concat(uidString);
|
||||
|
||||
Reference in New Issue
Block a user