Use shorthand attr for mqtt assumed_state (#100241)
This commit is contained in:
parent
eb0ab3de93
commit
e3837cd1e0
13 changed files with 26 additions and 78 deletions
|
@ -159,6 +159,7 @@ class MqttLock(MqttEntity, LockEntity):
|
|||
self._optimistic = (
|
||||
config[CONF_OPTIMISTIC] or self._config.get(CONF_STATE_TOPIC) is None
|
||||
)
|
||||
self._attr_assumed_state = bool(self._optimistic)
|
||||
|
||||
self._compiled_pattern = config.get(CONF_CODE_FORMAT)
|
||||
self._attr_code_format = (
|
||||
|
@ -221,11 +222,6 @@ class MqttLock(MqttEntity, LockEntity):
|
|||
"""(Re)Subscribe to topics."""
|
||||
await subscription.async_subscribe_topics(self.hass, self._sub_state)
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
"""Return true if we do optimistic updates."""
|
||||
return self._optimistic
|
||||
|
||||
async def async_lock(self, **kwargs: Any) -> None:
|
||||
"""Lock the device.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue