mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Support trigger-based template binary sensors (#49504)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
@@ -41,6 +41,10 @@ async def test_reloadable(hass):
|
||||
"name": "top level state",
|
||||
"state": "{{ states.sensor.top_level.state }} + 2",
|
||||
},
|
||||
"binary_sensor": {
|
||||
"name": "top level state",
|
||||
"state": "{{ states.sensor.top_level.state == 'init' }}",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -50,15 +54,17 @@ async def test_reloadable(hass):
|
||||
await hass.async_start()
|
||||
await hass.async_block_till_done()
|
||||
assert hass.states.get("sensor.top_level_state").state == "unknown + 2"
|
||||
assert hass.states.get("binary_sensor.top_level_state").state == "off"
|
||||
|
||||
hass.bus.async_fire("event_1", {"source": "init"})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(hass.states.async_all()) == 4
|
||||
assert len(hass.states.async_all()) == 5
|
||||
assert hass.states.get("sensor.state").state == "mytest"
|
||||
assert hass.states.get("sensor.top_level").state == "init"
|
||||
await hass.async_block_till_done()
|
||||
assert hass.states.get("sensor.top_level_state").state == "init + 2"
|
||||
assert hass.states.get("binary_sensor.top_level_state").state == "on"
|
||||
|
||||
yaml_path = path.join(
|
||||
_get_fixtures_base_path(),
|
||||
|
||||
Reference in New Issue
Block a user