Automation trigger - dynamic from/to

Trying to write automation which send notification based on specific from → to status.
I.e
When the charger station change status from Disconnect to other status than “unavailable” or “charging”.

Tried with template for both case but it is not working:

- id: '1668424971559'
  alias: Charger station notify
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.wallbox_portal_status_description
    from: Disconnected
     condition:
      - condition: template
        value_template: |-
          - value_template: "{{ sensor.wallbox_portal_status_description != 'unavailable' or sensor.wallbox_portal_status_description != 'Unavailable'  }}"
  action:
  - service: notify.mobile_app
    data:
      message: Charger station { states('sensor.wallbox_portal_status_description') }}
      title: Update

Also tried filter out “unavailable” - also didn’t work

id: '1668424971559'
  alias: Charger station notify
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.wallbox_portal_status_description
    from: Disconnected
    condition: not
    condition:
      - condition: state
        entity_id:
            - sensor.wallbox_portal_status_description
        state: unavailable
  action:
  - service: notify.mobile_app
    data:
      message: Charger station { states('sensor.wallbox_portal_status_description') }}
      title: Update

Your indentation is all over the place. condition should be at the same horizontal position as action and trigger.

It’s also critical that the from: parameter exactly matches the state you’re looking for: is it realy Disconnected with a capital D?

Use the State Trigger’s not_to option.

- id: '1668424971559'
  alias: Charger station notify
  description: ''
  trigger:
    - platform: state
      entity_id: sensor.wallbox_portal_status_description
      from: 'Disconnected'
      not_to: 'unavailable'
  condition: []
  action:
    - service: notify.mobile_app
      data:
        message: 'Charger station {{ trigger.to_state.state }}'
        title: Update

NOTE

Go to Developer Tools > States, find sensor.wallbox_portal_status_description and check if its state value is Disconnected or disconnected.

EDIT

Correction. Removed extraneous space character.

@Taras - thanks but is not working ,
I did confirm the state "Charing " and “unavilable”

based on ur example:

- id: '1668424971559'
  alias: Charger station notify
  description: ''
  trigger:
    - platform: state
      event_type: state_changed
      entity_id: sensor.wallbox_portal_status_description
      from: 'Charging'
      not_to: 'Unavailable'
  condition: []
  action:
    - service: notify.avico_ha
      data:
        message: 'Charger station {{ trigger.event.data.new_state }}'
        title: Update

getting:


2022-11-19 15:32:59.707 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities automation.charger_station_notify or it is/they are currently not available

You made the following invalid changes to the example I posted:

  1. A State Trigger doesn’t have an event_type option.
  2. The trigger object doesn’t have an event property for a State Trigger.

References:
State Trigger
Templates - State Trigger

Do you mean Charging and unavailable?

You put Unavailable for not_to which is not equivalent to unavailable.

Your example with corrections.

- id: '1668424971559'
  alias: Charger station notify
  description: ''
  trigger:
    - platform: state
      entity_id: sensor.wallbox_portal_status_description
      from: 'Charging'
      not_to: 'unavailable'
  condition: []
  action:
    - service: notify.avico_ha
      data:
        message: 'Charger station {{ trigger.to_state.state }}'
        title: Update

Have your requirements changed? You originally wanted to know when the sensor changes from Disconnected but your example detects when it changes from Charging.