#Trying to pass variable in esphome event

1 messages · Page 1 of 1 (latest)

pulsar summit
#

I have an esphome script on a keypad and I'm trying to pass the value of a variable during a homeassistant event in the data. I've tried many variations and don't know if a lambda is the only way but I haven't done anyting with lambdas yet.

on_click: 
  then:
    if:
      condition:
        - binary_sensor.is_off: button_0
      then:
        - homeassistant.event: 
            event: esphome.epad1_update
            data: 
              button: "${pad_mode}"    <------------  Want to pass variable value
      else:
        - globals.set: 
            id: pad_mode
            value: "1"

What am I missing?