Add energy validation (#54567)

This commit is contained in:
Paulus Schoutsen
2021-08-18 11:21:51 -07:00
committed by GitHub
parent 6d0ce814e7
commit 2f77b5025c
6 changed files with 765 additions and 1 deletions

View File

@@ -216,3 +216,19 @@ async def test_handle_duplicate_from_stat(hass, hass_ws_client) -> None:
assert msg["id"] == 5
assert not msg["success"]
assert msg["error"]["code"] == "invalid_format"
async def test_validate(hass, hass_ws_client) -> None:
"""Test we can validate the preferences."""
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "energy/validate"})
msg = await client.receive_json()
assert msg["id"] == 5
assert msg["success"]
assert msg["result"] == {
"energy_sources": [],
"device_consumption": [],
}