File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
custom_components/battery_notes Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,13 @@ async def async_setup(self) -> bool:
9797 device_class = entity .device_class or entity .original_device_class
9898 if device_class == SensorDeviceClass .BATTERY and entity .unit_of_measurement == PERCENTAGE :
9999 self .wrapped_battery = entity
100+ else :
101+ _LOGGER .debug (
102+ "%s is not a battery entity device_class: %s unit_of_measurement: %s" ,
103+ source_entity_id ,
104+ device_class ,
105+ entity .unit_of_measurement ,
106+ )
100107
101108 if entity .device_id :
102109 device_entry = device_registry .async_get (entity .device_id )
@@ -128,6 +135,7 @@ async def async_setup(self) -> bool:
128135 continue
129136
130137 self .wrapped_battery = entity_registry .async_get (entity .entity_id )
138+ break
131139
132140 device_entry = device_registry .async_get (device_id )
133141 if device_entry :
Original file line number Diff line number Diff line change @@ -298,6 +298,12 @@ def __init__(
298298 self ._attr_translation_placeholders = {"device_name" : "" }
299299 self .entity_id = f"sensor.{ coordinator .device_name .lower ()} _{ description .key } "
300300
301+ _LOGGER .debug (
302+ "Setting up %s with wrapped battery %s" ,
303+ self .entity_id ,
304+ self .coordinator .wrapped_battery .entity_id
305+ )
306+
301307 self .entity_description = description
302308 self ._attr_unique_id = unique_id
303309 self .device = device
You can’t perform that action at this time.
0 commit comments