def is_state(hass: HomeAssistant, entity_id: str, state: State) -> bool:
    'Test if a state is a specific value.'
    state_obj = _get_state(hass, entity_id)
    return ((state_obj is not None) and (state_obj.state == state))
Test if a state is a specific value.
def is_state(hass: HomeAssistant, entity_id: str, state: State) -> bool:
    
    state_obj = _get_state(hass, entity_id)
    return ((state_obj is not None) and (state_obj.state == state))