Skip to content

Commit acbb278

Browse files
authored
Merge branch 'main' into fix-reduce-test-effort
2 parents ced8135 + 8f144c4 commit acbb278

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

custom_components/bms_ble/coordinator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async def _async_update_data(self) -> BMSSample:
143143
raise UpdateFailed(
144144
translation_domain=DOMAIN,
145145
translation_key="bms_com_fail_rssi"
146-
if not rssi or rssi < LOW_RSSI
146+
if rssi is not None and rssi < LOW_RSSI
147147
else "bms_com_fail",
148148
translation_placeholders={
149149
"rssi": f"{rssi}" if rssi is not None else "--",

custom_components/bms_ble/sensor.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
ATTR_POWER,
4444
ATTR_RSSI,
4545
ATTR_RUNTIME,
46+
ATTR_TEMP_SENSORS,
4647
DOMAIN,
4748
LOGGER,
4849
)
@@ -98,13 +99,11 @@ def _attr_pack(
9899
),
99100
BmsEntityDescription(
100101
attr_fn=lambda data: (
101-
{"temperature_sensors": data.get("temp_values", [])}
102+
{ATTR_TEMP_SENSORS: data.get("temp_values", [])}
102103
if "temp_values" in data
103-
else (
104-
{"temperature_sensors": [data.get("temperature", 0.0)]}
105-
if "temperature" in data
106-
else {}
107-
)
104+
else {ATTR_TEMP_SENSORS: [data.get("temperature", 0.0)]}
105+
if "temperature" in data
106+
else {}
108107
),
109108
device_class=SensorDeviceClass.TEMPERATURE,
110109
key=ATTR_TEMPERATURE,
@@ -219,7 +218,7 @@ def _attr_pack(
219218
key=ATTR_RSSI,
220219
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
221220
state_class=SensorStateClass.MEASUREMENT,
222-
value_fn=lambda data: None, # RSSI is handled in a separate class
221+
value_fn=lambda data: None,
223222
),
224223
BmsEntityDescription(
225224
entity_category=EntityCategory.DIAGNOSTIC,
@@ -228,7 +227,7 @@ def _attr_pack(
228227
native_unit_of_measurement=PERCENTAGE,
229228
state_class=SensorStateClass.MEASUREMENT,
230229
translation_key=ATTR_LQ,
231-
value_fn=lambda data: None, # LQ is handled in a separate class
230+
value_fn=lambda data: None,
232231
),
233232
]
234233

custom_components/bms_ble/strings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"no_devices_found": "No supported devices found via Bluetooth.",
66
"not_supported": "Device is not supported."
77
},
8-
"flow_title": "Setup {name} ({id}) as {model}",
8+
"flow_title": "Set up {name} ({id}) as {model}",
99
"step": {
1010
"bluetooth_confirm": {
1111
"description": "Do you want to set up {name} ({id})?"

0 commit comments

Comments
 (0)