Remove hardwired Powerview battery sensor (#81013)

pull/81021/head
kingy444 2022-10-26 23:24:17 +11:00 committed by GitHub
parent e53d74e3e8
commit 6d78f6841e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -19,8 +19,10 @@ from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import (
ATTR_BATTERY_KIND,
ATTR_SIGNAL_STRENGTH,
ATTR_SIGNAL_STRENGTH_MAX,
BATTERY_KIND_HARDWIRED,
DOMAIN,
ROOM_ID_IN_SHADE,
ROOM_NAME_UNICODE,
@ -60,7 +62,10 @@ SENSORS: Final = [
native_value_fn=lambda shade: round(
shade.raw_data[SHADE_BATTERY_LEVEL] / SHADE_BATTERY_LEVEL_MAX * 100
),
create_sensor_fn=lambda shade: bool(SHADE_BATTERY_LEVEL in shade.raw_data),
create_sensor_fn=lambda shade: bool(
shade.raw_data.get(ATTR_BATTERY_KIND) != BATTERY_KIND_HARDWIRED
and SHADE_BATTERY_LEVEL in shade.raw_data
),
update_fn=lambda shade: shade.refresh_battery(),
),
PowerviewSensorDescription(