Sonoff Tasmota Binary Sensor unavailable after reboot

Since my core upgrade to 2022.2.6 all of my Sonoff binary sensors flashed to Tasmota go unavailable after reboot. I have created a automation to reset all of them to off after a reboot. The reset of the binary sensors work but I have to activate the automation manually. Following is the automation I have created, any help would be appreciated to make the automation activate automatically after reboot.

alias: Reset Binary Sensors after Reboot
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.basement_door
    to: unknown
    from: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - platform: state
    entity_id: binary_sensor.front_door
    from: 'off'
    to: unknown
condition: []
action:
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: E3957Eoff
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: E3AF1Eoff
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: CEAF0A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: CEAF0E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 10670A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 10670E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DCD40A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DCD40E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 0D250A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 0D250E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DE960A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DE960E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: F95E0A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: F95E0E
      qos: '1'
mode: single

add a trigger on homeassistant start


alias: Reset Binary Sensors after Reboot
description: ''
trigger:
  - event: start
    platform: homeassistant
  - platform: state
    entity_id: binary_sensor.basement_door
    to: unknown
    from: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - platform: state
    entity_id: binary_sensor.front_door
    from: 'off'
    to: unknown
condition: []
action:
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: E3957Eoff
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: E3AF1Eoff
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: CEAF0A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: CEAF0E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 10670A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 10670E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DCD40A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DCD40E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 0D250A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: 0D250E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DE960A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: DE960E
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: F95E0A
      qos: '1'
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge_1/RESULT
      payload: F95E0E
      qos: '1'
mode: single

Thank You that was the fix??

If the payload is published as a retained message then the state will be known when Home Assistant restarts (and wouldn’t require an automation to set states on startup).

You may wish to consider implementing one of the two strategies presented here:

Both re-publish payloads received from the RF Bridge as retained messages, thereby preventing associated binary_sensors from being reported as unavailable on startup.

I have one other automation that does not work automatically. I am using Amazon Guard which I can turn on manually with the following automation but will not automatically turn on with the state of my device_tracker.sm_a326u app on my Android phone set to away. Guard turns off automatically using the second automation. Thanks Again for sharing your knowledge!!

alias: Cell Phone Not Home Guard On
trigger:
  - entity_id: device_tracker.sm_a326u
    platform: state
    to: away
condition: []
action:
  - service: notify.mobile_app_sm_a326u
    data:
      message: Guard is turned on
  - service: alarm_control_panel.alarm_arm_away
    data: {}
    target:
      entity_id: alarm_control_panel.alexa_guard_503c2_5
mode: single

alias: 'Cell Phone Home Turn Gurard Off '
description: ''
trigger:
  - platform: state
    entity_id: device_tracker.sm_a326u
    to: home
condition: []
action:
  - service: alarm_control_panel.alarm_disarm
    target:
      entity_id: alarm_control_panel.alexa_guard_503c2_2
    data: {}
  - service: notify.mobile_app_sm_a326u
    data:
      message: Guard Turned Off
mode: single