Return attribute dict directly without temporary variable v2 (#41271)
This commit is contained in:
parent
33e69fe4bf
commit
513f03eb1f
27 changed files with 90 additions and 124 deletions
|
@ -36,12 +36,13 @@ class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
|
|||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
attr = {}
|
||||
if self._device.has_alerts:
|
||||
attr["info"] = self._device.pending_info_alerts_count
|
||||
attr["warning"] = self._device.pending_warning_alerts_count
|
||||
attr["critical"] = self._device.pending_critical_alerts_count
|
||||
return attr
|
||||
return {
|
||||
"info": self._device.pending_info_alerts_count,
|
||||
"warning": self._device.pending_warning_alerts_count,
|
||||
"critical": self._device.pending_critical_alerts_count,
|
||||
}
|
||||
return {}
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue