mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Replace slave by meter in v2c (#118893)
This commit is contained in:
parent
e2dd88be6e
commit
0562c3085f
@ -16,7 +16,7 @@
|
|||||||
"fv_power": {
|
"fv_power": {
|
||||||
"default": "mdi:solar-power-variant"
|
"default": "mdi:solar-power-variant"
|
||||||
},
|
},
|
||||||
"slave_error": {
|
"meter_error": {
|
||||||
"default": "mdi:alert"
|
"default": "mdi:alert"
|
||||||
},
|
},
|
||||||
"battery_power": {
|
"battery_power": {
|
||||||
|
@ -35,7 +35,12 @@ class V2CSensorEntityDescription(SensorEntityDescription):
|
|||||||
value_fn: Callable[[TrydanData], StateType]
|
value_fn: Callable[[TrydanData], StateType]
|
||||||
|
|
||||||
|
|
||||||
_METER_ERROR_OPTIONS = [error.name.lower() for error in SlaveCommunicationState]
|
def get_meter_value(value: SlaveCommunicationState) -> str:
|
||||||
|
"""Return the value of the enum and replace slave by meter."""
|
||||||
|
return value.name.lower().replace("slave", "meter")
|
||||||
|
|
||||||
|
|
||||||
|
_METER_ERROR_OPTIONS = [get_meter_value(error) for error in SlaveCommunicationState]
|
||||||
|
|
||||||
TRYDAN_SENSORS = (
|
TRYDAN_SENSORS = (
|
||||||
V2CSensorEntityDescription(
|
V2CSensorEntityDescription(
|
||||||
@ -82,7 +87,7 @@ TRYDAN_SENSORS = (
|
|||||||
V2CSensorEntityDescription(
|
V2CSensorEntityDescription(
|
||||||
key="meter_error",
|
key="meter_error",
|
||||||
translation_key="meter_error",
|
translation_key="meter_error",
|
||||||
value_fn=lambda evse_data: evse_data.slave_error.name.lower(),
|
value_fn=lambda evse_data: get_meter_value(evse_data.slave_error),
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
options=_METER_ERROR_OPTIONS,
|
options=_METER_ERROR_OPTIONS,
|
||||||
|
@ -60,12 +60,12 @@
|
|||||||
"no_error": "No error",
|
"no_error": "No error",
|
||||||
"communication": "Communication",
|
"communication": "Communication",
|
||||||
"reading": "Reading",
|
"reading": "Reading",
|
||||||
"slave": "Meter",
|
"meter": "Meter",
|
||||||
"waiting_wifi": "Waiting for Wi-Fi",
|
"waiting_wifi": "Waiting for Wi-Fi",
|
||||||
"waiting_communication": "Waiting communication",
|
"waiting_communication": "Waiting communication",
|
||||||
"wrong_ip": "Wrong IP",
|
"wrong_ip": "Wrong IP",
|
||||||
"slave_not_found": "Meter not found",
|
"meter_not_found": "Meter not found",
|
||||||
"wrong_slave": "Wrong Meter",
|
"wrong_meter": "Wrong meter",
|
||||||
"no_response": "No response",
|
"no_response": "No response",
|
||||||
"clamp_not_connected": "Clamp not connected",
|
"clamp_not_connected": "Clamp not connected",
|
||||||
"illegal_function": "Illegal function",
|
"illegal_function": "Illegal function",
|
||||||
|
@ -265,12 +265,12 @@
|
|||||||
'no_error',
|
'no_error',
|
||||||
'communication',
|
'communication',
|
||||||
'reading',
|
'reading',
|
||||||
'slave',
|
'meter',
|
||||||
'waiting_wifi',
|
'waiting_wifi',
|
||||||
'waiting_communication',
|
'waiting_communication',
|
||||||
'wrong_ip',
|
'wrong_ip',
|
||||||
'slave_not_found',
|
'meter_not_found',
|
||||||
'wrong_slave',
|
'wrong_meter',
|
||||||
'no_response',
|
'no_response',
|
||||||
'clamp_not_connected',
|
'clamp_not_connected',
|
||||||
'illegal_function',
|
'illegal_function',
|
||||||
@ -335,12 +335,12 @@
|
|||||||
'no_error',
|
'no_error',
|
||||||
'communication',
|
'communication',
|
||||||
'reading',
|
'reading',
|
||||||
'slave',
|
'meter',
|
||||||
'waiting_wifi',
|
'waiting_wifi',
|
||||||
'waiting_communication',
|
'waiting_communication',
|
||||||
'wrong_ip',
|
'wrong_ip',
|
||||||
'slave_not_found',
|
'meter_not_found',
|
||||||
'wrong_slave',
|
'wrong_meter',
|
||||||
'no_response',
|
'no_response',
|
||||||
'clamp_not_connected',
|
'clamp_not_connected',
|
||||||
'illegal_function',
|
'illegal_function',
|
||||||
|
@ -33,12 +33,12 @@ async def test_sensor(
|
|||||||
"no_error",
|
"no_error",
|
||||||
"communication",
|
"communication",
|
||||||
"reading",
|
"reading",
|
||||||
"slave",
|
"meter",
|
||||||
"waiting_wifi",
|
"waiting_wifi",
|
||||||
"waiting_communication",
|
"waiting_communication",
|
||||||
"wrong_ip",
|
"wrong_ip",
|
||||||
"slave_not_found",
|
"meter_not_found",
|
||||||
"wrong_slave",
|
"wrong_meter",
|
||||||
"no_response",
|
"no_response",
|
||||||
"clamp_not_connected",
|
"clamp_not_connected",
|
||||||
"illegal_function",
|
"illegal_function",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user