I'm using esphome and some one wire sensors to monitor my window A/C, how to chart a delta

I did a bit more google fu and and found a solution from here.

# Example configuration entry
sensor:
  - platform: dallas_temp
    address: 0xc52d51d446013b28
    update_interval: 30s
    name: acout 
    id: Tr

  - platform: dallas_temp    
    address: 0x9840dad44628de28
    update_interval: 30s
    name:  acin
    id: Ta

  - platform: template
    name: "Delta T"
    id: Td
    unit_of_measurement: °F
    update_interval: 30s
    lambda: |-
      return (id(Ta).state - id(Tr).state);

I tried to use the name in the lambda equation but evidently I can not so I added the id value. Not understanding the name vs id thing but it works.