mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Add device class support to MQTT cover (#2092)
This commit is contained in:
parent
16dbbfabc6
commit
de382b704c
1 changed files with 3 additions and 0 deletions
|
@ -61,6 +61,9 @@ void MQTTCoverComponent::dump_config() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MQTTCoverComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryConfig &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();
|
auto traits = this->cover_->get_traits();
|
||||||
if (traits.get_is_assumed_state()) {
|
if (traits.get_is_assumed_state()) {
|
||||||
root["optimistic"] = true;
|
root["optimistic"] = true;
|
||||||
|
|
Loading…
Reference in a new issue