To avoid binary sensors firing at startup, you can make your automations follow an inverted binary sensor:
- platform: template
sensors:
contact_inverted:
value_template: >-
{{ is_state('binary_sensor.contact', 'off') }}
device_class: door
Idea comes from ☔ DIY Zigbee rain gauge - #96 by oet