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:
97
97
device_class = entity .device_class or entity .original_device_class
98
98
if device_class == SensorDeviceClass .BATTERY and entity .unit_of_measurement == PERCENTAGE :
99
99
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
+ )
100
107
101
108
if entity .device_id :
102
109
device_entry = device_registry .async_get (entity .device_id )
@@ -128,6 +135,7 @@ async def async_setup(self) -> bool:
128
135
continue
129
136
130
137
self .wrapped_battery = entity_registry .async_get (entity .entity_id )
138
+ break
131
139
132
140
device_entry = device_registry .async_get (device_id )
133
141
if device_entry :
Original file line number Diff line number Diff line change @@ -298,6 +298,12 @@ def __init__(
298
298
self ._attr_translation_placeholders = {"device_name" : "" }
299
299
self .entity_id = f"sensor.{ coordinator .device_name .lower ()} _{ description .key } "
300
300
301
+ _LOGGER .debug (
302
+ "Setting up %s with wrapped battery %s" ,
303
+ self .entity_id ,
304
+ self .coordinator .wrapped_battery .entity_id
305
+ )
306
+
301
307
self .entity_description = description
302
308
self ._attr_unique_id = unique_id
303
309
self .device = device
You can’t perform that action at this time.
0 commit comments