# Example automation. Paste it into the automation editor ("Edit in YAML"). # For automations.yaml instead, put "- " in front of the first line, indent the # rest by two spaces and add an id, for example: id: epf_cheapest_window_started alias: "EPF example: cheapest price window started" description: "Creates a Home Assistant notification as soon as the best price window is active." trigger: - platform: state entity_id: binary_sensor.epf_cheapest_price_window_active to: "on" condition: [] action: - service: persistent_notification.create data: title: "Cheapest price window active" message: > The cheapest price window is running now. Current price: {{ states('sensor.epf_current_price') }} {{ state_attr('sensor.energypriceforecast_api', 'flat').get('current_price_unit', 'EUR/kWh') if state_attr('sensor.energypriceforecast_api', 'flat') is mapping else 'EUR/kWh' }}. {% set left = states('sensor.epf_cheapest_price_window_remaining_minutes') %} {% if left not in ('unknown', 'unavailable') %}Time left: {{ left }} minutes.{% endif %} mode: single