Use shorthand attr for mqtt assumed_state (#100241)

This commit is contained in:
Jan Bouwhuis 2023-09-12 22:21:13 +02:00 committed by GitHub
parent eb0ab3de93
commit e3837cd1e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 78 deletions

View file

@ -215,6 +215,7 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
}
optimistic: bool = config[CONF_OPTIMISTIC]
self._optimistic = optimistic or self._topic[CONF_STATE_TOPIC] is None
self._attr_assumed_state = bool(self._optimistic)
self._flash_times = {
key: config.get(key)
@ -462,11 +463,6 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
)
self._attr_xy_color = last_attributes.get(ATTR_XY_COLOR, self.xy_color)
@property
def assumed_state(self) -> bool:
"""Return true if we do optimistic updates."""
return self._optimistic
@property
def color_mode(self) -> ColorMode | str | None:
"""Return current color mode."""