Which trigger for change price

Hi,
I have a sensor for a price of gasoline at the gas station.
sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10
How can I define a trigger when the price changes.

How can I output to Alexa the value of the sonor?
sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10

Thanks and kind regards,
Andreas

Normally you would use a numeric state triggger, but if you want it to trigger on any change of state use a state trigger:

trigger:
  - platform: state
    entity_id: sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10
    to:

Having a null to: will trigger on any change of state and ignore attribute changes. If you want to trigger on attribute changes too, then leave out the to: altogether.

For the message:

  data:
    message: "The price changed from {{ trigger.from_state.state}} to {{ trigger.to_state.state }}"

Or you can just use the sensor state:

  data:
    message: "The price changed and is now {{ states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10') }}"

Hi Tom,

thanks for your replay and support. Your code work perfekt.

i would like add the code for check if gas station closed. The problem is, i received a error

This is my code:

{ %if is_states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10', 'unknown') %}
gas station is closed
{% else %}
"The price changed and is now {{ states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10') }}"

What is my issue?

Thanks and kind regards,
Andreas

Try this:

 data:
    message: >
      {% if is_states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10', 'unknown') %}
        The gas station is closed.
      {% else %}
        The price changed and is now {{ states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10') }}
      {% endif %}

Hi,
This code work perfect. Thanks for this.
I have only one problem for the output to Alexa.
The price for Diesel is 1.969 EUR and the Output to Alexa is 1969 EUR.

What can I do for outcome to 1,969 EUR or 1,97 EUR ?

Thanks and kind regards,
Andreas

 data:
    message: >
      {% if is_states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10', 'unknown') %}
        The gas station is closed.
      {% else %}
        The price changed and is now {{ ( states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10')|int(0) / 1000 )|round(2) }}
      {% endif %}

Hi Tom,
thanks for your response, but the outcome for 1,959 EUR is 0.0 EUR.

Kind regards,
Andreas

{{ (states('sensor.tankerkoenig_jet_wuelfrath_wilhelmstr_34_38_e10') | float(0)) | round(2) }}

Hi, when insert this code is the outcome 0,0

Kind regards

Hi Dennis,
Thanks for your code: Below Code working now:

Der Preis für E10 begrägt bei ARAL {{ states('sensor.tankerkoenig_aral_tankstelle_e10') | round(2) | replace('.', ',') }} EUR

Kind regards,
Andreas