From de382b704c76d89d72a73a3ad0d12cd60663a1eb Mon Sep 17 00:00:00 2001 From: Kodey Converse Date: Thu, 29 Jul 2021 10:08:48 -0400 Subject: [PATCH] Add device class support to MQTT cover (#2092) --- esphome/components/mqtt/mqtt_cover.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/mqtt/mqtt_cover.cpp b/esphome/components/mqtt/mqtt_cover.cpp index 25ac430abb..b11ae1fb93 100644 --- a/esphome/components/mqtt/mqtt_cover.cpp +++ b/esphome/components/mqtt/mqtt_cover.cpp @@ -61,6 +61,9 @@ void MQTTCoverComponent::dump_config() { } } void MQTTCoverComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryConfig &config) { + if (!this->cover_->get_device_class().empty()) + root["device_class"] = this->cover_->get_device_class(); + auto traits = this->cover_->get_traits(); if (traits.get_is_assumed_state()) { root["optimistic"] = true;