Implement time tracking in templates (#41147)

Co-authored-by: Anders Melchiorsen <amelchio@nogoto.net>
This commit is contained in:
J. Nick Koston 2020-10-19 04:02:43 -05:00 committed by GitHub
parent 8949eb2442
commit 31c21126a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 374 additions and 32 deletions

View file

@ -417,7 +417,12 @@ async def test_render_template_renders_template(hass, websocket_client):
event = msg["event"]
assert event == {
"result": "State is: on",
"listeners": {"all": False, "domains": [], "entities": ["light.test"]},
"listeners": {
"all": False,
"domains": [],
"entities": ["light.test"],
"time": False,
},
}
hass.states.async_set("light.test", "off")
@ -427,7 +432,12 @@ async def test_render_template_renders_template(hass, websocket_client):
event = msg["event"]
assert event == {
"result": "State is: off",
"listeners": {"all": False, "domains": [], "entities": ["light.test"]},
"listeners": {
"all": False,
"domains": [],
"entities": ["light.test"],
"time": False,
},
}
@ -456,7 +466,12 @@ async def test_render_template_manual_entity_ids_no_longer_needed(
event = msg["event"]
assert event == {
"result": "State is: on",
"listeners": {"all": False, "domains": [], "entities": ["light.test"]},
"listeners": {
"all": False,
"domains": [],
"entities": ["light.test"],
"time": False,
},
}
hass.states.async_set("light.test", "off")
@ -466,7 +481,12 @@ async def test_render_template_manual_entity_ids_no_longer_needed(
event = msg["event"]
assert event == {
"result": "State is: off",
"listeners": {"all": False, "domains": [], "entities": ["light.test"]},
"listeners": {
"all": False,
"domains": [],
"entities": ["light.test"],
"time": False,
},
}
@ -553,7 +573,12 @@ async def test_render_template_with_delayed_error(hass, websocket_client, caplog
event = msg["event"]
assert event == {
"result": "on",
"listeners": {"all": False, "domains": [], "entities": ["sensor.test"]},
"listeners": {
"all": False,
"domains": [],
"entities": ["sensor.test"],
"time": False,
},
}
msg = await websocket_client.receive_json()