Init template trigger binary sensor to None instead of False (#62769)

pull/62874/head
Amos Yuen 2021-12-27 11:52:26 -08:00 committed by GitHub
parent 17fbfe2eed
commit 45ab9a3e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -324,7 +324,7 @@ class TriggerBinarySensorEntity(TriggerEntity, BinarySensorEntity):
self._delay_cancel = None
self._auto_off_cancel = None
self._state = False
self._state = None
@property
def is_on(self) -> bool:

View File

@ -909,11 +909,11 @@ async def test_trigger_entity(hass, start_ha):
await hass.async_block_till_done()
state = hass.states.get("binary_sensor.hello_name")
assert state is not None
assert state.state == OFF
assert state.state == STATE_UNKNOWN
state = hass.states.get("binary_sensor.bare_minimum")
assert state is not None
assert state.state == OFF
assert state.state == STATE_UNKNOWN
context = Context()
hass.bus.async_fire("test_event", {"beer": 2}, context=context)
@ -976,7 +976,7 @@ async def test_trigger_entity(hass, start_ha):
async def test_template_with_trigger_templated_delay_on(hass, start_ha):
"""Test binary sensor template with template delay on."""
state = hass.states.get("binary_sensor.test")
assert state.state == OFF
assert state.state == STATE_UNKNOWN
context = Context()
hass.bus.async_fire("test_event", {"beer": 2}, context=context)