#Script variables in manual event trigger

1 messages · Page 1 of 1 (latest)

twilit fog
#

I'm trying to use a script with fields/variables to manually fire an event.

sequence:
  - event: esphome.epad1_update
    event_data:
      button: "{{ button }}"
      mode: "{{ mode }}"
fields:
  button:
    selector:
      text: null
    name: button
  mode:
    selector:
      text: null
    name: mode
description: ""```

If I hard code the button and mode fields, it works

From event viewer:
 ```event_type: esphome.epad1_update
data:
  button: "0"
  mode: "4"
origin: LOCAL
time_fired: "2025-01-27T06:14:51.352854+00:00"
context:
  id: 01JJK6C16RDE0ZDC4GC23J42NJ
  parent_id: null
  user_id: dcb1d0ae2a5547a9bff080c880c2c474```

When I use variables/fields in from the script it seems to be forcing the values to be numbers

```event_type: esphome.epad1_update
data:
  button: 0
  mode: 4
origin: LOCAL
time_fired: "2025-01-27T06:26:36.238111+00:00"
context:
  id: 01JJK71HJBE710F89Q7JTMK0WH
  parent_id: null
  user_id: dcb1d0ae2a5547a9bff080c880c2c474```

I've tried a bunch of things to *force* the field type and it's all very confusing.  Thanks for any help.