Trigger template, will it keep firing?

I got a bit unsure now that I’m about to save the automation.
This part here:

trigger:
  - platform: template
    value_template: '{{ states(''sensor.andreas_wifi_bssid'')[0:8] == "SomeWIFI" }}'

It will only trigger the first time it’s true right?
It won’t fire all the time, right?
And especially, if I connect o “SomeWIFI - 5 GHz” after “SomeWIFI” then it will not fire again will it?
It will only fire when going from a completely different wifi or ?

1 Like

I will trigger every time the state of sensor.andreas_wifi_bssid changes.

My bad. See

So:

<not connected>
SomeWIFI
SomeWIFI - 5 GHz
SomeWIFI 
SomeWIFI - 5 GHz

is four triggers?

They are, indeed

1 Like

If you are comparing SSID, shouldn’t you use sensor.andreas_wifi_ssid?
When using BSSID, it shows the MAC Address of the AP.

The Template Trigger’s template will be evaluated every time the sensor’s value changes.

The Template Trigger will be triggered only when, after evaluating its template, the result changes from false to true.

1 Like

My bad… I just copied the wrong entity.

That sounds better!
That is what I thought.

So if each time it evaluates the template the result is true, it only triggers the first time when the previous result was false. It won’t re-trigger until it evaluates to false first and then back to true (it’s the false to true transition that is needed for triggering).

The exception to this is if the Template Trigger computes a numeric value instead of a boolean value (which came as a surprise for me because I thought it always had to be boolean).

In the example you posted, containing alternating SSIDs, the template will always find SomeWiFi in the four cases. Therefore it will evaluate the template several times but only trigger once.