Error when templating values in device trigger?

Hi …

The following trigger works with the constant numbers (15 and 60):

- id: bathroom_humidity_goes_low
    type: humidity
    device_id: ea366e5190f68e32fc354a80cf7cc390
    entity_id: 8115526df0131de8772f90f4afa4d1a8
    domain: sensor
    trigger: device
    below: 60
    for:
      hours: 0
      minutes: 15
      seconds: 0

And the following template works in other situations:

{{ states('input_number.bathroom_fan_time') }}

But if I try to replace the 15 or the 60 with the template, I get the following error:

** Error loading /config/configuration.yaml: invalid key: "{"states('input_number.bathroom_fan_time') ": None}"

Can anyone tell me what I’m doing wrong ?

Many thanks

Paul

Device triggers do not support templates.

This is super useful! Thank you! I did think that those cryptic device references were a bit suspect - I have changed almost all of them to entities & my templates are now working. I have just one case where I still have a device reference:

  - id: bathroom_fan_button_longpush
    type: long_push
    subtype: button1
    device_id: a9376566982c5f5c398121c5eef4707f
    domain: shelly
    trigger: device

If I try to use the entity in the trigger, I can’t see how to distinguish the “long push” from a simple press. Is there a way to do this without using the device ID?

Thanks again for your time

Paul

That looks like you need to use an event trigger instead.

Ah. Ok. Thanks. I will look in to that …

Paul