mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix Shelly Plus HT missing battery entity (#81564)
This commit is contained in:
parent
ca905a8c05
commit
59ec52a079
@ -47,12 +47,7 @@ from .entity import (
|
|||||||
async_setup_entry_rest,
|
async_setup_entry_rest,
|
||||||
async_setup_entry_rpc,
|
async_setup_entry_rpc,
|
||||||
)
|
)
|
||||||
from .utils import (
|
from .utils import get_device_entry_gen, get_device_uptime, temperature_unit
|
||||||
get_device_entry_gen,
|
|
||||||
get_device_uptime,
|
|
||||||
is_rpc_device_externally_powered,
|
|
||||||
temperature_unit,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -407,7 +402,6 @@ RPC_SENSORS: Final = {
|
|||||||
value=lambda status, _: status["percent"],
|
value=lambda status, _: status["percent"],
|
||||||
device_class=SensorDeviceClass.BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
removal_condition=is_rpc_device_externally_powered,
|
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
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")
|
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]]:
|
def get_rpc_input_triggers(device: RpcDevice) -> list[tuple[str, str]]:
|
||||||
"""Return list of input triggers for RPC device."""
|
"""Return list of input triggers for RPC device."""
|
||||||
triggers = []
|
triggers = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user