Initialize the form state and the entity before the first form build.
protected function init(array &$form_state, EntityInterface $entity) {
// Add the controller to the form state so it can be easily accessed by
// module-provided form handlers there.
$form_state['controller'] = $this;
$this
->setEntity($entity, $form_state);
$this
->prepareEntity($entity);
}