Migrate Shelly to the new entity naming style (#86574)
* Use new entity naming style in Shelly * Suggested change * Use lower case for gen2 description
This commit is contained in:
parent
b76c0c6f08
commit
dae7bcf387
6 changed files with 16 additions and 16 deletions
|
@ -126,7 +126,7 @@ SENSORS: Final = {
|
|||
),
|
||||
("sensor", "extInput"): BlockBinarySensorDescription(
|
||||
key="sensor|extInput",
|
||||
name="External Input",
|
||||
name="External input",
|
||||
device_class=BinarySensorDeviceClass.POWER,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
|
|
|
@ -53,7 +53,7 @@ BUTTONS: Final[list[ShellyButtonDescription[Any]]] = [
|
|||
),
|
||||
ShellyButtonDescription[ShellyBlockCoordinator](
|
||||
key="self_test",
|
||||
name="Self Test",
|
||||
name="Self test",
|
||||
icon="mdi:progress-wrench",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
press_action=lambda coordinator: coordinator.device.trigger_shelly_gas_self_test(),
|
||||
|
|
|
@ -40,7 +40,7 @@ NUMBERS: Final = {
|
|||
("device", "valvePos"): BlockNumberDescription(
|
||||
key="device|valvepos",
|
||||
icon="mdi:pipe-valve",
|
||||
name="Valve Position",
|
||||
name="Valve position",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
available=lambda block: cast(int, block.valveError) != 1,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
|
|
|
@ -79,7 +79,7 @@ SENSORS: Final = {
|
|||
),
|
||||
("device", "deviceTemp"): BlockSensorDescription(
|
||||
key="device|deviceTemp",
|
||||
name="Device Temperature",
|
||||
name="Device temperature",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
value=lambda value: round(value, 1),
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
|
@ -139,7 +139,7 @@ SENSORS: Final = {
|
|||
),
|
||||
("emeter", "powerFactor"): BlockSensorDescription(
|
||||
key="emeter|powerFactor",
|
||||
name="Power Factor",
|
||||
name="Power factor",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
value=lambda value: round(value * 100, 1),
|
||||
device_class=SensorDeviceClass.POWER_FACTOR,
|
||||
|
@ -180,7 +180,7 @@ SENSORS: Final = {
|
|||
),
|
||||
("emeter", "energyReturned"): BlockSensorDescription(
|
||||
key="emeter|energyReturned",
|
||||
name="Energy Returned",
|
||||
name="Energy returned",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
value=lambda value: round(value / 1000, 2),
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
|
@ -214,7 +214,7 @@ SENSORS: Final = {
|
|||
),
|
||||
("sensor", "concentration"): BlockSensorDescription(
|
||||
key="sensor|concentration",
|
||||
name="Gas Concentration",
|
||||
name="Gas concentration",
|
||||
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
||||
icon="mdi:gauge",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -265,7 +265,7 @@ SENSORS: Final = {
|
|||
),
|
||||
("relay", "totalWorkTime"): BlockSensorDescription(
|
||||
key="relay|totalWorkTime",
|
||||
name="Lamp Life",
|
||||
name="Lamp life",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:progress-wrench",
|
||||
value=lambda value: round(100 - (value / 3600 / SHAIR_MAX_WORK_HOURS), 1),
|
||||
|
@ -467,7 +467,7 @@ RPC_SENSORS: Final = {
|
|||
"temperature": RpcSensorDescription(
|
||||
key="switch",
|
||||
sub_key="temperature",
|
||||
name="Device Temperature",
|
||||
name="Device temperature",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
value=lambda status, _: round(status["tC"], 1),
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
|
@ -538,7 +538,7 @@ RPC_SENSORS: Final = {
|
|||
"analoginput": RpcSensorDescription(
|
||||
key="input",
|
||||
sub_key="percent",
|
||||
name="Analog Input",
|
||||
name="Analog input",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
|
|
@ -73,7 +73,7 @@ class RestUpdateDescription(
|
|||
|
||||
REST_UPDATES: Final = {
|
||||
"fwupdate": RestUpdateDescription(
|
||||
name="Firmware Update",
|
||||
name="Firmware update",
|
||||
key="fwupdate",
|
||||
latest_version=lambda status: status["update"]["new_version"],
|
||||
beta=False,
|
||||
|
@ -82,7 +82,7 @@ REST_UPDATES: Final = {
|
|||
entity_registry_enabled_default=False,
|
||||
),
|
||||
"fwupdate_beta": RestUpdateDescription(
|
||||
name="Beta Firmware Update",
|
||||
name="Beta firmware update",
|
||||
key="fwupdate",
|
||||
latest_version=lambda status: status["update"].get("beta_version"),
|
||||
beta=True,
|
||||
|
@ -94,7 +94,7 @@ REST_UPDATES: Final = {
|
|||
|
||||
RPC_UPDATES: Final = {
|
||||
"fwupdate": RpcUpdateDescription(
|
||||
name="Firmware Update",
|
||||
name="Firmware update",
|
||||
key="sys",
|
||||
sub_key="available_updates",
|
||||
latest_version=lambda status: status.get("stable", {"version": ""})["version"],
|
||||
|
@ -104,7 +104,7 @@ RPC_UPDATES: Final = {
|
|||
entity_registry_enabled_default=False,
|
||||
),
|
||||
"fwupdate_beta": RpcUpdateDescription(
|
||||
name="Beta Firmware Update",
|
||||
name="Beta firmware update",
|
||||
key="sys",
|
||||
sub_key="available_updates",
|
||||
latest_version=lambda status: status.get("beta", {"version": ""})["version"],
|
||||
|
|
|
@ -98,7 +98,7 @@ def get_block_entity_name(
|
|||
channel_name = get_block_channel_name(device, block)
|
||||
|
||||
if description:
|
||||
return f"{channel_name} {description}"
|
||||
return f"{channel_name} {description.lower()}"
|
||||
|
||||
return channel_name
|
||||
|
||||
|
@ -326,7 +326,7 @@ def get_rpc_entity_name(
|
|||
channel_name = get_rpc_channel_name(device, key)
|
||||
|
||||
if description:
|
||||
return f"{channel_name} {description}"
|
||||
return f"{channel_name} {description.lower()}"
|
||||
|
||||
return channel_name
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue