MCCGQ11LM Aqara door & window contact sensor - Problem restarting

How can I optimize the automation?
The Xiaomi MCCGQ11LM - Aqara door & window contact sensors are connected via Zigbee2MQTT.

The problem is, whenever I reboot the home assistant, the status of the sensors is unknown and therefore the automation script is not working properly.

arch	armv7l
dev	false
docker	false
hassio	false
os_name	Linux
python_version	3.7.3
timezone	Europe/Vaduz
version	0.97.2
virtualenv	true
Lovelace
mode	yaml
resources	27
views	6

I always get the message that the door is open, even if the sensor is closed. Only when the first message comes from the sensor, the automation works properly.

It looks like the default value is not used and therefore the wrong status is reported.

value_template: "{{ value_json.contact | default(true) }}"

Current Settings

# MCCGQ11LM - Aqara door & window contact sensor 
# {
#   "contact" : true,
#   "linkquality" : 110,
#   "last_seen" : "2019-08-23T17:16:11+02:00",
#   "battery" : 100,
#   "voltage" : 3015,
#   "elapsed" : 807,
#   "device" : {
#     "ieeeAddr" : "0x00158d0003eef3c6",
#     "friendlyName" : "0x00158d0003eef3c6",
#     "type" : "EndDevice",
#     "nwkAddr" : 57079,
#     "manufId" : 4151,
#     "manufName" : "LUMI",
#     "powerSource" : "Battery",
#     "modelId" : "lumi.sensor_magnet.aq2",
#     "hwVersion" : 2,
#     "swBuildId" : "3000-0001",
#     "dateCode" : "20161128",
#     "status" : "online"
#   }
# }


## binary sensor
- platform: "mqtt"
  name: 'Türsensensor 1 Status'
  state_topic: "zigbee2mqtt/0x00158d0003eef3c6"
  payload_on: true
  payload_off: false
  availability_topic: "zigbee2mqtt/bridge/state"
  payload_available: "online"
  payload_not_available: "offline"
  value_template: "{{ value_json.contact | default(true) }}"
  device_class: "door"
  json_attributes_topic: "zigbee2mqtt/0x00158d0003f13798"

## Automation
- id: door_sensor1_warning_message
  alias: Türsensor 1 Warnmeldung
  initial_state: true
  trigger:
  - seconds: /20
    platform: time_pattern
  condition:
    condition: state
    entity_id: binary_sensor.tursensensor_1_status
    state: 'off'
    for:
      seconds: 10
  action:
    - service: script.appmessage
      data:
        message: "Tür 1 ist offen. {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
        title: "Warnmeldung Türe 1"
    - service: system_log.write
      data_template:
        message: 'Automations: door_sensor1_status warning'
        level: info   

system_log

2019-08-25 13:03:14 INFO (MainThread) [homeassistant.components.system_log.external] Automations: boot notifiy
2019-08-25 13:03:20 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:03:40 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:04:20 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:04:40 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:05:00 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:05:20 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:05:40 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:06:00 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status warning
2019-08-25 13:07:00 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status open to closed
019-08-25 13:07:21 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status close to open
2019-08-25 13:07:39 INFO (MainThread) [homeassistant.components.system_log.external] Automations: door_sensor1_status open to closed
... no more door_sensor1_status warning

Is there a solution for this ?