Triggering on any, but only state changes not possible in visual editor

In version 2021.12 is finally introduced posisibility to trigger automation on state change only, or on attribute change only.
According blog it should work like this:

automation:
  trigger:
    - platform: state
      entity_id: media_player.living_room
      to: ~

It works indeed, but ~ (tilde) is impossible to use with visual editor, it place ‘~’ instead.
If I change to ~ by editor, it works, but can’t be edited with visual editor:

Visual editor is not supported for this configuration
The provided value for 'to' is not supported by the visual editor. We support (string) but received (null).
You can still edit your config in YAML.
Edit in YAML
platform: state
entity_id: binary_sensor.perilica_aktivna
to: null

I read the release notes about this and to be honest didn’t truly understand it as I have been triggering of state changes for some time by simply omitting the “to” or “from”.

Maybe I am missing something myself but this works and has always worked for me.

I really don’t know. My experience is that visual editor can’t place tilde in to field.
Worse, if I save ANY automation from visual editor, each tilde placed by external editor in each automation vanished.

Your code will trigger on attribute changes as well.

The new functionality allows to trigger on state changes only, whatever the state actually is (i.e. without having to enumerate them).

1 Like

And it doesn’t work?
YAML should consider it as string, be it with qoute or not, so it should be equivalent.

I will check again, but I am almost sure that quoted ‘~’ not working.

My mistake. Tilde as string ( ‘~’) works. Sorry for unnecessary alert.

Please mark you thread as solved, so that it doesn’t frighten other users :wink: