Some Automation work other do not

I stand corrected. The changes I made as recommended by mf_social only worked for some of the automations. All the sensors are the same (i.e. aeon labs open/close sensors). I can not for the likes of me see a difference between those that work and those that do not. Here is what I got:

automation:
 trigger:
    platform: state
    entity_id: binary_sensor.furnace_room_openclose_sensor_sensor
    to: 'off'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Furnace.Room.Open/Close.Sensor.Closed'

automation 1:
 initial_state: True 
 trigger:
    platform: state
    entity_id: binary_sensor.furnace_room_openclose_sensor_sensor
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Furnace.Room.Open/Close.Sensor.Open'
      

# ======================================================================
automation 2:
 trigger:
    platform: state
    entity_id: binary_sensor.sunroom_openclose_sensor_sensor
    to: 'off'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Sunroom.Door.Open/Close.Sensor.Closed'

automation 3:
 trigger:
    platform: state
    entity_id: binary_sensor.sunroom_openclose_sensor_sensor
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Sunroom.Door.Open/Close.Sensor.Open'
      
# ======================================================================
automation 4:
 trigger:
    platform: state
    entity_id: binary_sensor.backdoor_openclose_sensor_sensor
    to: 'off'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Backdoor.Open/Close.Sensor.Closed'

automation 5:
 trigger:
    platform: state
    entity_id: binary_sensor.backdoor_openclose_sensor_sensor
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Backdoor.Open/Close.Sensor.Open'
      
# ======================================================================
automation 6:
 trigger:
    platform: state
    entity_id: binary_sensor.frontdoor_openclose_sensor_sensor
    to: 'off'  
    
 action:
    service: notify.EventGhost
    data:
      message: 'Frontdoor.Open/Close.Sensor.Closed'

automation 7:
 trigger:
    platform: state
    entity_id: binary_sensor.frontdoor_openclose_sensor_sensor
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Frontdoor.Open/Close.Sensor.Open'
      
# ======================================================================    
automation 8:
 trigger:
    platform: state
    entity_id: binary_sensor.garage_foyer_openclose_sensor_sensor
    to: 'off'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Garage.Foyer.Open/Close.Sensor.Closed'

automation 9:
 trigger:
    platform: state
    entity_id: binary_sensor.garage_foyer_openclose_sensor_sensor
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Garage.Foyer.Open/Close.Sensor.Open'
# ======================================================================    
automation 10:
 trigger:
    platform: state
    entity_id: binary_sensor.aeotec_doorwindow_sensor_office
    to: 'off'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Office.Door.Open/Close.Sensor.Closed'

automation 11:
 trigger:
    platform: state
    entity_id: binary_sensor.aeotec_doorwindow_sensor_office
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Office.Door.Open/Close.Sensor.Open'

# ======================================================================   
automation 12:
 trigger:
    platform: state
    entity_id: binary_sensor.aeotec_doorwindow_sensor_spare
    to: 'off'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Foyer.LR.Gate.Sensor.Closed'

automation 13:
 initial_state: True 
 trigger:
    platform: state
    entity_id: binary_sensor.aeotec_doorwindow_sensor_spare
    to: 'on'
    
 action:
    service: notify.EventGhost
    data:
      message: 'Foyer.LR.Gate.Sensor.Open'

the automation up to and including automation 3: work fine. Automation 4 never triggers. Automation 5 and 6 work fine. from that point from automation 7 to automation 11 never trigger. Autonartion 12 works fine, 13 does not.

I am totally lost here. What is going on???

Your spaces seem a bit off; I thought you always had to use 2 spaces for indentation, you use either 1 or 3. Having said that, that is consistent between the ones that work and the ones that don’t work, so that doesn’t seem to be the reason.
Did you validate the code and does that throw any errors? Do you see errors in the log?

As the code looks exactly the same to me I think the error is in (the connection with) the sensors. Do you see the sensors in HA? Do you see their current state? When you click on them you will get a bar graph with their state over time. You should see them changing state there. If that’s not the case and they are always on or always off then you know that’s your problem. The states are indicated by colour , so even if the state change is really short you should still see litttle stripes, even if you can’t read the text.

The configuration/automation for these devices has not been modified for at least one year (more like two) except for one change. This last edit was changing state: ‘off’ to to: ‘off’’ This last edit (about one month ago) was recommended by mf_social as all these automations abruptly stopped working after a recent update. (sorry dont recall the version number of that particular update)

Each of the devices displays properly and its state is correctly updated when I view them via the web UI. The history graph reflects the state changes correctly.