Getting a trigger’s state in an automation for logging

I’m trying to convert the following automation to work for multiple binary sensors, by adding the entity id in the trigger. The second message, which is commented out will return the state (on/off) of the hard coded entity id, but not the first message which uses the trigger. What am I doing wrong?

- alias: tms
  trigger:
    platform: state
    entity_id: binary_sensor.towel_motion_sensor
  action:
  - service: system_log.write
    data_template:
      message: "The state of {{trigger.entity_id}} is {{states.trigger.state}}"
      #message: "The state of the sensor is {{states.binary_sensor.towel_motion_sensor.state}}"
      level: error

Also, is there a way to get DEBUG statements to show up in LOG GUI instead of having to show the whole log and scroll down?

This is not valid {{states.trigger.state}}

Try like this:

- alias: tms
  trigger:
    platform: state
    entity_id: binary_sensor.towel_motion_sensor
  action:
  - service: system_log.write
    data_template:
      message: "The state of {{trigger.to_state.name}} is {{trigger.to_state.state}}"
      #message: "The state of the sensor is {{states.binary_sensor.towel_motion_sensor.state}}"
      level: error

About the logging, you can find more information here: