include payload_open when a lock supports OPEN (#5809)

This commit is contained in:
Cody Cutrer 2023-11-20 16:59:38 -07:00 committed by GitHub
parent 5744490f2f
commit d5d97c4558
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,6 +40,8 @@ const EntityBase *MQTTLockComponent::get_entity() const { return this->lock_; }
void MQTTLockComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { void MQTTLockComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {
if (this->lock_->traits.get_assumed_state()) if (this->lock_->traits.get_assumed_state())
root[MQTT_OPTIMISTIC] = true; root[MQTT_OPTIMISTIC] = true;
if (this->lock_->traits.get_supports_open())
root[MQTT_PAYLOAD_OPEN] = "OPEN";
} }
bool MQTTLockComponent::send_initial_state() { return this->publish_state(); } bool MQTTLockComponent::send_initial_state() { return this->publish_state(); }