Fix Shelly Plus HT missing battery entity (#81564)
parent
ca905a8c05
commit
59ec52a079
|
@ -47,12 +47,7 @@ from .entity import (
|
|||
async_setup_entry_rest,
|
||||
async_setup_entry_rpc,
|
||||
)
|
||||
from .utils import (
|
||||
get_device_entry_gen,
|
||||
get_device_uptime,
|
||||
is_rpc_device_externally_powered,
|
||||
temperature_unit,
|
||||
)
|
||||
from .utils import get_device_entry_gen, get_device_uptime, temperature_unit
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -407,7 +402,6 @@ RPC_SENSORS: Final = {
|
|||
value=lambda status, _: status["percent"],
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
removal_condition=is_rpc_device_externally_powered,
|
||||
entity_registry_enabled_default=True,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
|
|
|
@ -364,13 +364,6 @@ def is_rpc_channel_type_light(config: dict[str, Any], channel: int) -> bool:
|
|||
return con_types is not None and con_types[channel].lower().startswith("light")
|
||||
|
||||
|
||||
def is_rpc_device_externally_powered(
|
||||
config: dict[str, Any], status: dict[str, Any], key: str
|
||||
) -> bool:
|
||||
"""Return true if device has external power instead of battery."""
|
||||
return cast(bool, status[key]["external"]["present"])
|
||||
|
||||
|
||||
def get_rpc_input_triggers(device: RpcDevice) -> list[tuple[str, str]]:
|
||||
"""Return list of input triggers for RPC device."""
|
||||
triggers = []
|
||||
|
|
Loading…
Reference in New Issue