Platform numeric_state - legacy?

Hello,

I’m trying to create a trigger sensor with following code.
Is this correct with the actual syntax - can’t only finde triggers and numeric_stae within automation docs but not in template sensor guide.

I only want to capture actual timestamp (now()) if power meter measures more than 1 Watt for 5 secs.

- trigger:
    - platform: numeric_state
      above: 1
      for: "00:00:05"
      entity_id: sensor.tasmota_waschmaschine_energy_power
  sensor:
    - name: Waschmaschine Startzeit
      unique_id: sensor.waschmaschine_startzeit
      device_class: timestamp
      state: >
          {% if trigger %}
            {{ now() }}
          {% else %}
            "Waschmaschine ausgeschaltet"
          {% endif %}

This doesn’t work and I can’t finde the mistake - Studio Code Server mars the -platform: numeric_state as legacy…

What’s wrong here?

Thank you in advance!
BR

the platform part is legacy. it’s trigger now

Ok thx, can’t find this info.

So then it has to be this:


- trigger:
    - trigger: numeric_state
      above: 1
      for: "00:00:05"
      entity_id: sensor.tasmota_waschmaschine_energy_power

.....

Yes, that’s correct.

Thy syntax for triggers is the same as for automations, and has been changed in 2024.10.

Not that this only for the individual triggers and actions (as of 2024.8).
The top-level key in case of a trigger based template sensor is still trigger, condition and action, where for automations the plural form is used.

1 Like