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
|
@ -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."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue