@@ -114,12 +114,13 @@ class BaseEntity(LogMixin, EventBase):
114
114
115
115
PLATFORM : Platform = Platform .UNKNOWN
116
116
117
- _attr_fallback_name : str | None
118
- _attr_translation_key : str | None
119
- _attr_entity_category : EntityCategory | None
117
+ _attr_fallback_name : str | None = None
118
+ _attr_icon : str | None = None
119
+ _attr_translation_key : str | None = None
120
+ _attr_entity_category : EntityCategory | None = None
120
121
_attr_entity_registry_enabled_default : bool = True
121
- _attr_device_class : str | None
122
- _attr_state_class : str | None
122
+ _attr_device_class : str | None = None
123
+ _attr_state_class : str | None = None
123
124
_attr_enabled : bool = True
124
125
_attr_always_supported : bool = False
125
126
_attr_primary : bool = False
@@ -187,14 +188,12 @@ def primary_weight(self) -> int:
187
188
@property
188
189
def fallback_name (self ) -> str | None :
189
190
"""Return the entity fallback name for when a translation key is unavailable."""
190
- if hasattr (self , "_attr_fallback_name" ):
191
- return self ._attr_fallback_name
192
- return None
191
+ return self ._attr_fallback_name
193
192
194
193
@property
195
194
def icon (self ) -> str | None :
196
195
"""Return the entity icon."""
197
- return None
196
+ return self . _attr_icon
198
197
199
198
@property
200
199
def translation_key (self ) -> str | None :
@@ -218,16 +217,12 @@ def entity_registry_enabled_default(self) -> bool:
218
217
@property
219
218
def device_class (self ) -> str | None :
220
219
"""Return the device class."""
221
- if hasattr (self , "_attr_device_class" ):
222
- return self ._attr_device_class
223
- return None
220
+ return self ._attr_device_class
224
221
225
222
@property
226
223
def state_class (self ) -> str | None :
227
224
"""Return the state class."""
228
- if hasattr (self , "_attr_state_class" ):
229
- return self ._attr_state_class
230
- return None
225
+ return self ._attr_state_class
231
226
232
227
@final
233
228
@property
0 commit comments