Improves battery sensor display
Updates the outside battery sensor to display an icon reflecting the battery level, enhancing the user experience by providing a visual indication of the battery status.pull/72/head^2
parent
bbe31da4c5
commit
09d79e2032
|
|
@ -46,7 +46,7 @@ from .const import (
|
||||||
WEEKLY_RAIN,
|
WEEKLY_RAIN,
|
||||||
)
|
)
|
||||||
from .sensors_common import WeatherSensorEntityDescription
|
from .sensors_common import WeatherSensorEntityDescription
|
||||||
from .utils import battery_level_to_text, wind_dir_to_text
|
from .utils import battery_level_to_icon, battery_level_to_text, wind_dir_to_text
|
||||||
|
|
||||||
SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
|
|
@ -306,10 +306,9 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
||||||
),
|
),
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
key=OUTSIDE_BATTERY,
|
key=OUTSIDE_BATTERY,
|
||||||
name="Outside Battery",
|
|
||||||
icon="mdi:battery",
|
|
||||||
device_class=SensorDeviceClass.ENUM,
|
|
||||||
value_fn=lambda data: battery_level_to_text(int(data)) if data is not None and str(data).isdigit() else "unknown",
|
|
||||||
translation_key=OUTSIDE_BATTERY,
|
translation_key=OUTSIDE_BATTERY,
|
||||||
|
icon=lambda data: battery_level_to_icon(battery_level_to_text(int(data))),
|
||||||
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
value_fn=lambda data: battery_level_to_text(int(data)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue