Skip to content

Commit

Permalink
Merge pull request #291 from iranl/update-sound-level-opener-ha
Browse files Browse the repository at this point in the history
Make Opener Sound Level a configurable number in HA
  • Loading branch information
technyon authored Feb 7, 2024
2 parents ba0fa55 + f663196 commit cb705d3
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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" }});
}


Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cb705d3

Please sign in to comment.