Button device class (#2835)

This commit is contained in:
Jesse Hills
2021-12-01 04:18:21 +13:00
committed by GitHub
parent 0f47ffd908
commit b32b918936
11 changed files with 64 additions and 4 deletions
+5
View File
@@ -30,6 +30,11 @@ void MQTTButtonComponent::dump_config() {
LOG_MQTT_COMPONENT(true, true);
}
void MQTTButtonComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryConfig &config) {
if (!this->button_->get_device_class().empty())
root[MQTT_DEVICE_CLASS] = this->button_->get_device_class();
}
std::string MQTTButtonComponent::component_type() const { return "button"; }
const EntityBase *MQTTButtonComponent::get_entity() const { return this->button_; }