Skip to content

Commit 3699577

Browse files
authored
Fix entity callback registration when device lacks the property (#324)
Fixes the AC ports switch on River 2 Max (and likely other not migrated devices) being stuck as unavailable since 0.8.6. Fix is generic rather than tweaking the deprecated entry: _register_update_callback now bails out when the device doesn't expose prop_name, so any future description referencing a state or availability prop the device doesn't implement is silently ignored instead of bricking the entity.
1 parent eeca5d6 commit 3699577

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

custom_components/ef_ble/entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _register_update_callback(
4949
get_state: Callable[[Any], SkipWrite | Any] = lambda x: x,
5050
default_state: Any = None,
5151
):
52-
if prop_name is None:
52+
if prop_name is None or not hasattr(self._device, prop_name):
5353
return
5454

5555
if value := getattr(self._device, prop_name, None):

0 commit comments

Comments
 (0)