mirror of
https://github.com/home-assistant/core.git
synced 2025-12-25 05:26:47 +00:00
Powerwall sensor add is_active, round state attributes and change thresholding for charging status sensor (#34582)
* Change sensor values and thresholding * Update tests
This commit is contained in:
@@ -36,12 +36,13 @@ async def test_sensors(hass):
|
||||
assert state.state == "0.032"
|
||||
expected_attributes = {
|
||||
"frequency": 60,
|
||||
"energy_exported": 10429451.9916853,
|
||||
"energy_imported": 4824191.60668611,
|
||||
"instant_average_voltage": 120.650001525879,
|
||||
"energy_exported_(in_kW)": 10429.5,
|
||||
"energy_imported_(in_kW)": 4824.2,
|
||||
"instant_average_voltage": 120.7,
|
||||
"unit_of_measurement": "kW",
|
||||
"friendly_name": "Powerwall Site Now",
|
||||
"device_class": "power",
|
||||
"is_active": False,
|
||||
}
|
||||
# Only test for a subset of attributes in case
|
||||
# HA changes the implementation and a new one appears
|
||||
@@ -52,12 +53,13 @@ async def test_sensors(hass):
|
||||
assert state.state == "1.971"
|
||||
expected_attributes = {
|
||||
"frequency": 60,
|
||||
"energy_exported": 1056797.48917483,
|
||||
"energy_imported": 4692987.91889705,
|
||||
"instant_average_voltage": 120.650001525879,
|
||||
"energy_exported_(in_kW)": 1056.8,
|
||||
"energy_imported_(in_kW)": 4693.0,
|
||||
"instant_average_voltage": 120.7,
|
||||
"unit_of_measurement": "kW",
|
||||
"friendly_name": "Powerwall Load Now",
|
||||
"device_class": "power",
|
||||
"is_active": True,
|
||||
}
|
||||
# Only test for a subset of attributes in case
|
||||
# HA changes the implementation and a new one appears
|
||||
@@ -67,13 +69,14 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.powerwall_battery_now")
|
||||
assert state.state == "-8.55"
|
||||
expected_attributes = {
|
||||
"frequency": 60.014,
|
||||
"energy_exported": 3620010,
|
||||
"energy_imported": 4216170,
|
||||
"instant_average_voltage": 240.56,
|
||||
"frequency": 60.0,
|
||||
"energy_exported_(in_kW)": 3620.0,
|
||||
"energy_imported_(in_kW)": 4216.2,
|
||||
"instant_average_voltage": 240.6,
|
||||
"unit_of_measurement": "kW",
|
||||
"friendly_name": "Powerwall Battery Now",
|
||||
"device_class": "power",
|
||||
"is_active": True,
|
||||
}
|
||||
# Only test for a subset of attributes in case
|
||||
# HA changes the implementation and a new one appears
|
||||
@@ -84,12 +87,13 @@ async def test_sensors(hass):
|
||||
assert state.state == "10.49"
|
||||
expected_attributes = {
|
||||
"frequency": 60,
|
||||
"energy_exported": 9864205.82222448,
|
||||
"energy_imported": 28177.5358355867,
|
||||
"instant_average_voltage": 120.685001373291,
|
||||
"energy_exported_(in_kW)": 9864.2,
|
||||
"energy_imported_(in_kW)": 28.2,
|
||||
"instant_average_voltage": 120.7,
|
||||
"unit_of_measurement": "kW",
|
||||
"friendly_name": "Powerwall Solar Now",
|
||||
"device_class": "power",
|
||||
"is_active": True,
|
||||
}
|
||||
# Only test for a subset of attributes in case
|
||||
# HA changes the implementation and a new one appears
|
||||
|
||||
Reference in New Issue
Block a user