mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Fix units for Shelly TopAC EVE01-11 sensors (#154740)
This commit is contained in:
@@ -1549,8 +1549,7 @@ RPC_SENSORS: Final = {
|
||||
"number_energy_charge": RpcSensorDescription(
|
||||
key="number",
|
||||
sub_key="value",
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
suggested_display_precision=2,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL,
|
||||
@@ -1594,8 +1593,7 @@ RPC_SENSORS: Final = {
|
||||
key="object",
|
||||
sub_key="value",
|
||||
value=lambda status, _: float(status["counter"]["total"]),
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
suggested_display_precision=2,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
@@ -1606,8 +1604,7 @@ RPC_SENSORS: Final = {
|
||||
sub_key="value",
|
||||
name="Energy",
|
||||
value=lambda status, _: float(status["total_act_energy"]),
|
||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
suggested_display_precision=2,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
@@ -1618,8 +1615,7 @@ RPC_SENSORS: Final = {
|
||||
sub_key="value",
|
||||
name="Power",
|
||||
value=lambda status, _: float(status["total_power"]),
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||
suggested_display_precision=2,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
||||
@@ -507,9 +507,6 @@
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
'sensor.private': dict({
|
||||
'suggested_unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
|
||||
'original_icon': None,
|
||||
|
||||
@@ -1723,7 +1723,7 @@ async def test_rpc_shelly_ev_sensors(
|
||||
}
|
||||
config["number:201"] = {
|
||||
"name": "Session energy",
|
||||
"meta": {"ui": {"unit": "Wh", "view": "label"}},
|
||||
"meta": {"ui": {"unit": "kWh", "view": "label"}},
|
||||
"role": "energy_charge",
|
||||
}
|
||||
config["number:202"] = {
|
||||
@@ -1735,7 +1735,7 @@ async def test_rpc_shelly_ev_sensors(
|
||||
|
||||
status = deepcopy(mock_rpc_device.status)
|
||||
status["number:200"] = {"value": "charger_charging"}
|
||||
status["number:201"] = {"value": 5000}
|
||||
status["number:201"] = {"value": 5.0}
|
||||
status["number:202"] = {"value": 60}
|
||||
monkeypatch.setattr(mock_rpc_device, "status", status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user