Change the suggested energy units to kWh (#109184)

* Change the suggested energy units to kWh since the practical value is pretty large.

* Fix unit tests
This commit is contained in:
Josh Pettersen 2024-01-30 20:40:05 -08:00 committed by GitHub
parent b8c9da4705
commit 961a1c4d00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -128,6 +128,7 @@ WALL_CONNECTOR_SENSORS = [
WallConnectorSensorDescription(
key="energy_kWh",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_fn=lambda data: data[WALLCONNECTOR_DATA_LIFETIME].energy_wh,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,

View File

@ -24,7 +24,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
"sensor.tesla_wall_connector_grid_frequency", "50.021", "49.981"
),
EntityAndExpectedValues(
"sensor.tesla_wall_connector_energy", "988022", "989000"
"sensor.tesla_wall_connector_energy", "988.022", "989.000"
),
EntityAndExpectedValues(
"sensor.tesla_wall_connector_phase_a_current", "10", "7"