How to create a new entity with default values if not passed?
For entities in general, set default values by adding preCreate() to your entity class:
  /**
   * {@inheritdoc}
   */
  public static function preCreate(EntityStorageInterface $storage_controller, array &amp;$values) {
    parent::preCreate($storage_controller, $values);
    $values += [
      'auto_open' =&gt; TRUE,
    ];
  }


In this specific case, define a class property with the same name as the field, which defaults to TRUE:
  /**
   * Auto Open.
   *
   * @var bool
   */
  protected $auto_open = TRUE;